How abrahdev/karter works
Purpose and Entry Points
Karter is an offline, privacy-first vehicle maintenance tracker. The primary product is a Flutter app launched from mobile/lib/main.dart, with native Android/iOS/Linux hosts under mobile/android, mobile/ios, and mobile/linux. A separate Docusaurus site publishes project and architecture documentation from docs/.
Application Layering
The mobile code follows a domain/data/presentation split:
• Domain entities, value objects, validation, errors, and repository contracts define business rules independently of UI/storage: mobile/lib/domain/entities/vehicle.dart, mobile/lib/domain/value_objects/odometer.dart, mobile/lib/domain/repositories/vehicle_repository.dart.
• Data implementations fulfill those contracts and own persistence/service integrations: mobile/lib/data/repositories/vehicle_repository_impl.dart, mobile/lib/data/repositories/maintenance_log_repository_impl.dart.
• Presentation pages, providers, and widgets render and coordinate user workflows: mobile/lib/presentation/pages/home_page.dart, mobile/lib/presentation/providers/vehicle_providers.dart.
Local Persistence and Core Records
The app stores data locally through its generated application database, preserving the no-account/no-telemetry boundary. The database supports vehicles, fuel logs, maintenance intervals/logs, and vehicle documents; repositories isolate database details from consumers. Core persistence paths are mobile/lib/core/database/app_database.dart, mobile/lib/data/repositories/fuel_log_repository_impl.dart, and mobile/lib/data/repositories/vehicle_document_repository_impl.dart.
User Workflows and State
The home/dashboard flow exposes per-vehicle operational data and navigates to forms/lists for fuel, maintenance, documents, and settings. Providers supply selected-vehicle and template-source state to the widget tree; pages should depend on domain/repository abstractions rather than directly on tables. Representative flow boundaries: mobile/lib/presentation/pages/dashboard_page.dart, mobile/lib/presentation/pages/fuel_log_form_page.dart, mobile/lib/presentation/pages/maintenance_settings_page.dart.
Maintenance Templates Pipeline
Versioned JSON vehicle templates provide seeded or resolved maintenance intervals by vehicle type, make, and model. Shared base templates are composed/resolved by mobile services, while Python tooling regenerates the repository index and template artifacts. Key contract/data paths: templates/schemas/template-v1.json, templates/index.json, templates/data/_base/common-all.json, mobile/lib/data/services/template_resolver.dart, tools/generate_templates.py.
Device Services and Outputs
Background processing and notifications support interval reminders; export services produce user-controlled data exports, including PDF export. These are local/device-facing integration boundaries rather than backend APIs: mobile/lib/data/services/background_service.dart, mobile/lib/data/services/notification_service.dart, mobile/lib/data/services/export_service.dart. No server-side application or account service is present in this repository.
Runtimes, Distribution, and Documentation
Flutter/Dart is the application runtime, built through Gradle/Kotlin on Android and Xcode/Swift on iOS; package dependencies are defined in mobile/pubspec.yaml. GitHub Actions provides CI, releases, documentation deployment, and template-index updates: .github/workflows/ci.yml, .github/workflows/release.yml, .github/workflows/update-index.yml. Documentation is a TypeScript/Docusaurus site configured at docs/docusaurus.config.ts, with versioned content under docs/versioned_docs/.
Main entry points: home_page.dart Pages, providers & widgets · generate_templates.py Template generator · vehicle_repository.dart Domain contracts & rules · template_resolver.dart Template resolver
Components 18
Flutter Mobile App
- Flutter entry point
mobile/lib/main.dart - Pages, providers & widgets · Coordinates dashboard, forms, lists, and selected-vehicle state.
mobile/lib/presentation/pages/home_page.dart - Vehicle dashboard
mobile/lib/presentation/pages/dashboard_page.dart - Fuel log workflow
mobile/lib/presentation/pages/fuel_log_form_page.dart - Maintenance settings
mobile/lib/presentation/pages/maintenance_settings_page.dart - Vehicle state providers
mobile/lib/presentation/providers/vehicle_providers.dart - Domain contracts & rules · Entities, value objects, validation, errors, and repository contracts.
mobile/lib/domain/repositories/vehicle_repository.dart - Repository implementations · Implements domain contracts and isolates storage details.
mobile/lib/data/repositories/vehicle_repository_impl.dart - Local application database · Offline records for vehicles, fuel, maintenance, and documents.
mobile/lib/core/database/app_database.dart - Template resolver · Composes and resolves maintenance intervals for vehicles.
mobile/lib/data/services/template_resolver.dart - Background, notification & export · Runs local reminders and user-controlled exports including PDF.
mobile/lib/data/services/background_service.dart - Android, iOS & Linux hosts · Flutter platform hosts built with Gradle/Kotlin and Xcode/Swift.
mobile/android
Maintenance Templates
- Template schema
templates/schemas/template-v1.json - Template index
templates/index.json - Base maintenance templates
templates/data/_base/common-all.json - Template generator · Regenerates template artifacts and repository index.
tools/generate_templates.py
Automation & Docs
- GitHub Actions · Runs CI, releases, docs deployment, and template-index updates.
.github/workflows/ci.yml - Docusaurus documentation · Publishes project and architecture documentation.
docs/docusaurus.config.ts
Connections 19
- Flutter entry point → Pages, providers & widgets: starts UI
- Pages, providers & widgets → Vehicle dashboard: renders
- Pages, providers & widgets → Fuel log workflow: navigates to
- Pages, providers & widgets → Maintenance settings: navigates to
- Pages, providers & widgets → Vehicle state providers: reads state
- Vehicle state providers → Domain contracts & rules: uses contracts
- Pages, providers & widgets → Domain contracts & rules: depends on
- Repository implementations → Domain contracts & rules: implements
- Repository implementations → Local application database: persists locally
- Template resolver → Base maintenance templates: composes
- Template resolver → Template index: resolves from
- Template resolver → Domain contracts & rules: provides intervals
- Background, notification & export → Local application database: reads local records
- Flutter entry point → Android, iOS & Linux hosts: runs on
- Template generator → Template schema: validates against
- Template generator → Base maintenance templates: processes
- Template generator → Template index: regenerates
- GitHub Actions → Template generator: updates index
- GitHub Actions → Docusaurus documentation: deploys