Technology

Stack decisions and rationale.

Multi-platform, mobile-first architecture built for speed, type safety, and a health-data trust model.

Client Layer

Flutter - One codebase, all platforms

A single Dart codebase ships to iOS, Android, Web, and desktop. The type system enforces correctness across every pet health data surface.

Flutter / Dart

Cross-platform iOS, Android, Web, Linux, macOS, Windows. Dart SDK ^3.9.2. Single codebase, type-safe.

Provider

Lightweight state management. Predictable, well-supported, low boilerplate.

Google ML Kit

On-device OCR. Nutrition label and document scanning with no server round-trip.

Mobile Scanner

Camera-based QR and barcode scanning. Powers the product intelligence scanner.

Syncfusion PDF

PDF generation and viewing for shareable pet records and vet documents.

Flutter Local Notifications

Scheduled push with full timezone support via flutter_timezone.

Decision: Flutter chosen over React Native for stronger platform parity, better Android performance on mid-range devices, and the Dart type system's value for health-data correctness.
Server Layer

Bun + Elysia + Better Auth

Migrating from Express 5.2.1 to Bun 1.3.5 + Elysia for 3-4x faster cold starts, native TypeScript, and end-to-end type-safe API routes. Better Auth handles sessions without vendor lock-in. Migration running in isolated Wave tracks with 117 CI tests on ArcHelm self-hosted runners.

Bun 1.3.5 + Elysia

Runtime replacing Node/Express. Native TypeScript, OpenAPI generation, composable module boundaries. Wave-by-wave migration with worktree isolation.

Better Auth

Email/password, Google OAuth, Apple Sign-in, Facebook. Handles sessions, CSRF, token rotation.

Resend

Transactional email for verification, password reset, and lifecycle.

MongoDB Atlas

Primary database. Document model fits flexible, evolving pet health schemas.

Decision: Better Auth chosen over Auth0 or Supabase Auth for self-hosted control and lower cost at scale. MongoDB chosen for schema flexibility during rapid health-data model iteration.
Deployment

DigitalOcean + Cloudflare + ArcHelm CI

Simple, cost-efficient hosting for MVP velocity. Cloudflare handles edge delivery for static assets; DigitalOcean runs the API server. Lint, test, and secret-scan jobs run on ArcNode-M runners ([self-hosted, arcnode-m]); the Android build job runs on ArcHelm ([self-hosted, archelm]).

DigitalOcean

Staging server. Node.js auth server and API. Simple droplet setup for MVP velocity.

Cloudflare Pages

Static site hosting for the demo suite and future marketing. CDN-edge delivery, zero cold starts.

ArcNode-M & ArcHelm CI

Lint, test, and secret-scan on ArcNode-M ([self-hosted, arcnode-m]). Android build on ArcHelm ([self-hosted, archelm]).

ArcGrid Dev Infrastructure

Local inference on ArcHelm K8s

ArcGrid development infrastructure running on the ArcHelm Kubernetes cluster. Not part of the Packly product stack — used for dev-time AI tooling, project memory, and local model inference during development.

The LightBrain stack is ArcGrid's development cognitive layer. It keeps dev-time AI context, knowledge graph, and model routing on-stack. Pet health records and production data are isolated from this infrastructure.

ArcHelm K8s

Kubernetes cluster at 10.20.10.29. Orchestrates all AI workloads.

Neo4j 5

Graph database for knowledge graph and entity memory. MCP server port 8005.

Atlas Memory MCP

Persistent memory layer for AI agents. Port 8031.

LiteLLM Gateway

Unified LLM proxy at 172.17.0.1:4000. Routes local and cloud models.

Local Models MCP

On-device inference at 172.17.0.1:8020. Llama3.1:8b, Qwen2.5-coder:32b, Qwen3-fast.

Brave Search MCP

Web search integration for grounded, current AI responses.

Phase 2+

What plugs in next

Integrations identified for the next product phase. Sequencing driven by revenue impact and marketplace launch timing.

Stripe + Stripe Connect
Checkr (background checks)
Barcode / Product Database
Vet / PIMS Systems
POS Systems (Square, Clover, Lightspeed)
Marketing Automation
Google Maps / Mapbox
Pet Insurance APIs
Calendar Sync (iCal, Google)
Architecture Log

Key choices and why

Documented decisions with the rationale and the trigger condition for revisiting each choice.

Decision Choice Rationale Revisit When
Mobile framework Flutter Type safety + cross-platform parity from a single codebase Phase 3 web-first pivot
Auth Better Auth Self-hosted control, ESM-native, no vendor fee at scale Series A scale requirements
Database MongoDB Atlas Schema flexibility during rapid health-data model iteration Relational reporting requirements
AI inference LightBrain local Health-data privacy; pet records stay on-stack Cloud burst needed for complex reasoning
Backend runtime Bun 1.3.5 + Elysia 3-4x cold start improvement, native TS, OpenAPI type safety over Node/Express Stable — migration in progress via Wave tracks
Hosting DigitalOcean + Cloudflare MVP velocity with simple droplet setup and CDN edge K8s full migration with ArcHelm at scale