Permora

A parking sign reader built with Flutter. Photograph a whole sign post and an AI model writes each plate down as a rule; the driver checks any plate it was unsure of, and the phone works out the rest: may the car stay here now, until which minute, on which day of the week, with which permits. The car's move-by time goes on a curb card with a reminder. A Laravel key proxy with an admin panel and a one-page product website are in the same download.

Flutter and Material 3Gemini, OpenAI, Claude or your server Demo mode needs no keyDark and light English, Spanish, ArabicLaravel key proxy included Landing page included

1Permora, from a photo of a post to a verdict

18 screens 3 engines 3 AI jobs 133 app tests 10 feature packs

Permora is an app for a driver standing in front of a parking sign post with four plates on it and a car to leave. They take one photo of the whole post. An AI model writes each plate down as a rule (which days, which hours, how long, whose permit), the driver checks any plate the model was not sure of, and from then on the phone answers by itself: may I park here now, until when, and what about Saturday at nine.

That split is the product. The model only transcribes what is printed; its reply has no field for a verdict, so it cannot tell anyone they may park. Whether the car can stay, and until what minute, is worked out by 3 small pure-Dart engines from the confirmed plates, the moment asked about and the permits the driver holds. The same post asked about the same minute gives the same answer on every phone.

The download holds three things:

  • The Flutter app (permora_ai_app/): 18 screens, light and dark, 3 languages, and a Demo mode that answers on the device with no key and no network.
  • A Laravel back end (backend/): a key proxy that keeps your AI provider keys on your own server, runs only this app's three jobs within per-device and server-wide caps, logs every call, keeps a copy of the photos read through it, and comes with a Filament admin panel.
  • A one-page product website (landing/), a self-contained HTML file in the app's colors and typefaces.

Out of the box the app opens in Demo mode with a sample driver's week already in it: 3 saved posts (a residential street with zone permits, an office street with a two-hour limit and a tow-away evening, and a UK street with a loading bay), 2 permits, 6 parking stops, one of them still running, and 4 sample posts to read. Add a key of your own, or build against the back end, and it reads real photographs.

2What your machine needs before the first build

You need a working Flutter toolchain and one of the two mobile SDKs.

WhatVersionNotes
Flutter SDK3.47 or newer Dart 3.13 or newer comes with it. The project pins 3.47.2 in .fvmrc for people who use fvm; plain flutter works too.
AndroidcompileSdk 36 Android Studio with the command line tools, and JDK 17. Gradle 9 and AGP 9.1 come with the project.
iOSXcode 16 or newer Nothing else. The iOS plugins come in through Swift Package Manager, which Xcode resolves on the first build; the project needs no CocoaPods.
Back endPHP 8.4+ Laravel 13 will not run on PHP 8.2 or 8.3. Check the PHP version your host offers before you buy the plan; many shared plans still default to 8.2. Docker needs no PHP on your machine at all.
An AI keyoptional to try Demo mode needs none. To read real photographs you need either a key from Google, OpenAI or Anthropic, or the back end holding one.

The app depends on 23 packages, and packages/, the feature packs, is part of the project: do not delete it.

3Unzip, run, read the first post

The Flutter project sits at the top of permora_ai_app/; there is no extra folder to step into.

cd permora_ai_app
flutter pub get
flutter run

The app opens on a splash, three onboarding pages and the sign-in screen. Run like this, with no server address, the sign-in form is in Demo mode: any email and password open the app, empty fields included, and nothing leaves the phone. Built against the included back end, sign-up, sign-in and password reset are real; the accounts chapter has the details.

You land on the Check tab in Demo mode, with the office post's verdict on top. Tap Read a post, keep the picked sample and press Read the plates: Demo mode returns that sample's plates through the same parser a live reply goes through, so you see the whole path, the plate needing a look included, without a key.

Check it

flutter analyze     # expect: No issues found!
flutter test        # expect: All tests passed!  (133 tests)

Running it without a terminal

  1. Open the permora_ai_app folder in Android Studio (File → Open) or in VS Code with the Flutter extension.
  2. Accept the IDE's offer to run Pub get (Android Studio shows it as a banner over pubspec.yaml).
  3. Choose a simulator or a plugged-in phone in the device menu and press the green Run button.

Each --dart-define in this manual also has a one-file alternative; the chapter on building the app against your server shows it.

4Every Permora screen and what it answers

18 screens: four tabs, the screens they open, and Settings behind the avatar on Check. Editing a plate, parking, adding a permit and reading a permit are bottom sheets over them.

WhereScreenWhat it answers
EntrySplash, onboarding (three pages) The post mark; three photo pages: read the post, ask about any hour, park and get reminded.
Sign in, create accountA demo form, plus Google and Apple once configured.
Check tabCheckThe last post's verdict lettered on a plate over its photo, the car that is parked now with its move-by time, your posts, and Read a post.
Parked tabParkedWhere the car is, on the curb card with its move-by time and the reminder switch, and every earlier stop with how long it lasted and whether the car left in time.
Permits tabPermitsThe zones you hold, as windshield discs, with what a permit does and does not excuse.
Posts tabPostsEvery post you have read, newest first, each with what it says right now.
A postRead a postOne or two photos (or a sample in Demo mode), the country, the What we send panel, and typing the plates in by hand.
PostThe verdict, the plates hung on their pole, plates that need a look, the week ribbons, Why this answer?, share, and Park here, a sheet with a photo of the spot, a note and the reminder before the move-by time.
AccountSettingsDemo mode, AI route, theme, language, lock, notifications, privacy, country, clock, reminder lead, your data.
AI and key proxyWho reads the photos: Demo mode, the included server, or a key of your own.
How it worksAbout: what is worked out on the phone, what the AI is asked, where data lives, what the app does not do.
Permora ProThe in-app purchase screen (a mock until you add store product ids).
The app's screens at thumbnail size
The app in order, from the splash to the Pro screen, in the light theme, then the four tabs and a post in dark. A few screens appear twice, in two states (a plate before and after Looks right, the week line before and after it is moved), and the sheets appear over the screens they open from.

5How this manual writes paths, times and placeholders

  • Paths are relative to the folder they belong to: lib/…, test/… and assets/… are inside permora_ai_app/; app/…, routes/…, config/… and database/… are inside backend/.
  • Anything in <angle brackets> is a value you supply. The brackets are not part of it.
  • file.dart:42 means line 42 of that file, measured when this manual was built.
  • "Demo mode" means the sample week in lib/app/data/mock/sample_data.dart and the on-device answer in the qh_ai pack's demo route; "the back end" or "your server" means backend/.
  • Times are written the way the app prints them for the United States, 6:00 PM. A post's country sets the clock the app prints (24-hour for the UK, Ireland and anywhere else), and Settings overrides it.

6Highlighter magenta and the verdict colors

Every color is in lib/app/core/theme/app_colors.dart, the light and dark values side by side. Light is the default theme.

One brand color, three grades

A highlighter magenta, because the app does what a highlighter does: of all the plates on a post, it marks the ones that rule the moment you asked about. White text needs a fill dark enough to read on, and a dark ground needs a brighter tint, so the magenta comes in three grades with one job each:

ConstantValueUsed for
primary#C40895 The light theme's fill: buttons, selected chips, the active tab, the plates that apply now. White on it. Also the store tile and the splash.
primaryDeep#8E0669 Magenta words on the light paper.
primaryBright#FF6FD6 The dark theme's fill and highlights, with dark ink on it.

Verdict colors mean one thing each

ConstantsMeans
allowLight / allowDarkPark: free, or covered by your permit. The only green in the app.
limitLight / limitDarkPark for a while: a time limit or a meter.
forbidLight / forbidDarkDo not leave the car: no parking, tow-away, loading only, permit holders only.
permitLight / permitDarkYour permit is what makes it allowed.

The pole, the bolts and the curb (pole, bolt, curb…) are neutral grays so they never compete with a verdict.

When you change a grade, keep its pair readable: a selected chip is the fill with its label on it, and test/theme_contrast_test.dart and test/chip_contrast_test.dart fail below 4.5:1. The second one draws real chips and reads their pixels, so it also catches a label color the widget ignores.

7Oswald, Be Vietnam Pro, and swapping them

Two families, bundled as 6 static files in assets/fonts/ and never downloaded: Oswald (500, 600, 700), condensed like the lettering on a street plate, for headings, verdicts, plate faces and every time of day; and Be Vietnam Pro (400, 500, 600) for everything you read in sentences.

  1. Put your .ttf files in assets/fonts/. Use static files: a variable font's file name has square brackets in it, which a web build encodes and a marketplace upload refuses.
  2. Edit the fonts: block in pubspec.yaml, one entry per weight.
  3. Change headingFamily and bodyFamily in lib/app/core/theme/app_text_theme.dart, the one Dart file that names a font.
  4. Rewrite assets/fonts/LICENSES.txt for what you ship.

The Roboto entry in pubspec.yaml points at the body face on purpose: Material falls back to Roboto for anything it draws from its own defaults, and a web build would otherwise fetch it from Google's font servers.

8The post-and-plates launcher icon

The launcher icon is the post mark: a white pole with two plates, lettering cut out of them, on the magenta fill. The splash draws the same mark in Dart, so opening the app continues the icon.

