How ottoengel/finally works
Project type and purpose
• This is a full-stack web application built with Next.js (App Router), TypeScript, Tailwind CSS, and Prisma.
• The domain appears to be a personal-finance or subscription-based transaction tracker with features like AI-driven reporting, Stripe-powered payments, and user dashboards.
High-level architecture components
a. Client (Browser)
• React components under app/(…) that render pages (Home, Dashboard, Login, Subscription, Transactions)
• Client-side interactivity (buttons, dialogs, forms, charts) via the _components/ui library
b. Next.js Server
• App Router handles routing and SSR/SSG for pages (app/page.tsx, app/dashboard/page.tsx, etc.)
• Server Actions (app/_actions, app/dashboard/_actions, etc.) for form submissions and data mutations
• API Routes (app/api/webhooks/stripe/route.ts) to receive Stripe webhooks
c. Database
• Prisma ORM layer (app/_lib/prisma.ts) connecting to a SQL database defined in prisma/schema.prisma
• Migrations under prisma/migrations/
d. External Services
• Stripe API – checkout sessions, webhook events
• (Likely) OpenAI or other AI service for generating dashboard reports in generate-ai-report
e. Infrastructure / Deployment
• Vercel serverless functions (Next.js app deployment)
• CI pre-commit hooks (Husky) and linting/prettier configurations for code quality
Relationships and data flows
1. User’s browser requests a page → Next.js Server
2. Server renders React components + static assets (public/, globals.css) → Browser
3. User interacts (e.g., “Add Transaction” button) → triggers a Server Action
• Server Action calls Prisma to read/write the database
• Server returns updated props to the client (revalidation or streamed SSR)
4. Subscription flow
• Client invokes create-stripe-checkout Server Action → calls Stripe API → redirects user to Stripe hosted page
• Stripe webhook hits app/api/webhooks/stripe/route.ts → updates subscription status in database via Prisma
5. AI Reporting
• Dashboard “Generate AI Report” button → Server Action calls an AI service → writes report results back to DB or directly returns to client
Architectural patterns and design principles
• App-Router MVC-style separation:
• View: React components in app/(…)
• Controller: Server Actions & API Routes handle business logic
• Model: Prisma ORM + database schema
• Serverless micro-endpoints: each Server Action and API Route is its own function
• Shared UI library under _components/ui promotes design consistency and reusability
• Environment-driven configuration: Stripe keys, database URLs managed outside version control