Architecture
Cashlytics uses a Next.js App Router architecture with a strong separation between pages, components, actions, and data access.
High-Level Structure
src/app/: route-level entry points and API routessrc/actions/: server actions for reads and writessrc/components/: UI composition layerssrc/lib/: database, AI integration, validation, and shared utilitiessrc/hooks/: reusable client behavior hooks
Design Patterns
- Atomic-style component hierarchy (atoms, molecules, organisms, layout)
- Server Actions as the mutation boundary
- Zod validation at data boundaries
- Typed entities inferred from Drizzle schema
Data Flow
- UI triggers an action or page-level fetch.
- Server Action validates input and calls Drizzle ORM.
- Action returns typed response payload.
- Relevant routes are revalidated after writes.
Related Source Docs
cashlytics/docs/architecture/README.mdcashlytics/docs/architecture/database-schema.mdcashlytics/docs/architecture/ai-integration.md