Replacing it with your own artwork

  1. Make a 1024 × 1024 PNG, with no transparency and square corners: both stores round the corners themselves, and iOS rejects an icon with an alpha channel.
  2. For Android's adaptive icon, make a second 1024 × 1024 PNG with only the mark on a transparent background, kept inside the middle 66%, because phones crop the outside to a circle, a squircle or a teardrop.
  3. Save them as assets/icon/app_icon.png and assets/icon/app_icon_foreground.png, and set adaptive_icon_background in pubspec.yaml to the color behind the mark (it ships as #C40895).
  4. Run dart run flutter_launcher_icons. It writes every mipmap-* folder on Android and the whole AppIcon.appiconset on iOS.
  5. Delete the app from the simulator or phone and run it again: both platforms keep the old icon until the app is reinstalled.

Keep the splash in step

The splash draws the mark with BrandMark in lib/app/modules/splash/splash_view.dart: seven rounded rectangles in fractions of the icon's size. Change them to match your icon, or replace the painter with an Image.asset of your foreground PNG. Replace web/favicon.png and the files in web/icons/ with your mark at the sizes already there.

9Renaming Permora and changing its bundle id

The name people read under the icon and the identifier the stores use are two separate things, set in separate places.

WhatAndroidiOS
Name under the icon android:label in android/app/src/main/AndroidManifest.xml CFBundleDisplayName and CFBundleName in ios/Runner/Info.plist
Bundle identifier applicationId and namespace in android/app/build.gradle.kts (now com.permora.permora_ai_app) PRODUCT_BUNDLE_IDENTIFIER in ios/Runner.xcodeproj/project.pbxproj: three Runner lines and three RunnerTests lines (now com.permora.permoraAiApp). Simplest in Xcode: Runner target → Signing & Capabilities → Bundle Identifier.
Title in the task switcher title: in lib/main.dart

If you change namespace on Android, move MainActivity.kt to the matching folder under android/app/src/main/kotlin/ and change its package line. iOS identifiers cannot contain underscores.

The wordmark, the storage keys and the reminder channel all read lib/app/core/values/app_identity.dart; the sentences that say "Permora" (the Pro screen, the lock prompt, the onboarding) are in the language files in lib/l10n/, so search each one for the old name.

10Street photographs and the four sample posts

Two folders of pictures ship with the app.

Street photographs

13 photographs in assets/images/street/: sign posts and plates for onboarding, the sign-in screen and the cards, a meter and a few curbs for the sample parking stops. They are royalty-free Pexels stock under the Pexels License, and LICENSES.txt in the same folder lists each one: file, where it is used, source page, photographer. None shows a readable license plate.

The sample posts

4 drawings in assets/images/illustrations/, each a whole sign post with its plates lettered on it: the four posts Demo mode can "read". A drawing is used rather than a photograph so the plates on the picture are exactly the plates the demo answer returns; each PNG has its SVG source beside it, and ASSETS.txt says which sample uses which.

Both folders are sample content. Replace the files with your own and keep the names, or change the names and update lib/app/data/mock/sample_data.dart and the screens that point at them. A post or a parking stop saved without a photo is drawn with a plain placeholder. Keep each photograph under about 150 KB, long edge near 1280 px.

11The feature packs, each off until you switch it on

10 feature packs, in 12 small packages under packages/: 10 interfaces and the two Firebase implementations two of them plug into, each with a mock or no-op default behind it. Nothing here runs until you switch it on, which is why the app you just ran asked for no permission beyond the camera, sent nothing anywhere and charged nobody. Every switch lives in one file: lib/app/core/values/feature_config.dart. The single place that chooses an implementation is lib/app/data/services/feature_packs.dart; screens only ever see the interface.

Languages (qh_l10n)

English, Spanish and Arabic ship. Every word the app shows comes from one file per language in lib/l10n/. Settings → Language switches the whole app at once; Arabic flips the layout. The app also sends the language to your server (Accept-Language), so the back end's messages come back in it.

To…Change
Add a languageCopy lib/l10n/es.dart to <code>.dart, rename the constant, translate the values (the date.* lines are month and weekday names). Add its import and its name to the list in lib/l10n/app_languages.dart.
Remove a languageDelete its name and import from that list.
Change a sentenceEdit the value in en.dart and in each other language file. The keys stay the same.

test/l10n_test.dart fails when a language is missing a key or still has English in it. Names the driver types (a post's name, a note, a permit's label) are kept as typed; everything the app writes is translated.

Before you release

The Spanish and Arabic tables are machine-assisted. Have a native speaker read both before the app reaches real people.

AI routes (qh_ai)

The four routes to a model (Gemini, OpenAI and Claude with a person's own key, and the included key proxy) and the on-device demo route, behind one AiAdapter interface, plain REST with no vendor SDK. The jobs themselves (what to ask, the reply shape, the parser) stay in the app under lib/app/data/providers/. The chapter Choosing who reads the photos: key, server or demo covers keys, model names and the server.

Lock on launch (qh_biometric)

Settings → Security. The switch is disabled on a phone with no enrolled biometrics. iOS shows the sentence in NSFaceIDUsageDescription (ios/Runner/Info.plist); Android needs nothing further: the manifest declares USE_BIOMETRIC and the activity is a FlutterFragmentActivity.

Version prompts (qh_upgrade)

With API_BASE_URL set at build time, the app asks GET /api/version once per launch. You drive it from the admin panel's App updates page: each row is a release with the latest version, the oldest version still allowed to run, the sentence the prompt shows, the two store links and the time it goes live, and the newest published row is the one the server answers with. Until a row is published, the server falls back to APP_LATEST_VERSION, APP_MINIMUM_VERSION, APP_UPDATE_MESSAGE and the two store URLs in its .env. Below the minimum, the dialog has no Later button.

Analytics and crash reports (qh_analytics + qh_analytics_firebase)

Needs a Firebase project. Run flutterfire configure, set firebaseConfigured = true in lib/firebase_config.dart, and enable Analytics and Crashlytics in the console. Settings → Privacy is the consent switch; with it off nothing is collected, and posts, plates and permits are never sent either way. FeatureConfig.analyticsDefaultOn decides where the switch starts. Demo mode never initializes Firebase, whatever the flag says.

Without a terminal: in the Firebase console, add an Android app and an iOS app with the bundle identifiers from the app name chapter, download google-services.json and GoogleService-Info.plist, put them in android/app/ and ios/Runner/, and copy the API key, app id, sender id and project id from them into the matching fields of lib/firebase_options.dart by hand. Then flip the flag.

Push notifications (qh_push + qh_push_firebase)

The same Firebase project, plus the Push Notifications capability in Xcode and an APNs key uploaded to the console. Permission is asked in Settings → Notifications, never at launch. Every install subscribes to the topic in FeatureConfig.pushBroadcastTopic (all), so the admin panel's Send notification page, which needs FIREBASE_CREDENTIALS in the back end's .env, reaches all of them. A message with a route key opens that screen, for example /capture. Pick a time under Send later and the server sends it then; Push history lists every send with its status and cancels a scheduled one before it goes. For a send to everyone its Phones column shows 1, because Firebase reports that it accepted the message, not how many phones received it. A send for later needs the scheduler's cron line (the chapter on putting the back end on a server).

Continue with Google / Apple (qh_social_login)

Outside Demo mode the buttons appear only for the providers you configure, and with API_BASE_URL set the id token is exchanged at POST /api/auth/social. Every console step, for both providers on both platforms, is in the chapter Setting up Google and Apple sign-in.

In-app purchases (qh_iap)

The Permora Pro screen sells one digital unlock: unlimited saved posts (the free plan keeps 50 posts). Its product ids go in FeatureConfig.iapProductIds, keyed by plan id (monthly, yearly, lifetime). Until you build with --dart-define=IAP=on the screen is a mock: instant, always succeeds, charges nothing, and says so on the screen. The store steps are in the chapter Setting up in-app purchases.

The Permora Pro screen with the mock checkout note
The purchase screen as shipped. The line under the title and the note under the button both say the checkout is a mock; the only benefit listed that the code gates is the number of saved posts.

Pictures (qh_image)

QhNetworkImage shows a picture from an https:// URL or a bundled asset://assets/images/… file, with a placeholder while loading and a neutral box if the URL is dead. The sample photos are bundled assets; use the pack when your posts or photos come from a server.

Sharing (qh_share)

Share the rules in a post's menu hands the post's name, the verdict on screen and every plate (kind, hours, days, zone) to the system sheet as text, for a passenger or whoever takes the car later. On iPad the sheet is anchored to the button that was tapped.

Costs

Switching packs on connects the app to third-party services (Firebase, Google Cloud, the Apple and Google developer programs and their stores), which will involve accounts of your own and will incur their own separate costs, billed by those providers to you. None of them is included in this item.

12Setting up in-app purchases

The paywall and the qh_iap pack are finished; what is left is on the stores' side. Until you do the steps below the app runs a mock checkout: every purchase succeeds instantly, charges nothing and says so on screen, which is what the walkthrough and the Live Preview show. Do the store you ship to first; each takes about an hour, most of it waiting for the store.

What the app already doesWhere
Reads prices from the store, in the buyer's currencySubscriptionService · StorePurchaseGateway
Keeps Pro after a purchase, offline toothe encrypted store on the phone
Restore purchases (one tap on the paywall)PurchaseGateway.restore()
Android's billing permissionandroid.permission.BILLING is already in AndroidManifest.xml
Verifies each purchase with your own serverleft to you: the verify hook on StorePurchaseGateway

1. Put the product ids in one file

Pick one id per plan and use the same id in both stores. The keys are the plan ids the paywall already shows; the values are what you create in the stores:

// lib/app/core/values/feature_config.dart
static const iapProductIds = <String, String>{
  'monthly': 'com.permora.permoraAiApp.pro.monthly',
  'yearly': 'com.permora.permoraAiApp.pro.yearly',
  'lifetime': 'com.permora.permoraAiApp.pro.lifetime',
};

Store ids cannot be reused after you delete them, so settle on the names first.

2. App Store Connect (iOS)

  1. Agreements, Tax, and Banking → accept the Paid Apps agreement and fill in tax and bank details. Until its status is Active, the store returns no products at all. That is the most common reason a paywall shows the mock prices on a real phone.
  2. Apps → + → New App with bundle id com.permora.permoraAiApp (it must match Xcode exactly).
  3. In the app: Monetization → Subscriptions → create a subscription group (for example Permora Pro), then one subscription per recurring plan with the ids from step 1. A one-off plan (lifetime) goes under In-App Purchases as Non-Consumable.
  4. Give each product a price, a display name and a review screenshot (the paywall screen is fine). Products stay Missing Metadata, and invisible to the app, until all three are there.
  5. Users and Access → Sandbox → Test Accounts → add a tester with an e-mail that is not a real Apple ID.
  6. In Xcode open ios/Runner.xcworkspace → Runner → Signing & Capabilities → + Capability → In-App Purchase. (It adds no file to the project; the capability lives on the App ID.)

3. Play Console (Android)

  1. Create app, then complete the payments profile (Settings → Payments profile); without it, products cannot be created.
  2. Upload one signed build (flutter build appbundle) to Testing → Internal testing. Google only serves products to an app it has seen; with no build uploaded, every product answers not found.
  3. Monetize → Products → Subscriptions → one subscription per recurring plan with the ids from step 1, each with a base plan and a price. A one-off plan goes under In-app products. Activate each one.
  4. Settings → License testing → add the Google accounts that will test; they are charged nothing and can cancel at once.
  5. Join the internal test from that account (the opt-in link on the Internal testing page) and install from the Play Store once. A build side-loaded with flutter run works afterwards, a build that was never installed from Play may not see products.

4. Turn it on and try it

flutter run --release --dart-define=IAP=on
# a real phone, signed in with the sandbox (iOS) or license-test (Android) account

The paywall now shows the store's prices. Buy a plan: the sheet is the store's own, marked as a test. Then delete and reinstall the app and tap Restore purchases: Pro comes back. Leave out --dart-define=IAP=on and the app goes back to the mock, which is why simulator runs and the Live Preview never touch a store.

When products do not load

What you seeWhyFix
Mock prices on a real phoneBuilt without --dart-define=IAP=on, or iapProductIds is emptyStep 1 and step 4
iOS: the paywall lists no plansPaid Apps agreement not active, or a product still Missing MetadataApp Store Connect step 1 and 4
iOS: Cannot connect to iTunes StoreSigned in with a real Apple ID on a debug buildSign out under Settings → App Store → Sandbox Account and use the tester
Android: item not found / BILLING_UNAVAILABLENo build on a testing track, the product is inactive, or the Play Store app is not signed inPlay Console step 2 and 3
Android: This version of the application is not configured for billingThe running build's version code is higher than any uploaded oneUpload the build you are running to internal testing
Server check

The app trusts the store's answer on the phone. For anything you would not want a modified phone to unlock, verify each purchase on a server: App Store Server API and Google Play Developer API both take the purchase token the verify hook receives. The stores keep their standard commission on every sale.

13Setting up Google and Apple sign-in

The buttons and the sign-in flow are finished: the app sends the id token to the included back end (POST /api/auth/social), which checks it with Google or Apple and answers with the same session a password sign-in gets. What is left is registering the app with Google and Apple. A button appears only for a provider you configure, so you can ship with one and add the other later, with one rule on iOS: App Store guideline 4.8 says an app that offers Google sign-in must also offer Sign in with Apple, so on iOS the Google button stays hidden until Apple is set up too (a debug build says so in the console). Android shows whatever you configure. In demo mode both buttons show and sign in as a demo user without asking anything.

Field in lib/app/core/values/feature_config.dartWhat goes in it
googleServerClientIdThe Web OAuth client id. It is what makes the id token checkable by a server. Needed on Android and iOS.
googleIosClientIdThe iOS OAuth client id.
appleSignIntrue once the capability is on the App ID (step "Apple on iOS"). A button without it fails every time.
appleServiceId · appleRedirectUriOnly for Apple on Android: the Services ID and its Return URL.

Your identifiers: iOS bundle id com.permora.permoraAiApp · Android package com.permora.permora_ai_app.

What it costs

Google and Apple run these sign-in services under their own terms and billing policies, and neither account is included in the purchase price. Sign in with Apple needs a paid membership of the Apple Developer Program, the same membership that publishing on the App Store needs. Google Sign-In runs on a Google Cloud project and follows that project's billing policies. Check the current terms on each provider's site before you switch a button on.

Google on Android

  1. In Google Cloud console → APIs & Services → Credentials (the project you use for the app), configure the OAuth consent screen first: app name, support e-mail, and your domain if you have one.
  2. Create credentials → OAuth client ID → Web application. Copy its client id into googleServerClientId.
  3. Create credentials → OAuth client ID → Android, package name com.permora.permora_ai_app, and the SHA-1 of the key that signs the build. Add one per key: the debug key for development, your upload key, and the App signing key Play shows under Setup → App integrity for store installs:
    # debug key
    keytool -list -v -keystore ~/.android/debug.keystore \
      -alias androiddebugkey -storepass android -keypass android
    
    # release (upload) key
    keytool -list -v -keystore <your upload keystore>.jks -alias <its alias>
  4. On the server, put the same Web client id in GOOGLE_CLIENT_IDS in backend/.env (comma-separated if you have several). The server only accepts id tokens made for the ids listed there.

Google on iOS

  1. Create credentials → OAuth client ID → iOS, bundle id com.permora.permoraAiApp. Copy its client id into googleIosClientId.
  2. Add the reversed iOS client id as a URL scheme, so Google can hand the result back to the app. It goes in ios/Runner/Info.plist, inside the top-level <dict>:
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLSchemes</key>
        <array>
          <!-- the iOS client id, reversed: com.googleusercontent.apps.1234-abcd -->
          <string>com.googleusercontent.apps.REPLACE_WITH_YOURS</string>
        </array>
      </dict>
    </array>

Apple on iOS

  1. In the Apple Developer portal → Certificates, Identifiers & Profiles → Identifiers, open the App ID com.permora.permoraAiApp and tick Sign in with Apple.
  2. The entitlement is already in ios/Runner/Runner.entitlements; Xcode shows it under Signing & Capabilities. Regenerate the provisioning profile if Xcode asks.
  3. Set appleSignIn = true.
  4. On the server, list who Apple tokens may be for in APPLE_CLIENT_IDS: the iOS bundle id com.permora.permoraAiApp, and the Services ID if you also sign in on Android.

App Review (guideline 4.8) asks an iOS app that offers Google sign-in to offer a privacy-focused option as well; Sign in with Apple is the one it names, so ship the two together on iOS.

Apple on Android

Optional: most apps offer Apple on iOS only. On Android it runs in the browser and comes back to the app through the activity already declared in AndroidManifest.xml (SignInWithAppleCallback).

  1. Identifiers → + → Services IDs: create one (for example com.permora.permoraAiApp.signin), enable Sign in with Apple, and add your domain and the Return URL below.
  2. Keys → +: a key with Sign in with Apple enabled, for the App ID; download the .p8 file (once only).
  3. The trip back into the app goes through the included back end, so the Services ID's Return URL is https://<your server>/api/auth/apple/callback. Set APPLE_ANDROID_PACKAGE=com.permora.permora_ai_app in backend/.env so it knows which app to hand the result to, and add the Services ID to APPLE_CLIENT_IDS.
  4. Put the Services ID in appleServiceId and the Return URL in appleRedirectUri.

Try it

Build with the ids filled in and demo mode off, on a real phone for Apple (the simulator cannot sign in with Apple reliably). Sign in with each provider once, sign out, and sign in again: the second time Apple sends no name or e-mail. That is Apple's normal behavior, and the account is found by its id.

Staying signed in

Someone who signs in stays signed in: closing the app, or the phone killing it, does not sign them out. The next time it opens it goes straight to the main screen, without the slides or the sign-in form. Only Sign out or Delete account ends the session.

A Google / Apple sign-in on the included back end also keeps its session token in the same store, so requests after a restart carry it as before.

The session is one entry in the phone's encrypted store (Keychain on iOS, Keystore on Android), kept by lib/app/core/session/session_memory.dart. It is written when a sign-in finishes, and a sign-up still waiting on the code screen does not count. The splash reads it once. Two cases never remember a session: the web build running on the sample data, which is the Live Preview, so every visitor sees sign-in; and a session made on the sample data, which a build talking to a server will not accept.

Deleting an account

Apple (App Store guideline 5.1.1(v)) and Google Play both require that an app which lets people make an account also lets them delete it from inside the app. This one does.

Settings → Delete account makes two calls on the included back end: DELETE /api/auth/me for a Google or Apple sign-in (the account and its tokens), then DELETE /api/ai/device for this phone's device record, its request log and every photo stored under it. The device key is forgotten as well, so a later read registers as a new device. Posts, permits and parking stops on the phone stay until Delete all my data.

Google Play also asks, in the Data safety form, for a web page where people can ask for deletion without the app. A page with your support e-mail address is enough.

Terms of Service and Privacy Policy

Both stores ask for a privacy policy (App Store Connect and the Play Console each have a field for its address), and people should see what they agree to before they make an account. The sign-up screen says By creating an account you agree to the Terms of Service and the Privacy Policy with both names tappable, and Settings has a row for each.

  1. Rewrite assets/legal/terms.md and assets/legal/privacy.md as your own: they are templates, with every part to fill in shown in [square brackets], and a list of what this app keeps and sends that you should check against how you run it.
  2. Publish them as web pages and put the two addresses in termsUrl and privacyUrl in lib/app/core/values/feature_config.dart. From then on both entries open the page in the browser, the same page the store listing links to. Left empty, the bundled text shows inside the app.

When sign-in fails

What you seeWhyFix
No Google buttongoogleServerClientId is empty (and demo mode is off)Google on Android, step 2
iOS only: no Google button, though Android has oneSign in with Apple is not set up; App Store guideline 4.8 needs bothApple on iOS, then appleSignIn = true
Android: DEVELOPER_ERROR / error 10The SHA-1 of the key that signed this build is not on an Android OAuth clientAdd that SHA-1. Play-installed builds use the App signing key
iOS: the app crashes when Google opensThe reversed client id URL scheme is missingGoogle on iOS, step 2
Apple: invalid_clientThe Services ID, domain or Return URL does not match what the portal hasApple on Android, step 1
The server answers 503 sign-in is not configuredGOOGLE_CLIENT_IDS / APPLE_CLIENT_IDS are emptyFill them in backend/.env

14Light for daylight, dark for night parking

Light is the default, because a driver reads this app outdoors in daylight, standing next to the post. Dark is a full second theme for night parking: a near black ground with the bright magenta grade on top.

The Check tab in the light theme and the dark theme, side by side
The Check tab in both themes. The verdict plate, the curb card and the post cards stay the same; the ground, the ink and which magenta grade fills the buttons change.

Settings → Appearance switches between light, dark and the phone's setting. To open in dark by default, change the one line in lib/app/core/theme/theme_controller.dart: final choice = ThemeChoice.light.obs; → ThemeChoice.dark.

15Check, Parked, Permits, Posts: editing the tab bar

Four tabs on a bar the app draws itself (_BottomBar in lib/app/modules/main/main_view.dart), set as the scaffold's bottomNavigationBar.

The bottom tab bar
The bar with Posts active. The four icons are painted (lib/app/core/widgets/tab_glyphs.dart): a post with two plates, a curb step, a permit disc and a stack of plates, so they recolor with the theme.

Adding a tab

  1. Build the screen in a folder of its own under lib/app/modules/, like the other tabs.
  2. lib/app/modules/main/main_controller.dart: add a value to MainTab at the next index.
  3. lib/app/modules/main/main_view.dart: add the view to the IndexedStack children at the same index, add its id to _tabIds, and add a navItem to the bar. Give it a glyph in TabGlyph or use a Material icon.
  4. If the screen has a controller, lazyPut it in lib/app/modules/main/main_binding.dart.
  5. Add its label to every file in lib/l10n/ ('tab.<name>').

Removing a tab

The same places in reverse; renumber the MainTab values after it. The index in MainTab, the position in the IndexedStack and the position on the bar have to agree, or a tap opens the neighbor. test/app_smoke_test.dart taps tabs by key (tab-Check, tab-Parked…), so change it in the same edit.

Five tabs fit on a phone. Past that, put one behind the avatar on Check, where Settings already is.

16Countries, clocks and reminder lead times

Three settings change what a verdict looks like without changing what it says.

Country

The country is sent with every post read, so the reader knows how plates are worded there ("NO STOPPING" in one place, "NO WAITING" in another), and it picks the clock the app prints. The list starts at lib/app/data/models/country.dart:4: United States, Canada, United Kingdom, Ireland, Australia and Elsewhere. Settings holds the country new posts start with, and its clock habit decides how every time in the app is printed until you choose a clock yourself. To add a country, add a value to Country with its wire code, add the same code to the input_line of sign_read in the job file and in backend/config/ai_tasks.php (the sync test checks they match), and give it a country.<name> label in each language file.

Clock

Settings → Clock: the country's own habit, 12-hour or 24-hour. Only the printing changes; every time is kept in minutes after midnight.

Reminder lead time

How long before a move-by time the phone reminds you: the choices are at lib/app/data/services/settings_service.dart:89. The parked car's reminder moves when you change it. If you park with less time left than the lead, the reminder comes halfway through what is left instead of never.

Settings, scrolled to the language, lock, privacy and data sections
Settings, further down: language, lock, notifications, privacy, and under Your data the country new posts start with. The clock and the reminder lead follow below it.

17The ten plate kinds, and adding another

The reader sorts every plate into one of ten kinds, listed at lib/app/data/models/plate.dart:151:

KindOn the streetWhat the engine does with it
no_parking, no_standing, no_stoppingNO PARKING 7AM-9AM, NO STANDING ANYTIMEForbids while it applies, unless it excepts a zone you hold.
street_cleaning, tow_awaySTREET CLEANING THU 7-9, TOW-AWAY 6PM-7AMThe same; the plate that forbids is the one filled magenta on the pole.
loading_zoneLOADING ONLY MON-FRI 7AM-10AMForbids leaving a car; the verdict says loading.
permit_onlyPERMIT HOLDERS ONLY ZONE CForbids unless you hold that zone.
time_limit2 HOUR PARKING 8AM-6PMAllows, for at most that long, while it applies.
paidPAY AT METER 9AM-7PMAllows if you pay, with its limit if it has one.
otheranything else on the poleShown on the post, ignored by the verdict.

A plate can carry a zone: on a permit-only plate it is the zone you need, on any other it is the zone the plate excuses ("EXCEPT ZONE B PERMITS"). The arrow is shown and never evaluated, because which side of the post a plate covers is something the driver can see and the phone cannot.

Adding a kind

  1. Add the value to PlateKind with its wire name and whether it prohibits.
  2. Decide what it does in RuleEngine.at (lib/app/data/engines/rule_engine.dart:53).
  3. Add the wire name to the kind enum in the schema of lib/app/data/providers/sign_read_job.dart, to the rules sentence that lists the kinds, and to the same text in backend/config/ai_tasks.php.
  4. Give it a plate.kind.<wire> label in every language file, and a face in PlateWords.
  5. Add a case to test/engines_test.dart.
Before you release

Have someone who parks in your market every day read the sample posts and a few of their own. Plates are worded differently from city to city, and the kinds above are a common core, not every rule a city can print.

18How the Permora code is layered

106 Dart files 3 engines 5 AI routes 10 painters 3 languages

GetX, in four layers, each talking only to the one below:

View  (lib/app/modules/…)               what the driver sees
  └ Controller                            screen state, taps
      └ ParkingService / AiService        every verdict / every AI request
          ├ engines (data/engines/)       pure Dart: rules, week, reminders
          ├ jobs    (data/providers/)     post read, permit read, why
          └ LocalStore ×3, settings       encrypted storage on the phone
  • No screen imports the sample data. Everything goes through ParkingService, which reads three LocalStores (posts, permits, parking stops), wired in lib/main.dart. While Demo mode is on they hold the sample week in memory and write nothing to disk; turning Demo mode off is when the app starts keeping the driver's own. Delete all my data deletes every record and every photo the app wrote on the phone, and the copies kept on the included server are deleted on the next sync.
  • The engines are pure Dart (lib/app/data/engines/): no Flutter import, no clock, no network. The moment is always a parameter, which is why the verdict for Tuesday at 17:12 is tested to the minute and why you can lift the engines into another app.
  • One service talks to the AI: AiService picks the adapter for the route chosen in Settings (Demo, Gemini, OpenAI, Claude or your server) from the qh_ai pack, runs a job through it and hands the reply to that job's parser. Screens never see a provider.
  • Storage is the platform's encrypted store: the Keychain on iOS, EncryptedSharedPreferences on Android. A photo is a file in the app's own documents folder, and a record keeps only its file name, never the device path, so an update that moves the folder still finds it. API keys never leave SettingsService as a list.
  • The signature pieces are painted: the plate faces and pole, the week ribbons, the curb step, the permit discs, the brand mark and the tab icons are 10 custom painters, not image assets.

19Reading a post: the model transcribes, the phone decides

Three jobs go to a model, each fenced in three places: the instruction says what is allowed, the reply schema has nowhere to put anything else, and a parser in the app keeps only the fields it knows and checks every value.

JobSeesReturns
SignReadJobOne or two photos of one post (at most 2, top part first) and the country Up to 6 plates, top first, each with its kind, days, hours, time limit, zone, arrow, printed words and a confidence; and at most one short note.
PermitReadJobOne photo of a permit or hang tagIts zone, its kind and the last day it is valid. No name, number, vehicle or address: there are no fields for them.
ExplainVerdictJobThe verdict's facts as text, never a photoThree short sentences about why.

Transcribe, never decide

The rules for reading a post start at lib/app/data/providers/sign_read_job.dart:42. The model is asked to write down each plate as printed: never to infer a rule that is not on the plate, never to say whether parking is allowed, and never to write a license plate, a street name or an address. The schema at lib/app/data/providers/sign_read_job.dart:113 has fields for a plate's kind, days, hours, limit, zone and words, and no field for a verdict, so a model that wanted to say "you can park" has nowhere to put it.

The parser keeps only what it can check

static SignReading parse(Map<String, dynamic> json)   // lib/app/data/providers/sign_read_job.dart:155
  • A kind that is not one of the ten is dropped; past 6 plates the rest are ignored.
  • Hours must be HH:MM on a real clock; a pair that starts and ends at the same minute is read as all day. 24:00 is midnight.
  • Days are read from their first three letters; all seven is the same as none, which means every day.
  • A time limit over 24 hours is dropped; a zone must be one to six letters or digits, with any "ZONE" in front removed.
  • A plate read with low confidence comes back unconfirmed. It hangs on the post with a dashed edge and stays out of every verdict until the driver taps Looks right or edits it.
  • A reply with the wrong types becomes the named bad response error, never a silent stop.
The read-a-post screen in Demo mode with the sample posts
Reading a post in Demo mode: the sample posts, the country, the What we send panel folded, Read the plates and the way to type the plates in instead.

What we send

The What we send panel opens to the exact instruction the model gets. On the included server it also shows the schema instruction that route adds, because the server has nowhere to hang a structured-output schema. What goes with a read is the instruction, the country line and the photos; nothing about the driver, the car or where the phone is. No location is read at all. On the server route the photo files are also stored there afterwards (see the chapter on AI routes).

The permit reader

On the Permits tab, Add a permit has Read from a photo: the zone, the kind and the last valid day fill the fields for the driver to check. A permit is often printed with a name and a plate number; the schema cannot carry them, and the parser would not keep them if it did.

The third job only sees facts

ExplainVerdictJob gets the minute asked about, the verdict, its until or opens time, the limit, one line per plate and the zones held, each in a fixed English vocabulary, with the driver's language as a code on the last line. Its parser drops any sentence that carries a figure not in those facts, so the three sentences cannot state a time the screen does not show.

20Rules, week and reminders: the three engines

EngineAnswersTests
RuleEngineFor one minute: may I leave the car here, under which plates, with what limit. For a verdict: until when, or from when. test/engines_test.dart, test/parking_service_test.dart
ScheduleEngineA week cut into stretches of one kind each, for the week ribbons.
ReminderEngineWhen the phone should remind you to move the car.

One minute at a time

RuleEngine.at (lib/app/data/engines/rule_engine.dart:36) takes the confirmed plates that apply at that minute and lets the strictest win:

  1. A prohibiting plate forbids, unless it excuses a zone you hold a valid permit for.
  2. A permit-only plate forbids unless you hold that zone.
  3. A pay plate means pay; a time limit limits. When two limits apply, the shorter one counts.
  4. When a plate that allows and a plate that forbids both apply, the forbidding one wins and the verdict says two plates disagree.

A window that ends earlier than it starts runs past midnight: 6PM to 7AM belongs to the evening it starts on, so Monday's tow-away still applies at three on Tuesday morning.

The verdict walks forward

verdict (lib/app/data/engines/rule_engine.dart:145) judges the minute asked about and then walks forward a minute at a time, at most 7 days, to the first minute that changes the answer. Allowed now: until is when a forbidding plate starts or a time limit runs out, whichever is first, and the card says which. A limit is counted from the minute it comes into force: park at 07:00 under 2 HOUR 8AM-6PM and the car has to go by 10:00; a limit that stops applying before it runs out is forgotten, and the next one starts afresh. Forbidden now: opens is the first minute you may park. When nothing ends within the week, the card says the post does not limit your stay this week. Plates still waiting for a look are counted on the card and left out of the answer until confirmed.

Worked example: the office post, Tuesday 17:12

The post holds 2 HOUR PARKING 8AM-6PM MON-FRI above TOW-AWAY NO PARKING 6PM - 7AM EVERY DAY. At 17:12 only the time limit applies, so the verdict is limited with 120 minutes, which would run to 19:12. Walking forward, the tow-away plate starts at 18:00, before the limit ends, so the card reads Park until 6:00 PM, "2 hour limit, cut short by the next plate", 48 minutes left. Hold a zone B permit and nothing changes, because neither plate excuses B. test/engines_test.dart pins this case to the minute.

The week and the reminder

ScheduleEngine runs RuleEngine.at for every minute of each day and joins equal neighbors into stretches, so the ribbons and the verdict card cannot disagree about any minute. ReminderEngine sets one reminder per parked car, the chosen lead before its move-by time, or halfway through the time that is left when you park late; a stop with no move-by time, or one you have already left, gets none.

21Plates on a pole, and the Looks right step

A post is drawn as a post: a pole with its plates hung on it, top plate first, each plate lettered like the real one.

Plates hanging on the pole one by one, then the verdict appearing
A sample read in Demo mode: the plates hang on the pole, the plate that needs a look hangs dashed and is left out, and once Looks right is tapped it counts and the verdict changes from "until tomorrow" to a one-hour limit.
  • Magenta means "this one rules now". The plates that decide the moment being asked about are filled with the brand color, the way a highlighter marks the line that matters; the others stay plain.
  • Dashed means "check me". A plate the reader was not sure of hangs with a dashed edge and a Looks right button. Tap it, or tap the plate to correct what it says; saving an edited plate confirms it.
  • Every plate opens its editor. Kind, days, hours, limit and zone, in the plate sheet (lib/app/modules/post/plate_sheet.dart). Add a plate under the pole adds one the reader missed.
  • The post's photos sit under the stack with a reminder to compare the plates against the sign.
A saved post with its verdict and its two plates
The office post at 17:12: the verdict on top, the time-limit plate in magenta because it rules now, the tow-away plate below it in white.

The widget is PostStack in lib/app/core/widgets/post_stack.dart; each plate carries the key plate-<index> and each Looks right button confirm-<kind>, which is how the tests find them.

22Seven ribbons for one post's week

Under every post is its week: seven ribbons side by side, Monday to Sunday, each running from midnight at the top to midnight at the bottom and colored by what the post allows in each stretch. One magenta line crosses all seven at the minute being asked about.

The line being dragged down the week ribbons and the verdict changing with it
Moving the line down Tuesday into the tow-away evening, then across to Saturday morning. The label on the line shows the minute asked about, and the button underneath says at once whether you may park then.
  • Drag up or down to move the line through the day; it snaps to the quarter hour. Tap a ribbon, or drag sideways, to move it to that day.
  • The verdict and the magenta plates follow the line, so "can I leave it here on Saturday at nine?" is one drag. Park here is for now: away from now, the button says whether you could park then and offers to go back.
  • The legend under the ribbons names all seven colors: free, with your permit, time limit, pay, permit only, loading and no parking.
  • The ribbons come from ScheduleEngine, built on the same minute-by-minute rule as the verdict, so they cannot disagree.
The week ribbons of the office post, with the line on Tuesday at 17:12
The office post's week: weekday stripes for the tow-away nights, the time limit in the day, and the weekend free until the evening.

The widget is WeekRibbons in lib/app/core/widgets/week_ribbons.dart. In Arabic the days run right to left, and every weekday label shrinks to fit rather than wrapping.

23The curb card and the move-by reminder

Park here on a post saves where the car is and when it has to move, and the Parked tab shows it as a curb card: the photo of the spot, and along the foot of the card a raised curb step with the move-by time painted on its face.

The Parked tab with the current spot on a curb card
The car parked at the office: the spot's photo, the note, the move-by time on the curb with "in 48 min", the reminder switch, and the earlier stops below.
  • The move-by time comes from the verdict at the minute you parked. A post with nothing ending this week saves a stop with no move-by time, and no reminder.
  • The time left is in words ("in 48 min"); there is no ring or bar filling up.
  • One local reminder per car, the lead from Settings before the move-by time. It is a notification scheduled on the phone, so it needs no server and no Firebase. Demo mode keeps a sample clock and sets no reminder, and says so.
  • I've left ends the stop. The earlier stops below say how long each lasted and whether the car left in time.

The widget is CurbCard in lib/app/core/widgets/curb_card.dart; the reminder is set by ReminderService through the LocalReminderGateway.

24Permit discs and what a permit excuses

Permits are drawn as round windshield discs: the zone letter large in the middle, a ring of perforation just inside the rim, the last valid day along the bottom. The rim is magenta while the permit is valid, amber in its last week and gray once it has lapsed.

The Permits tab with a visitor disc and a resident disc
Two permits: a visitor pass for zone D running out on Friday, so its rim is amber, and the home permit for zone B, valid to the end of the year.

Every verdict counts the permits you hold. A plate that says EXCEPT ZONE B PERMITS stops applying when a valid zone B permit is in the wallet; a PERMIT HOLDERS ONLY ZONE C plate allows you to park only with zone C. Zones are compared without "ZONE" and spaces, so a permit typed "zone b" covers a plate read "B". A permit counts through the end of its last valid day; a lapsed one counts for nothing.

The widget is DiscPermit in lib/app/core/widgets/disc_permit.dart.

25Choosing who reads the photos: key, server or demo

Settings → AI opens the AI and key proxy screen. It chooses who reads the photos:

RouteKeyGood for
Demo modenoneTrying the app and reviewing it. Answers on the device from the sample post, through the real parser. Does not look at a photo.
The included serveron your serverShipping to people who should never see a key. The app posts to your back end, which holds the keys and runs only the app's three jobs, within a daily limit per device and server-wide daily and monthly caps.
Google Geminithe person's ownThe easiest start: a key from AI Studio needs no card.
OpenAIthe person's ownSteady at keeping to the reply shape. Needs a payment method.
Anthropic Claudethe person's ownCareful with a sign half in shadow: marks an unreadable plate as unsure. Needs a payment method.
The AI and key proxy screen with Demo mode selected
The route cards: Demo mode selected, then the included server, then Gemini and OpenAI marked No key. Each card says what the route is good at and where its current allowances are published.

All three vendors are called over plain REST with the http package; there is no provider SDK. A route that is picked but not set up (no key, no server address) falls back to Demo mode, and the screens say so rather than failing. Choosing a live route turns Demo mode off, which is the moment the app starts keeping the driver's own posts, permits and stops.

Keys

A pasted key goes into the platform's encrypted store and is read back for one request at a time, only by AiService. The screen shows whether a key is saved, never the key. Every vendor's key page and rate-limits page are linked from its card; no free allowance is quoted as a number, because vendors change them.

Model names expire

Vendors retire model names every so often, and a retired name answers with an error the app turns into "The model ... has been retired". Two places hold model names, and they are separate:

RouteDefault as shippedChange it in the appChange the default
Geminigemini-3.1-flash-liteThe Model name field on that route's card; it is kept per route and a blank field goes back to the defaultpackages/qh_ai/lib/src/gemini_provider.dart:32
OpenAIgpt-5packages/qh_ai/lib/src/openai_provider.dart:26
Claudeclaude-opus-5packages/qh_ai/lib/src/claude_provider.dart:39
Your servergpt-4o-mini, claude-haiku-4-5-20251001, gemini-2.5-flashnot from the app: the app sends no model name on this routeThe admin panel's AI proxy page, or the defaults at app/Models/AiSetting.php:33

Each card links to the vendor's current model list. A model you choose must accept images: reading a post is a vision job.

The included server

Enter the server's address on the The included server card (origin only, such as https://<your-domain>) and Test the connection. The app trades a random 32-character device key, made once per install and not an OS device id, for a bearer token at POST /api/ai/device, then reads posts through POST /api/ai/chat. The card shows the server's own answer from GET /api/ai/status: which vendors it has keys for and how many of today's requests this device has used.

On this route the app sends no prompt. It names the job (sign_read, permit_read or explain_verdict) and sends that job's input: the photos of the post with the country line, the permit photo, or the verdict's facts for Why this answer?. The server holds each job's instruction in config/ai_tasks.php and chooses the provider and model itself, so a token copied off a phone can only run these three jobs. The wording there is the same text the direct routes send; test/proxy_tasks_sync_test.dart fails if the two copies drift, so edit both together.

The text a job carries is data, and the server checks it as data: the country line and every line of the facts must match the job's input_line pattern, up to max_lines lines, or the request is refused before any provider is called. That is what stops a copied token from hiding a question of its own among the facts. The facts for Why this answer? therefore travel in a fixed English vocabulary (Verdict: limited, Until: Tue 18:00), with the driver's language as a code on the last line; the sentences come back in that language. The pattern lives in the job file (inputLine) and in ai_tasks.php, and the sync test checks they are the same string. A provider's own error text (which can quote part of a key) stays in the usage log; the app is told only that the provider could not answer.

The server's chat route is provider-neutral, so there is nowhere on it to hang a structured-output schema. The server's instruction carries the schema instead, and the app reads the reply defensively (a code fence is unwrapped, prose before or after the object is trimmed), then runs the same parser. That is weaker than the direct routes' schema enforcement, which is why it is stated here. If the server revokes the token (a blocked device, a rebuilt database), the app registers once more and retries once; it never loops.

Spending caps on your server

Every request on this route is paid from your provider account, so the AI proxy page has four limits. The first is per device; the other three count the whole server, so they hold however many devices register:

SettingDefaultWhat it stops
Requests per device per day200one phone using more than its share
Requests per day, all devices2,000a busy or abused day running away
Tokens per month, all devices5,000,000the month's bill passing what you budgeted
New devices per network per day20a script registering device after device for fresh allowances

Accept new devices switches registration off altogether; phones already registered keep working. 0 turns a numeric cap off. A request counts the moment it is accepted, not when the provider answers: it holds its job's token ceiling against the month until the real figures arrive, so requests sent all at once cannot slip past a cap together. An IPv6 address is counted by its /64, the block one machine is usually given. Behind a reverse proxy or Cloudflare, set TRUSTED_PROXIES so the per-network count sees each phone's own address rather than the proxy's. Work the token budget out from your provider's current price per million tokens.

Recommended spending limits at each provider

Set a hard limit where the bill is issued as well, so a mistake in one place is caught by the other, and use a key made for this server only.

  • OpenAI: create a project for this server, use a key from that project, and set the project's monthly budget and usage limits.
  • Anthropic: use a key from a workspace of its own and set that workspace's spend limit in the Console.
  • Google Gemini: use a Google Cloud project of its own, set a budget with alerts in Cloud Billing, and lower the Generative Language API's requests per day quota for that project.

A sensible start is the monthly amount you would accept losing, for example US$20 to US$50 while you launch; raise it once the panel's Usage page shows what real users cost.

Locking the proxy to your app (App Check)

Optional, and off until you turn it on. Firebase App Check proves a request comes from your published app: Play Integrity on Android, App Attest or DeviceCheck on iOS, behind one token. With it enforced, a script that copied a device key off a phone still cannot call the proxy.

  1. Configure Firebase for the app (chapter Connections that are yours to make) and register the app in the Firebase console's App Check page with Play Integrity and App Attest.
  2. Add the firebase_app_check package, and in main.dart, after Firebase starts, call FirebaseAppCheck.instance.activate(...) with those two providers.
  3. Hand the app the token: SettingsService.appCheckTokenSource = () => FirebaseAppCheck.instance.getToken();. The proxy route then sends it as X-Firebase-AppCheck when it registers and on every AI request, the two routes the server checks.
  4. On the server, set FIREBASE_CREDENTIALS and then AI_APP_CHECK=enforce in .env. Do this last: once it is on, a phone that sends no token is refused.

Photos kept on the server

Only if the person switches it on. Settings → AI has a switch, Keep photo copies on the server, off on a fresh install, with a line under it saying what it does. With it on and this route picked, the server also keeps a copy of every post, permit and parking photo the phone holds, so whoever runs the server has the pictures the AI read, not only the figures. With it off, a post or permit photo still goes through the server to be read, and no copy is kept. PhotoSync (lib/app/data/services/photo_sync.dart) does the copying:

  • Only with the switch on. Turning it on sends the photos already on the phone; turning it off stops the sending (copies already on the server stay until their photo is deleted).
  • When: about 10 seconds after a post, a permit or a parking stop changes, and each time the app comes back to the foreground.
  • Once per photo: it asks GET /api/media what the server holds (each file's name and SHA-256) and sends only what is new or changed, one PUT /api/media/<name> per file.
  • Only with a device token. The first post read registers the install; until then there is nothing to send with. With the person's own key, in Demo mode or with no server address, nothing is sent.
  • In the background. A photo that does not go now goes on the next change or the next return to the foreground, and a failure is at most counted in crash reports, when that pack is on.

The pictures appear on the panel's Pictures page under Device #n · platform (or the label you gave the device). Nothing is pulled back to a phone: a new phone registers as a new device and starts empty. A photo deleted on the phone (with its post, its permit or Delete all my data) is queued, and the next sync deletes the server's copy too. Deleting a picture on the panel while the phone still has it only lasts until the next sync, which sends it again.

Error handling

Every failure is a ProviderException carrying a translation key, so what the person reads is a sentence in their language with a next step, and the raw response is behind Details for the developer.

What happenedKeyWhat the person reads, in short
No key saved for a key routeerr.missing_keyAdd a key in Settings, or switch on Demo mode.
Vendor 401 / 403err.invalid_key, err.forbiddenThe key was rejected, or accepted but refused (usually region or project).
Vendor 404 on the modelerr.model_not_foundThe model name is no longer available; enter a current one.
Vendor 429err.quotaThe quota is used up for now.
Reply cut offerr.truncatedRun it again; it usually fits.
Vendor 5xx (overloaded or down)err.busyThe provider is busy; wait a moment and read the post again.
Vendor refused the photoerr.declinedThe provider would not read it; type the plates in by hand.
No plates in the replyerr.empty_resultTake the photo again closer to the post, or try another provider.
No server addresserr.server_unsetEnter the address of your back end, or use your own key.
Server 401 after one re-registrationerr.server_rejectedCheck the address points at the right site.
Server 403err.device_blockedThis device was blocked on the server.
Server 413err.too_largeThe photo is larger than the server accepts.
Server 429err.daily_limitThis device, or the server as a whole, used today's or this month's allowance.
Server 503 / 504err.server_offThe proxy is off, or has no key for that vendor.
No responseerr.network, err.server_unreachableCould not reach the service; Demo mode works offline.
Anything unparseableerr.bad_responseThe reply was not in the expected format.

A failed read loses nothing: posts and permits are as they were, and the plates can be typed in by hand.

26Accounts: sign-up, sign-in and password reset

Built against the included back end, the form is real. AccountApi (lib/app/data/services/account_api.dart:33) talks to the account routes, and login() (lib/app/modules/auth/auth_controller.dart:108) calls it whenever API_BASE_URL is set:

  • Sign up sends the name, address and password to POST /api/auth/register. The server emails a six-digit code and creates nothing yet; the code screen sends that code with the same password to POST /api/auth/verify, and the account exists from that moment. A code lasts 15 minutes and five tries; Resend waits 60 seconds between emails (POST /api/auth/resend).
  • Forgot password? opens its own screen: the address goes to POST /api/auth/password/forgot, which answers the same whether or not the address has an account, then the emailed code and a new password go to POST /api/auth/password/reset, which ends every older session and signs in.
  • Google and Apple (the qh_social_login pack) exchange the provider's id token at POST /api/auth/social. Both kinds of sign-in keep the same Sanctum token in the encrypted store, so Sign out (POST /api/auth/logout, which revokes it on the server) and Delete account (DELETE /api/auth/me) treat them alike.
  • Reading posts does not use an account. The key proxy identifies installs by a device key, not by a person, so a read works whether or not anyone signs in.

Where the codes go

Mail leaves the server through your own SMTP provider (the MAIL_* keys; the back end's docs/DEPLOY.md, section Email, has the settings). Until you set one, nothing is sent: a plain install writes each email, code included, to storage/logs/laravel.log, and under Docker the codes land in the bundled Mailpit inbox at http://127.0.0.1:8025. ACCOUNTS_VERIFY_EMAIL=false turns sign-up codes off.

Without a server

A build without API_BASE_URL, like the Live Preview, has no account anywhere: the forms wait a moment and open the app, the code screen takes any six digits, empty fields get in, and a line under each form says so. Those lines, the Demo mode switch and the mock checkout appear only in such a build.

27Connections that are yours to make

The app is complete for what it does. These are the pieces a real product connects that no template can connect for it, each with the exact place it goes.

Real in-app purchases

Product ids in FeatureConfig.iapProductIds and --dart-define=IAP=on (the chapter Setting up in-app purchases). The purchase is cached on the phone, so a buyer opens the app as Pro offline. Receipt validation is yours: StorePurchaseGateway takes a verify callback, and returning false refuses the purchase.

final Future<bool> Function(PurchaseDetails details)? verify;   // packages/qh_iap/lib/src/store_purchase_gateway.dart

Firebase: push and analytics

lib/firebase_config.dart ships with firebaseConfigured = false and lib/firebase_options.dart holds deliberately invalid placeholders; the feature packs chapter has both the flutterfire configure path and the no-terminal one. The admin panel sends to every install through the topic. To notify one install (say, street cleaning starting on a post they saved), store the token qh_push reports against that install's row in devices, through a route of your own, and send to it from the server.

Another AI vendor

Write a class that implements AiAdapter, add a ProviderConfig to ProviderCatalog.all and register the adapter in AiService. No screen changes. Its model must read images.

Future<Map<String, dynamic>> complete(   // packages/qh_ai/lib/src/ai_adapter.dart
  required PromptSpec spec, required String apiKey, String model = '',
});

What the app does not do, by design

It does not read the phone's location, show a map, pay for parking or look up a city's rules online; every rule comes from the plates printed on the post in front of the driver. A city data feed would be a new source of plates feeding ParkingService, the one place every verdict is worked out, and the engines would not change.

Where the numbers live

Every tunable constant, with its file and line:

WhatWhereNow
Posts the free plan keepslib/app/data/services/subscription_service.dart:11950
Largest photo the app sends, base64lib/app/data/services/ai_service.dart:421200 * 1024 bytes
Photo long edge and JPEG qualitylib/app/data/services/photo_store.dart:391600 px, 85
How long a provider may takepackages/qh_ai/lib/src/ai_adapter.dart:16120 s
Plates read from one post, at mostlib/app/data/providers/sign_read_job.dart:326
Photos of one post the app sends, at mostlib/app/data/providers/sign_read_job.dart:302
Sentences in Why this answer?lib/app/data/providers/explain_verdict_job.dart:163
Output tokens for a post read (server, before the ceiling)config/ai_tasks.php:1421500
How far ahead a verdict lookslib/app/data/engines/rule_engine.dart:337 days
Where the week line snapslib/app/core/widgets/week_ribbons.dart:4015 min
Reminder lead times on offerlib/app/data/services/settings_service.dart:895, 10, 15, 30 min
Demo mode's pause before it answerspackages/qh_ai/lib/src/demo_provider.dart:321200 ms
Demo mode's clocklib/app/data/mock/sample_data.dart:13Tue 13 Oct 2026, 17:12
Requests per device per day (server)app/Models/AiSetting.php:36200
Output-token ceiling (server)app/Models/AiSetting.php:372048
Largest image the server acceptsconfig/companion.php:341258291 bytes
Images per request (server)config/companion.php:382

The two image limits have to agree: the app refuses a photo it knows the server will reject, so raise maxImageBytes and AI_MAX_IMAGE_BYTES together or one of them does nothing.

28What the Permora server does

21 endpoints 160 back end tests 576 assertions

backend/ is a Laravel 13 application with Filament 5 and Sanctum, set up as a key proxy. It is included so that the people who install your app never need an API key of their own: the app posts the photo of the post to your server, your server adds the key it holds and forwards the request to OpenAI, Anthropic or Gemini, and the answer comes back.

  • Devices, not accounts. Each install registers a random device key and gets a bearer token. The Devices page lists them; label one, block one (its token is revoked on the spot), see its request count.
  • A daily limit per device (200 requests out of the box, 0 for none), counted per device key and reset at midnight in the server's APP_TIMEZONE, so one install cannot run up your bill.
  • Server-wide caps that hold however many devices register: requests per day and tokens per month across all devices, at most 20 new devices per network per day, and a switch that stops new devices joining (see Spending caps on your server).
  • Fixed jobs. The prompt for each of the app's three jobs is in config/ai_tasks.php; the app names a job and sends its input, never a prompt or a model.
  • A usage log. Every call is a row: provider, model, tokens in and out, latency, and ok, error, quota or blocked. The dashboard charts it.
  • Provider keys held server-side, encrypted with APP_KEY, set on the AI proxy page or in .env (the panel wins). The same page sets the provider and the model every request uses, the caps above and an output-token ceiling.
  • Pictures. Every post, permit and parking photo the app has stored on the server (see Choosing who reads the photos: key, server or demo), with a thumbnail, the device it came from, its size and a Delete action.
  • App updates. Announce a release: the latest version, the oldest one still allowed to run, what the update prompt says, the store links and when it goes live. GET /api/version answers with the newest published row, and with the .env values only while there is none.
  • Send notification and Push history. Push to every install now or at a time you pick; every send is recorded with its status, and a scheduled one can be canceled until it goes.
  • The accounts, version and social routes the feature packs use, including POST /api/auth/apple/callback, the return URL for Sign in with Apple on Android.
The AI proxy page in the admin panel
The AI proxy page: the on/off switch, the provider every request goes to, 200 requests per device per day and a 2048-token ceiling, then the server-wide spending caps, and one key field and one model field per provider.

The app also works without it: with a key of the person's own on any of the three vendor routes, or in Demo mode. The back end is what lets you ship the app to people who will never paste a key.

What is inside

FolderWhat
app/ModelsDevice, AiUsageLog, AiSetting (one row), plus User, AppSetting, MediaFile (a stored picture), AppRelease and PushSend.
app/Services/AiProxyService (settings, quota, size checks, adapter, usage row) and one adapter per vendor, which turns the neutral request into that vendor's own format, images included.
app/Http/Controllers/ApiThe REST controllers: AiProxyController, AuthController, SocialAuthController, AppleCallbackController, VersionController, MediaController.
app/FilamentThe panel: Dashboard, Users, AI proxy, Devices, Usage, Pictures, App updates, Settings, Send notification, Push history.
database/seedersAn admin, a demo account, three demo devices with two weeks of usage, two sign-post photos on the first of them, sample releases and push records, all flagged as demo data.
testsPest: device registration, the proxy for each vendor, limits, image checks, reply language, accounts, social sign-in, the version route, panel pages.
docs/DEPLOY.mdThe deployment material from the next chapter, in a file you can hand to whoever runs the server.
Placeholders

From here on, anything in <angle brackets> is a value you supply and the brackets are not part of it.

29Setting up the admin panel, step by step

The admin panel is part of the Laravel application in backend/. These are the steps for a server where you run the commands yourself; install.sh does steps 2 to 6 in one go, and the Docker route at the end needs none of them.

1. What the server needs

  • PHP 8.4.1 or newer with the pdo_mysql (or pdo_sqlite), mbstring, openssl, fileinfo, zip and intl extensions
  • Composer
  • A database: MySQL 8 / MariaDB 10.6 or newer for a live server, or SQLite for a quick look

2. Create the environment file

cd backend
cp .env.example .env

Set APP_URL to the address the panel will be served from, and APP_TIMEZONE to your own timezone.

3. Configure the database

MySQL or MariaDB. Create an empty database and a user that owns it, then put them in .env:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=permora
DB_USERNAME=permora
DB_PASSWORD=choose-a-strong-password

SQLite. Leave DB_CONNECTION=sqlite as shipped and create the file it points at:

touch database/database.sqlite

4. Install the dependencies and generate the app key

Install with the development packages included: the demo data in step 6 is generated with them. Once the demo data is cleared you can reinstall with --no-dev.

composer install --optimize-autoloader
php artisan key:generate

Generate the key on the first install only. The server encrypts the secrets it stores with it, so a new key on a live server makes them unreadable; install.sh skips this step when .env already has a key.

5. Create the tables

php artisan migrate --force

Run it again after every update you install; it only adds what is new and never drops your data.

6. Load the demo data, once

php artisan demo:seed

This creates the admin account below and the sample records on a fresh install, and does nothing on every later run. When you are ready to go live, Settings → Clear demo data in the panel (or php artisan demo:clear) removes every seeded record and leaves yours; running the installer again afterwards does not bring them back. The admin account is kept so you can still sign in; change its password.

7. Serve it and sign in

Point your web server's document root at backend/public (docs/DEPLOY.md in the back end covers web servers and shared hosting), or try it locally:

php artisan serve

Open /admin and sign in:

EmailPassword
admin@permora.testpassword

Change this password straight away under Users, or create your own admin account and delete this one.

Email: sign-up and password-reset codes

Signing up and Forgot password? in the app both work by a six-digit code this server emails. Until you set up mail nothing leaves the server: with the default MAIL_MAILER=log each email, code included, is written to storage/logs/laravel.log, and under Docker the codes land in the bundled Mailpit inbox at http://127.0.0.1:8025. For real delivery put your SMTP provider's settings in .env and run php artisan config:clear:

MAIL_MAILER=smtp
MAIL_HOST=smtp.your-provider.com
MAIL_PORT=587
MAIL_USERNAME=...
MAIL_PASSWORD=...
MAIL_FROM_ADDRESS="no-reply@your-domain.com"

The SMTP provider is a separate service with its own price; most have a free tier for low volumes. ACCOUNTS_VERIFY_EMAIL=false turns the sign-up code off.

8. Scheduled jobs

Notifications you schedule for later are sent by Laravel's scheduler. Add one cron line on the server:

* * * * * cd /path/to/backend && php artisan schedule:run >> /dev/null 2>&1

Or: Docker

With Docker installed, steps 1 to 8 are one command. It starts MySQL, creates the tables, loads the demo data on the very first start only and runs the scheduler:

cd backend
docker compose up -d --build

The panel is then at http://localhost:8000/admin, with the same login. docker compose down keeps your data; docker compose down -v deletes it and the next start loads the demo data again.

Port 8000 speaks plain HTTP, which is fine on your own computer and nowhere else. Before the server is reachable from outside, put it behind a web server that serves HTTPS with a certificate (Nginx, Caddy or your host's proxy) and set APP_URL to the https:// address.

30Putting the Permora server online

Three routes. Pick the one that matches your host. Whichever you choose, PHP must be 8.4 or newer.

A. Docker, if you have it

# in backend
docker compose up -d --build

This starts MySQL 8 and the app on http://127.0.0.1:8000 (panel at /admin). On every start the container generates the application key only if .env has none yet and runs the migrations (additive: they only create what is missing). The demo data is seeded on the very first start only; a restart never seeds again, so demo data you cleared in the panel (Settings → Clear demo data) stays cleared. A restart, a reboot of the machine or an upgrade of the image keeps every device, usage row, account and saved key. Pictures are files, not rows, and they are kept in a volume too: storage/app/private (the photos the app stores). The sign-up and password-reset emails land in the bundled Mailpit inbox at http://127.0.0.1:8025 until you set up SMTP. Stop it with docker compose down; docker compose down -v also deletes the database and file volumes, and the next start begins from an empty database with the demo data. If docker compose up cannot pull its images, your network is blocking Docker Hub; that is the network, not the project, and routes B and C need no Docker.

B. A terminal on a server you control

# in backend
./install.sh

The script checks your PHP version and Composer, copies .env.example to .env if there is none, installs the dependencies, generates the application key, creates the SQLite file if that is the database, runs the migrations, seeds the demo data and makes the writable folders writable. It stops with a readable message rather than a stack trace if PHP is too old. Then point your web server's document root at <path-to-backend>/public, not at the folder above it, which holds .env. Apache: the bundled public/.htaccess sends every request through index.php; it needs mod_rewrite on and AllowOverride All for that folder. Nginx: add try_files $uri $uri/ /index.php?$query_string; to the site's location / block and pass .php files to PHP-FPM.

C. Shared hosting, with cPanel and no terminal

  1. In cPanel, open MultiPHP Manager and set the domain to PHP 8.4 or newer. If the list stops at 8.3, ask your host to enable 8.4; this back end will not run below it.
  2. Create a MySQL database and a user, and give the user all privileges on it. Note the database name, the user and the password.
  3. Upload the contents of backend/ above your public folder, and the contents of backend/public/ into public_html/.
  4. Open public_html/index.php and fix the require paths so they point at where you put the rest.
  5. Copy .env.example to .env and fill in APP_URL, DB_CONNECTION=mysql, DB_DATABASE, DB_USERNAME, DB_PASSWORD, and at least one of AI_OPENAI_KEY, AI_ANTHROPIC_KEY, AI_GEMINI_KEY (or paste a key into the panel later).
  6. Open cPanel's Terminal once for php artisan key:generate and php artisan migrate --seed, the only commands this route needs. No terminal at all? docs/DEPLOY.md has the phpMyAdmin route.
  7. Make storage/ and bootstrap/cache/ writable (file manager → Permissions), then visit https://<your-domain>/admin.

The server needs outbound HTTPS to api.openai.com, api.anthropic.com and generativelanguage.googleapis.com; a few hosts block outbound requests on their cheapest plans.

The scheduler (one cron line)

Notifications scheduled with Send notification → Send later go out from Laravel's scheduler, which needs one line in the server's crontab (cPanel: Cron Jobs, every minute):

* * * * * cd <path-to-backend> && php artisan schedule:run >> /dev/null 2>&1

With Docker there is nothing to add: the app container runs the scheduler itself. Without the line the panel still works; a notification scheduled for later just stays Scheduled. Times are read in APP_TIMEZONE.

Pictures users take

The photos the app stores through /api/media are files under storage/app/private/media/, outside the web root. Back that folder up together with the database: the database lists the pictures and the folder holds them.

Signing in the first time

AccountEmailPassword
Admin (the panel)admin@permora.test password
Demo account (the account routes)demo@permora.app demo1234
Before anyone else can reach it

Change the admin password, set APP_ENV=production and APP_DEBUG=false, set the per-device and server-wide caps on the AI proxy page to what you are willing to pay for (and a spending limit at the provider), and run php artisan demo:clear (or Settings → Clear demo data) to remove the demo accounts, devices and usage rows. Back up .env and storage/app/private/media/ with the database: the keys saved in the panel are encrypted with its APP_KEY, and the folder holds the pictures.

The admin panel sign-in page
The panel's own sign-in page at /admin. The icon is backend/public/brand/icon.png; the headline, the three lines and the sidebar groups are in backend/config/panel.php.

31Building the app against your server

Two ways to bake the address into a build, and a third for a single phone.

From the command line

flutter run --dart-define=API_BASE_URL=https://<your-domain>
flutter build appbundle --dart-define=API_BASE_URL=https://<your-domain>
flutter build ipa --dart-define=API_BASE_URL=https://<your-domain>

By editing a file

If you build from Android Studio or VS Code, open lib/app/core/values/feature_config.dart and give the constant a default. The line as shipped:

static const apiBaseUrl = String.fromEnvironment('API_BASE_URL');

becomes:

static const apiBaseUrl = String.fromEnvironment('API_BASE_URL',
    defaultValue: 'https://<your-domain>');

That is the whole change. A --dart-define still wins when it is passed.

Or on one phone, in Settings

Settings → AI → The included server → Server address. This routes post reading through your server on that phone and overrides the built-in address. It is the quickest way to test a server, but it only affects the AI route and the photo copies that go with it: the version prompt and the Google / Apple exchange read the build-time address only.

The URL

Give the origin only: https://example.com, not https://example.com/api; the app appends /api/ai/… itself. A trailing slash is removed. On a real phone, 127.0.0.1 is the phone: use your computer's LAN address while testing.

What happens next

A build with a built-in address opens with Demo mode off and the included server chosen as the route, so the first post a driver photographs is read through your server. The first request registers the install (POST /api/ai/device) and it appears on the panel's Devices page; each read is a row on Usage, and the photos start to appear on Pictures shortly after. A person can still switch to their own key or back to Demo mode in Settings.

32Plain HTTP while testing, HTTPS when live

Both platforms refuse plain HTTP by default, and quietly enough that it looks like the server is down.

Android

Cleartext traffic is off by default. For development only, add to android/app/src/main/AndroidManifest.xml:

<application android:usesCleartextTraffic="true" …>

For anything narrower, use a network_security_config.xml that allows the one development host, referenced with android:networkSecurityConfig.

iOS

App Transport Security refuses http:// the same way. For development only, in ios/Runner/Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsLocalNetworking</key><true/>
</dict>

NSAllowsLocalNetworking covers a server on your own network without opening the app to plain HTTP everywhere, which NSAllowsArbitraryLoads would.

What this project ships with

Neither exception is in the source. The main Android manifest declares INTERNET (Flutter only writes it into the debug manifest, so a release build without it would fail every request), USE_BIOMETRIC, POST_NOTIFICATIONS and BILLING, and no cleartext flag; the plist has no ATS block. The simulator reaches http://127.0.0.1 anyway, because iOS exempts it; a physical phone does not.

In production, use HTTPS

A photo of the post and a bearer token travel on every read, and on plain HTTP they travel in the clear to everyone on the same network. A Let's Encrypt certificate is free and most panels issue one in a couple of clicks. Remove any development exception before a release build.

33Every route the Permora server answers

Every endpoint, 21 in all, as php artisan route:list --path=api reports them. "Device" means a token from /api/ai/device; "user" means one from the account routes. The AI routes and the picture routes take a device token only and refuse a user token with a 403; each device sees only its own pictures.

MethodPathAuthBody / returns
POST/api/ai/devicenodevice_key (16 to 64 of A-Z a-z 0-9 _ -), platform, app_version → 201, token + device. Re-posting rotates the token. A new key is refused with 429 past the per-network daily cap, and with 403 while new devices are switched off.
GET/api/ai/statusdeviceenabled, default provider, each provider's availability, the job names it runs, the daily limit and this device's requests today, the token ceiling
DELETE/api/ai/devicedeviceSettings → Delete account: this device, its request log and every picture it stored, 204
POST/api/ai/chatdevicetask (a job in config/ai_tasks.php), input?, images?[{mime, data}], reply_in_user_language? → provider, model, text, usage, finish_reason. The server holds the prompt, provider, model and limits; the app cannot send them.
POST/api/auth/registernoname, email, password → 202 and a six-digit code by email; nothing is created yet (403 if sign-up is switched off in Settings)
POST/api/auth/verifynoemail, code, the sign-up's password → 201, token + user; 422 for a wrong or expired code
POST/api/auth/resendnoemail, purpose (verify or reset) → 202 and retry_after, known address or not
POST/api/auth/loginnoemail, password → token + user
POST/api/auth/password/forgotnoemail → 202; a reset code goes out only if the address has an account
POST/api/auth/password/resetnoemail, code, password → token + user; every older token is revoked
POST/api/auth/socialnoprovider, id_token → token + user (503 until client ids are set)
GET/api/auth/meuserthe signed-in user
POST/api/auth/logoutuserrevokes the token, 204
DELETE/api/auth/meuserSettings → Delete account: the account and its tokens, 204 (403 for the owner account)
POST/api/auth/apple/callbacknoSign in with Apple's return URL on Android: Apple posts here and the server sends the phone back into the app with the same fields (303). 503 until APPLE_ANDROID_PACKAGE is set.
GET/api/versionnolatest, minimum, message, android_url, ios_url: the newest published row of App updates, or the .env values while there is none
GET/api/mediadevicethe caller's pictures (name, SHA-256, size), used_bytes, max_total_bytes, file_max_bytes
PUT/api/media/{name}devicethe picture's raw bytes as the body (JPEG, PNG, WebP, HEIC / HEIF or GIF, checked from the bytes) → 201, or 200 when it replaced a file or the same bytes were already there (a no-op). 413 over MEDIA_FILE_MAX_BYTES or when the caller's total would pass MEDIA_MAX_TOTAL_BYTES; 507 when the server-wide MEDIA_MAX_SERVER_BYTES is reached; 415 when it is not a picture; 422 when empty.
GET/api/media/{name}devicethe picture's bytes, 404 if the caller has none by that name
DELETE/api/media/{name}devicedeletes it, 204
GET/api/media-preview/{media}signed linkthe picture behind a panel thumbnail; the panel makes these links itself, valid for ten minutes

The routes that issue a token, and the Apple return URL, are limited to 10 requests a minute per address; everything else to 120 a minute per token.

Authentication headers

Authorization: Bearer <token>
Accept: application/json
Content-Type: application/json   (on POST)

Leave Accept off and a validation failure comes back as an HTML page, the most common reason a client reports "invalid JSON" against a server that is working. The app also sends Accept-Language, and the server answers its errors in that language where it has a translation.

The three most used, in full

Register a device

curl -X POST https://<your-domain>/api/ai/device \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  -d '{"device_key":"q7Zc2Lw9-Hf3xN0aRk5vT8mBy1sDe6Pu","platform":"ios","app_version":"1.0.0"}'
{
  "token": "4|Xk2m…",
  "device": { "id": 4, "platform": "ios" }
}

Ask what the server can do

curl https://<your-domain>/api/ai/status \
  -H 'Accept: application/json' -H 'Authorization: Bearer <token>'
{
  "enabled": true,
  "default_provider": "openai",
  "providers": {
    "openai":    { "available": true },
    "anthropic": { "available": false },
    "gemini":    { "available": false }
  },
  "tasks": ["sign_read", "permit_read", "explain_verdict"],
  "daily_request_limit": 200,
  "requests_today": 3,
  "max_output_tokens": 2048
}

Read a post

curl -X POST https://<your-domain>/api/ai/chat \
  -H 'Accept: application/json' -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <token>' \
  -d '{
        "task": "sign_read",
    "input": "country: US",
    "images": [{ "mime": "image/jpeg", "data": "<base64>" }]
  }'
{
  "provider": "openai",
  "model": "gpt-4o-mini",
    "text": "{\"plates\":[{\"kind\":\"time_limit\",\"days\":[\"mon\",\"tue\"],\"from\":\"08:00\",\"to\":\"18:00\",\"limit_minutes\":120,\"text\":\"2 HOUR PARKING\",\"confidence\":\"high\"}, … ]}",
  "usage": { "prompt_tokens": 1320, "completion_tokens": 214 },
  "finish_reason": "stop"
}

The model's answer is a string in text; the app parses it. The server checks, in order: the proxy is on (503), the device is not blocked (403), the job exists (422), the device's daily limit, the server's daily limit and the month's token budget (429), a key for the provider (503), the job's text size (413), then the job's number of images (one or two for a post, one for a permit, none for the explanation, never more than 2), each at most 1258291 bytes of valid base64 (413 or 422). Anything else in the body, such as a system or model field, is ignored. A provider it cannot reach is a 504. Every outcome, refused ones included, is written to the usage log.

160 Pest tests cover these routes.

34Each .env key and its default

Every environment variable in .env.example is on this page, so you can check your file against it line by line. Copy .env.example to .env and fill in the ones you need; the rest have working defaults.

The ones you will set

KeyTypeDefaultWhat it does
APP_NAMEtextPermoraThe name in the panel's title bar and in mail.
APP_ENVtextlocalSet it to production on a live server.
APP_KEYtextrequiredEncryption key, also for the provider keys saved in the panel. php artisan key:generate writes it. Change it and those saved keys can no longer be read.
APP_DEBUGbooleantruefalse in production. Left true, an error page shows your configuration to whoever triggered it.
APP_URLurlhttp://localhostUsed to build absolute links and the panel's assets. Set it to your real domain.
APP_TIMEZONEtextUTCThe zone "today" and "tomorrow" and every scheduled time are read in: the per-device daily limit's midnight, a notification sent later. For example Europe/London.
TRUSTED_PROXIESlistemptySet it behind a load balancer or Cloudflare, or every install shares one registration rate limit.
DB_CONNECTIONtextsqlitesqlite, mysql or pgsql.
SESSION_DRIVERtextdatabaseWhere panel sessions live.
CACHE_STOREtextdatabasefile is fine on shared hosting.
QUEUE_CONNECTIONtextdatabaseNothing here queues work; leave it.
LOG_CHANNELtextstackWhere storage/logs gets written.
LOG_LEVELtextdebugerror in production keeps the log small.
AI_OPENAI_KEYtextemptyOpenAI key, used when none is saved on the AI proxy page.
AI_ANTHROPIC_KEYtextemptyThe same for Anthropic.
AI_GEMINI_KEYtextemptyThe same for Gemini.
AI_TIMEOUT_SECONDSnumber90How long the server waits for a provider. Commented out in the file as shipped.
AI_MAX_IMAGESnumber2Images allowed in one request. Commented out in the file as shipped.
AI_MAX_IMAGE_BYTESnumber1258291Largest image, as base64 characters. Raise it with the app's maxImageBytes, never alone. Commented out in the file as shipped.
APP_LATEST_VERSIONtext1.0.0The version /api/version reports as current while no App updates row is published. Once one is, the panel wins.
APP_MINIMUM_VERSIONtext1.0.0Below this, the update prompt has no Later. Fallback, like the line above.
APP_UPDATE_MESSAGEtextemptyThe sentence in the update prompt. Fallback.
APP_STORE_URL_ANDROIDurlemptyWhere the prompt's Update button goes on Android. Fallback.
APP_STORE_URL_IOSurlemptyThe same on iOS. Fallback.
MEDIA_FILE_MAX_BYTESnumber2097152Largest picture /api/media stores (2 MB). A photo at the app's settings is a few hundred KB. Past 8 MB, raise post_max_size and upload_max_filesize in php.ini above it too.
MEDIA_MAX_TOTAL_BYTESnumber209715200Picture space per device or account (200 MB). Past it, a new picture is refused with 413 and the phone tries again later.
MEDIA_MAX_SERVER_BYTESnumber5368709120Picture space for every device and account together (5 GB; 0 = no server-wide cap). Past it, new pictures are refused with 507, so devices that are cheap to create cannot fill the disk.
GOOGLE_CLIENT_IDSlistemptyOAuth client ids accepted by /api/auth/social for Google, comma-separated.
APPLE_CLIENT_IDSlistemptyBundle / Services ids accepted for Apple.
APPLE_ANDROID_PACKAGEtextemptySign in with Apple on Android only: the app's Android package name. /api/auth/apple/callback sends the phone back into that app, and answers 503 while this is empty.
AI_APP_CHECKoff / enforceoffenforce refuses device and chat requests without a valid Firebase App Check token. Needs FIREBASE_CREDENTIALS and App Check on in the app first. Commented out in the file as shipped.
FIREBASE_CREDENTIALSpathstorage/app/firebase-service-account.jsonThe Firebase service-account JSON the Send notification page uses. Keep it outside public/.

Everything else in the file

Laravel's own defaults. Most are read only if you switch a driver above to something other than what this back end ships with.

KeyDefaultWhat it does
APP_LOCALEenLanguage for panel text, dates and validation messages.
APP_FALLBACK_LOCALEenUsed when a string is missing in the locale above.
APP_FAKER_LOCALEen_USOnly used by test factories.
APP_MAINTENANCE_DRIVERfileWhere php artisan down keeps its flag.
APP_MAINTENANCE_STOREdatabaseCache store for the flag, when the driver is a cache. Commented out in the file as shipped.
PHP_CLI_SERVER_WORKERS4Workers for artisan serve only. Commented out in the file as shipped.
BCRYPT_ROUNDS12Password hashing cost. Higher is slower and safer.
LOG_STACKsingleWhich channels the stack channel writes to.
LOG_DEPRECATIONS_CHANNELnullWhere PHP deprecation notices go.
DB_HOST127.0.0.1Only read when DB_CONNECTION is not sqlite. On MySQL, DB_DATABASE is the database name, not a path. Commented out in the file as shipped.
DB_PORT3306Only read when DB_CONNECTION is not sqlite. On MySQL, DB_DATABASE is the database name, not a path. Commented out in the file as shipped.
DB_DATABASElaravelOnly read when DB_CONNECTION is not sqlite. On MySQL, DB_DATABASE is the database name, not a path. Commented out in the file as shipped.
DB_USERNAMErootOnly read when DB_CONNECTION is not sqlite. On MySQL, DB_DATABASE is the database name, not a path. Commented out in the file as shipped.
DB_PASSWORDemptyOnly read when DB_CONNECTION is not sqlite. On MySQL, DB_DATABASE is the database name, not a path. Commented out in the file as shipped.
SESSION_LIFETIME120Minutes before a panel session expires.
SESSION_ENCRYPTfalseWhether Laravel encrypts the panel's session data.
SESSION_PATH/Cookie path for the panel session.
SESSION_DOMAINnullCookie domain. Leave null unless you run subdomains.
BROADCAST_CONNECTIONlogEvent broadcasting. Nothing here broadcasts.
FILESYSTEM_DISKlocalDefault disk. The pictures in /api/media always go to the local disk (storage/app/private/), whatever this says.
CACHE_PREFIXemptyPrefix for cache keys, if you share a cache server. Commented out in the file as shipped.
MEMCACHED_HOST127.0.0.1Only read when CACHE_STORE is memcached.
REDIS_CLIENTphpredisOnly read when a cache, queue or session driver is set to redis.
REDIS_HOST127.0.0.1Only read when a cache, queue or session driver is set to redis.
REDIS_PASSWORDnullOnly read when a cache, queue or session driver is set to redis.
REDIS_PORT6379Only read when a cache, queue or session driver is set to redis.
MAIL_MAILERlogOutgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_SCHEMEnullOutgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_HOST127.0.0.1Outgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_PORT2525Outgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_USERNAMEnullOutgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_PASSWORDnullOutgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_FROM_ADDRESShello@example.comOutgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
MAIL_FROM_NAME${APP_NAME}Outgoing mail: the sign-up and password-reset codes. Ships as log, which writes mail to storage/logs/laravel.log instead of sending it.
ACCOUNTS_VERIFY_EMAILtrueSign-up codes: whether sign-up needs one, how long a code lasts (minutes) and the wait between emails (seconds).
ACCOUNTS_CODE_MINUTES15Sign-up codes: whether sign-up needs one, how long a code lasts (minutes) and the wait between emails (seconds).
ACCOUNTS_RESEND_SECONDS60Sign-up codes: whether sign-up needs one, how long a code lasts (minutes) and the wait between emails (seconds).
AWS_ACCESS_KEY_IDemptyOnly read when a disk is set to s3.
AWS_SECRET_ACCESS_KEYemptyOnly read when a disk is set to s3.
AWS_DEFAULT_REGIONus-east-1Only read when a disk is set to s3.
AWS_BUCKETemptyOnly read when a disk is set to s3.
AWS_USE_PATH_STYLE_ENDPOINTfalseOnly read when a disk is set to s3.

74 of the 74 keys in .env.example, counted when this page was built.

Read by the back end but not in the file

config/companion.php also reads these. Add them to .env only if you need them:

KeyWhat it does
AI_ANTHROPIC_ENDPOINTThe Anthropic endpoint.
AI_GEMINI_ENDPOINTThe Gemini endpoint.
AI_MAX_INPUT_CHARSA ceiling over every job's own text limit in config/ai_tasks.php, in characters (images are counted separately). Default 60000.
AI_OPENAI_ENDPOINTThe OpenAI endpoint, for a compatible gateway.
After changing .env on a live server

php artisan config:clear. Laravel caches the configuration, and a changed key behind a stale cache is the most common "I set it and nothing happened".

35Running the server from the panel alone

Everything the server does day to day is in the panel. This chapter covers the jobs that usually want a terminal, done without one. The one thing that runs on a timer is a notification scheduled for later, and that needs the scheduler's cron line from the chapter on putting it on a server.

JobIn the panelIn cPanel or phpMyAdmin
Add or replace a provider keyAI proxy → the key field, Saveor AI_*_KEY in .env with the file manager
Change the model when a name is retiredAI proxy → the provider's model 
Switch the proxy off for a whileAI proxy → Proxy switched on; the app then says the server is not answering, and the person can switch to their own key or Demo mode 
Change the daily limitAI proxy → Requests per device per day (0 = none) 
Stop one install using the proxyDevices → Block on its row (its token is revoked) 
See what it is costingUsage, filtered by provider or status; tokens in and out per call 
Tell every install somethingSend notification (needs the Firebase key); fill Send later to schedule it 
See what was sent, or stop a scheduled onePush history → Cancel on a scheduled row 
Ask everyone to update the appApp updates → New: latest and minimum version, the message, the store links, when it goes live 
See or delete the photos an install sentPictures → Delete on a row, or select several. A photo the phone still holds is sent again on its next sync. 
Remove an install and what it left hereDevices → Delete on its row; its usage rows and pictures go with it 
Stop people creating accountsSettings → Let new users sign themselves up 
Add an administratorUsers → New, role admin 
Back up the database phpMyAdmin → the database → Export → Quick → SQL. Keep the file, a copy of .env and the folder storage/app/private/media/ (file manager → Compress) off the server.
Restore a backup phpMyAdmin → Import → the .sql file.
Clear the demo dataSettings → Clear demo data. It removes only the seeded records (the demo pictures, releases and push records included) and asks first.cPanel Terminal: php artisan demo:clear does the same.
The Devices page in the admin panel
The Devices page: one row per install that asked for a token, with its platform, app version, request count, blocked flag and when it was last seen, and the Label, Block and Delete actions on each row. The sidebar holds every section: Dashboard, Users, AI proxy, Devices, Usage, Pictures, App updates, Settings, Send notification and Push history.
The Pictures page in the admin panel
The Pictures page with the demo data: two sign-post photos stored by the first demo device, shown as Device #1 · android, with the file name, size, type, when it was stored and a Delete action.
The Usage page in the admin panel
The Usage page: every proxied call with its provider, model, tokens, latency and status, including the refused and failed ones.

GUI tools that work with this back end

  • phpMyAdmin, on nearly every shared host.
  • TablePlus or Sequel Ace, a desktop client over SSH, if your host allows it.
  • DB Browser for SQLite, which opens database/database.sqlite directly on the default database.

36Moving to a newer Permora release

When a newer release of this item arrives, you want its fixes without losing your own work. These are the files a buyer usually changes, and what to do with each.

Keep yoursTake the new one
backend/.env (and its APP_KEY: the saved provider keys depend on it)backend/app/
backend/config/*.php if you edited anybackend/routes/
Your database, and backend/storage/app/private/media/ (the pictures)backend/database/migrations/
assets/icon/, assets/images/street/, assets/images/illustrations/permora_ai_app/lib/, except the files on the left
lib/app/core/theme/app_colors.dart, app_text_theme.dart, lib/app/core/values/feature_config.dart, lib/firebase_*.darttest/, packages/
Your sentences in lib/l10n/pubspec.yaml, merged rather than replaced if you added packages

The safe order

  1. Back up the database, .env and storage/app/private/media/ first.
  2. Unzip the new version beside the old one, not over it.
  3. Diff the two trees (VS Code: select two folders, Compare; or diff -r <old> <new>).
  4. Copy the new files over, skipping the left-hand column.
  5. composer install, then php artisan migrate, then php artisan config:clear.
  6. flutter pub get and run the app.

Are the migrations safe on a live database?

Yes, for this release. Every migration creates a table or adds a column; the only drop calls are in their down() methods, which run on a rollback, never on migrate. So php artisan migrate on a database with your devices and usage in it is additive. You can check a future release before you run it: a migration that removes something contains dropColumn, dropIfExists or renameColumn in its up(). migrate:fresh is a different command and drops everything; see the commands chapter.

On the phone

A driver's posts, permits and parking stops are kept under versioned keys (schemaVersion on each model), so an app update reads what the old version saved. If you change a model's fields, raise its schemaVersion and handle the old shape in its fromJson.

Keeping customizations easy to carry

Colors and type in the two theme files, switches in feature_config.dart, copy in the l10n files, and anything genuinely yours in new files rather than as edits to existing ones. The further your changes are from the files this item ships, the shorter your next upgrade.

37Which bills come from whom

The app runs on the phone and the back end on your own hosting; Demo mode calls nothing at all. What costs money is whatever you connect:

ServiceNeeded forWho pays
Google (Gemini), OpenAI or Anthropic APIReading real posts and permits, and the three sentencesWith a person's own key, that person. Through the included server, you, per request, to the vendor whose key the server holds. Set the caps on the AI proxy page and a spending limit at the vendor accordingly.
Web hosting with PHP 8.4 and MySQL, or a VPSThe back endYou, to your host
Apple Developer ProgramPublishing on the App Store, Sign in with Apple, push on iOSYou, to Apple: an annual membership fee
Google Play ConsolePublishing on Google PlayYou, to Google: a one-time registration fee
FirebasePush, analytics and crash reports (the feature packs)You; the free tier covers a small app
A mail providerPassword reset mail, if you add itYou, per message

A post read is one request with one or two photos; Why this answer? is one small text request each time it is asked. Current prices and free allowances are on each vendor's own pricing and rate-limits pages, linked from the AI screen; this manual quotes none, because they change.

Publishing on the stores needs your own developer accounts: Apple charges an annual fee for the Apple Developer Program, and Google a one-time fee for a Play Console account. The AI vendors bill every request made with their key, for as long as the app is in use.

Connecting any of these will involve third-party services, and those services will incur their own separate costs, billed by the provider to you. None of them is included in this item.

38Signing builds and sending them to the stores

From a working app to something the stores accept.

Android

  1. Create a keystore, once, and keep it safe; losing it means you can never update the app under the same listing:
    keytool -genkey -v -keystore <path-to-keystore>/upload.jks \
      -keyalg RSA -keysize 2048 -validity 10000 -alias upload
  2. Create android/key.properties (keep it out of git and out of any archive you share):
    storePassword=<password>
    keyPassword=<password>
    keyAlias=upload
    storeFile=<path-to-keystore>/upload.jks
  3. In android/app/build.gradle.kts, read that file in a signingConfigs block and point buildTypes.release at it (Flutter's "Build and release an Android app" page has the exact block). The project ships with debug signing so it runs out of the box.
  4. flutter build appbundle --release; the file lands at build/app/outputs/bundle/release/app-release.aab.
  5. Upload it in the Play Console under Production → Create new release. Google Play wants an AAB; the APK is for sideloading.

iOS

  1. Open ios/Runner.xcworkspace in Xcode.
  2. Select the blue Runner project, then the Runner target, then the Signing & Capabilities tab.
  3. Tick Automatically manage signing and choose your Team; Xcode creates the provisioning profile. The Push Notifications and Sign in with Apple capabilities are already listed there (from Runner.entitlements); remove either if you will not use it.
  4. Set the Bundle Identifier to one registered to your team, and the same prefix on the RunnerTests target.
  5. flutter build ipa --release; it lands at build/ios/ipa/.
  6. Upload with Transporter (free on the Mac App Store) or Xcode → Window → Organizer → Distribute App, then submit in App Store Connect.

The privacy keys App Review will ask about

ios/Runner/Info.plist carries four usage descriptions, and each sentence should name your app if you rename it:

KeyWhy
NSCameraUsageDescriptionTaking a photo of a sign post, a permit or the spot where the car is.
NSPhotoLibraryUsageDescriptionChoosing such a photo from the library.
NSPhotoLibraryAddUsageDescriptionSaving an image the driver shares from the app.
NSFaceIDUsageDescriptionThe lock-on-launch switch.

UIBackgroundModes lists remote-notification for push. On Android the manifest declares INTERNET, USE_BIOMETRIC, POST_NOTIFICATIONS and BILLING; the camera is reached through the system picker and needs no permission of its own. In App Store Connect's privacy answers and the Play Console's data safety form, say that photos of sign posts and permits are sent to the AI provider (or your server) the person chose, to read the printed rules, and are not used to identify them. If you ship with the included server as the route, also say that, when the person switches on photo copies, the photos are stored on your server, linked to the install (not to a named person), until they are deleted.

Before you submit

  • Bump version: in pubspec.yaml (1.0.0+1): the part before the plus is what people see, the part after is the build number, and every upload needs a higher one. Keep appVersion in lib/app/data/services/settings_service.dart in step: it is what the app reports to your server.
  • Replace the launcher icon, the app name and the sample photographs.
  • Decide what a fresh install opens on: Demo mode (as shipped), or your server via API_BASE_URL. Anyone trying the app can use either without a key.

39Terminal commands for the app and the server

In the app folder

CommandWhat it does
flutter pub getFetch the packages. Run it after any change to pubspec.yaml.
flutter runRun on the connected device or simulator, in Demo mode.
flutter run --dart-define=API_BASE_URL=<url>Run with your server built in: Demo mode off, posts read through the proxy.
flutter run --dart-define=LOCALE=esPin one language for this build.
flutter run --dart-define=IAP=onUse the real store for purchases (needs product ids).
flutter analyzeStatic analysis. Ships with zero issues.
flutter testThe unit and widget tests.
flutter build appbundle --releaseThe bundle Google Play wants.
flutter build ipa --releaseThe archive App Store Connect wants.
flutter build apk --releaseAn APK for sideloading.
dart run flutter_launcher_iconsRegenerate every launcher icon from assets/icon/.
flutter cleanDelete build output. Harmless, and the first thing to try when a build fails for no reason.

In the back end folder

CommandWhat it does
./install.shFirst-time setup: dependencies, key, database, demo data. Safe to run again: it keeps an existing .env and APP_KEY, so the saved AI keys stay readable, and loads the demo data only once per database.
composer installFetch the PHP dependencies.
php artisan serveA development server on port 8000.
php artisan migrateApply new migrations. Additive in this release: nothing is dropped or renamed.
php artisan demo:seedLoad the demo accounts, devices and usage on a fresh install. It runs once per database: after Clear demo data, or on a server that already has real accounts, it loads nothing.
php artisan route:list --path=apiPrint every API route, as the API reference lists them.
php artisan config:clearForget the cached configuration. Run it after editing .env on a live server.
composer testThe Pest suite.
docker compose up -d --buildStart the Docker stack. Keeps the database and pictures across restarts: migrations are additive and the demo data is seeded on the first start only.
docker compose downStop the Docker stack.

The commands that destroy data

Read before running any of these

php artisan migrate:fresh --seed drops every table in the database and rebuilds it, then inserts the demo data. Devices, usage rows, accounts and the provider keys you saved in the panel are gone. There is no confirmation prompt in a non-interactive shell and no undo. Use it on a laptop, never on a live server.

php artisan demo:clear deletes every row flagged as demo data, including the demo admin account. It asks first unless given --force. That is what you want before going live, once you have created an admin of your own; back up first.

docker compose down -v deletes the Docker database volume along with the containers.

40When reading, building or hosting goes wrong

The app will not build

SymptomCauseFix
Unsupported class file major version, or Gradle complains about JavaGradle is using a JDK that is too new or too old.Install JDK 17 and point Flutter at it: flutter config --jdk-dir <path-to-jdk-17>.
Minimum supported Gradle version is …An older Flutter SDK than the project needs.flutter upgrade to 3.47 or newer.
Xcode stops at Resolving Package Graph or reports a package it could not fetchXcode could not download a plugin's Swift package (no network, a proxy, or a stale cache).In Xcode, File → Packages → Reset Package Caches, then build again; behind a proxy, let Xcode reach github.com.
The IDE underlines every import but flutter run worksThe editor does not know where the Dart SDK is.VS Code: Flutter: Change SDK. Android Studio: Settings → Languages & Frameworks → Flutter.
Could not find package qh_…packages/ was deleted or moved.Put it back beside lib/; the feature packs are part of the project.
A build that used to work fails after a package changeStale build output.flutter clean && flutter pub get.

The app runs but reading does not

SymptomCauseFix
Every read returns a sample postDemo mode is on, or the route you picked has no key or address yet, so Demo mode is answering.Settings → AI: pick a route and add its key or server address. The screen says when it is falling back.
"The model … has been retired"The vendor retired the model name.Enter a current one on that route's card; on your server, on the AI proxy page.
"Could not reach your server"The address is wrong, or the phone cannot see it.On a real phone 127.0.0.1 is the phone: use your computer's LAN address, same Wi-Fi. Check the address has no /api.
"Your server is not set up to answer yet"The proxy is switched off, or has no key for its default provider.Panel → AI proxy: switch it on, add a key. GET /api/ai/status shows which providers are available.
"That photo is larger than your server accepts"The image is over AI_MAX_IMAGE_BYTES.Raise it together with the app's maxImageBytes, or take the photo a little further away.
No Google / Apple buttonsDemo mode is off and there are no client ids in feature_config.dart. (In Demo mode both always show.)See the chapter Setting up Google and Apple sign-in.

The back end

SymptomCauseFix
A blank white page, and the URL shows your domainThe document root points at the folder above public/.Point it at <path-to-backend>/public. Until you do, .env is downloadable.
A blank white page (or a 500), and the document root is already rightA different fault with the same symptom: storage/ and bootstrap/cache/ are not writable.Make both writable by the web server: cPanel file manager → Permissions, or chmod -R ug+w storage bootstrap/cache. If storage/logs/laravel.log is empty or missing, this is almost certainly it.
syntax error, unexpected token in a vendor filePHP is older than 8.4.cPanel → MultiPHP Manager → 8.4. php -v shows what you are really running.
A change to .env has no effectThe configuration is cached.php artisan config:clear.
Keys saved in the panel stopped working after a moveAPP_KEY changed; the saved keys were encrypted with the old one.Restore the old APP_KEY, or paste the keys again.
SQLSTATE[HY000] [2002]Wrong database host or credentials.Check the DB_* keys; on shared hosts the names are prefixed with your account name.
Every install gets "too many attempts" at onceThe server is behind a proxy it does not trust, so every install looks like one address.Set TRUSTED_PROXIES.
Chat answers 504The server cannot reach the provider.Ask your host whether outbound HTTPS is allowed on your plan.
A notification sent for later stays ScheduledThe scheduler's cron line is missing.Add it (the chapter on putting it on a server), and check APP_TIMEZONE is your zone.
An install's photos stop appearing on PicturesIt has used its picture space (MEDIA_MAX_TOTAL_BYTES), so new ones are refused with 413; or the phone is on its own key or Demo mode, which sends none.Raise MEDIA_MAX_TOTAL_BYTES. Deleting pictures on Pictures frees space only for photos the phone no longer holds (posts deleted on the phone); the rest are sent again.
The panel loads without stylingAPP_URL does not match the address you are browsing.Fix it, then php artisan config:clear.

41Parking words used in this manual

TermMeaning here
PostOne sign pole and every plate on it, read and saved as one record.
PlateOne sign on the post, saved as a rule: kind, days, hours, limit, zone.
Confirmed plateA plate the reader was sure of, or one the driver checked. Only confirmed plates count in a verdict.
VerdictThe answer for one minute: park, park for a while, pay, or not at all, with until when or from when.
Move-by timeWhen a parked car has to go: the verdict's until at the minute it was parked.
ZoneThe letter or number a permit is issued for, and that a plate requires or excuses.
Week ribbonsThe seven columns under a post, one per day, colored by what the post allows.
Curb cardThe card on the Parked tab showing where the car is and when it has to move.
JobOne kind of request to a model, with its own instruction, schema and parser.
RouteWho answers a job: Demo mode, Gemini, OpenAI, Claude or your server.
Key proxyThe back end: it holds the provider keys and forwards requests for registered installs.
Device keyA random 32-character id made once per install and traded for a bearer token.
Demo modeThe sample week and the on-device answer; nothing is written to disk.
Feature packOne of the small packages in packages/, switched on in feature_config.dart.
Sanctum tokenThe bearer token the back end issues.
FilamentThe admin panel framework the back end uses.
--dart-defineA value passed to a Flutter build from the command line, read with String.fromEnvironment.

42What buyers ask about Permora

Does the app need the back end?

To try it, no: Demo mode answers on the device and every screen works. To read real posts it needs a model, through a key the driver pastes in or through the back end in the same download. The back end is what lets you ship without asking anyone for a key.

Does the AI decide whether I can park?

No. It writes down what each plate says, and the driver checks any plate it was unsure of. Whether the car may stay, and until when, is worked out on the phone by the engines from the confirmed plates, and the same post at the same minute gives the same answer everywhere.

Does it promise I will not get a ticket?

No, and nowhere in the app does. It reads the plates you photographed and says what they allow; the sign on the street, and the city that put it there, have the last word. A plate the photo did not show, or a temporary sign taped to the pole, is not in the answer.

Which cities does it work in?

Any city whose plates follow the common kinds: no parking, no stopping, street cleaning, tow-away, loading, permit only, time limits and meters. Nothing is looked up online, so there is no list of supported cities. The country setting helps the reader with local wording and picks the clock.

Does it know where I am?

No. The app never asks for location; the photo of the spot on the curb card is how you find the car again.

What does a photo of a post reveal?

The photo goes to the route the driver chose, to be read. The included server keeps a copy only when the driver switches on photo copies in Settings → AI; those are listed on the panel's Pictures page under the install, not a name. The reader is told never to write a license plate, a street name or an address.

Can I change the colors and the typefaces?

Yes: one file for colors and one for type. See those two chapters.

Which languages?

English, Spanish and Arabic (3), including right-to-left. Adding one is a file and a line.

43AI disclosure

AI-assisted tools were used to help write and review the source code and the documentation of this item. The author reviewed, tested and finalized every part before release.

In addition, Permora's parking sign reading is AI-powered. At run time a model does three things in Permora: it transcribes the plates on a photographed post (kind, days, hours, time limit, permit zone), it reads the zone and expiry date off a permit photo, and it writes the three sentences behind Why this answer. Whether the car may park, until when, and from when it may park again are worked out on the phone by the app's own rule engine from plates the driver confirmed. No AI service, key or credit ships with the item: buyers connect their own Gemini, OpenAI or Anthropic account, or run the included key proxy with their own keys, and pay those providers directly. Without a key the app answers in Demo mode on the device from its sample posts. The street photographs are Pexels-licensed stock listed in assets/images/street/LICENSES.txt, the sample posts are drawings made for this item, the typefaces are under the SIL Open Font License, and no image-generation model was used.

44Getting help, and the licenses for fonts and photos

Support

Questions about setup, the AI routes, the back end or re-skinning are answered through the item's comments. Item support covers this item as shipped; it does not cover a provider's own account, quota or billing, or code you have changed.

Licenses

  • Typefaces: Oswald and Be Vietnam Pro, SIL Open Font License 1.1: assets/fonts/LICENSES.txt.
  • Photographs: Pexels License, each file and its source in assets/images/street/LICENSES.txt.
  • Sample post drawings: drawn for this app and yours to change, listed in assets/images/illustrations/ASSETS.txt.
  • Flutter packages and PHP packages: their own licenses, in pubspec.lock and composer.lock. The back end's Spanish and Arabic validation files come from Laravel-Lang (MIT, lang/LICENSE-Laravel-Lang.txt).
  • The landing page uses the same typefaces and screenshots of this app, and is yours to edit and publish.
The first screen of the bundled landing page
The first screen of landing/index.html: a one-page site for your own app, in its colors and typefaces, with its own screenshots.
All demos