How combiao/finlover works
Purpose and Runtime
FinLover is an expense-tracker foundation built as a single Next.js App Router application. It uses TypeScript, Tailwind CSS, MongoDB/Mongoose persistence, and bcrypt/JWT-based authentication. The application is run with npm and serves locally through Next.js.
Key runtime/configuration paths: package.json, next.config.ts, .env.example.
Application Entry and Shell
The App Router owns application bootstrapping and page rendering. The root layout establishes shared document/UI structure and global styles; the root page is the current primary user-facing entry point.
Paths: src/app/layout.tsx, src/app/page.tsx, src/app/globals.css.
API Boundary
Server-side HTTP endpoints belong under the App Router API namespace. The directory exists but contains no implemented routes yet, making it the intended boundary for authentication, expense operations, and other client/server interactions.
Paths: src/app/api, src/app/api/.gitkeep.
Authentication Layer
Authentication is centralized in a library module and is intended to combine JWT token handling with bcrypt password hashing. Secrets and hashing cost are supplied through environment variables rather than source control.
Paths: src/lib/auth.ts, .env.example, src/app/api.
Persistence Layer
MongoDB access is encapsulated behind a database library module, with Mongoose identified as the ODM. Domain schemas/models are intended to live separately from connection logic, preserving a boundary between infrastructure and expense/user entities.
Paths: src/lib/db.ts, src/models, .env.example.
UI Composition
Reusable application components are separated from the route tree. The repository includes a shared UI button primitive and a reserved area for higher-level feature components; Tailwind/PostCSS provide styling infrastructure.
Paths: src/components/ui/button.tsx, src/components, components.json.
Shared Client/Server Utilities and Types
Cross-cutting helpers are collected in src/lib, while hooks and TypeScript domain contracts have dedicated extension points. This supports keeping route code focused on orchestration rather than shared behavior or data definitions.
Paths: src/lib/utils.ts, src/hooks, src/types.
Delivery Controls
GitHub Actions provides CI, while Husky hooks and repository scripts enforce branch and commit-message conventions before changes enter the main workflow.
Paths: .github/workflows/ci.yml, .husky/pre-commit, scripts/check-branch-name.js.
Main entry points: page.tsx Root page · api API namespace · layout.tsx Root layout · db.ts Database access
Components 18
Next.js application
- Next.js config
next.config.ts - Root layout · Establishes shared document structure and global UI.
src/app/layout.tsx - Root page · Current primary user-facing entry point.
src/app/page.tsx - Global styles
src/app/globals.css
Server boundary
- API namespace · Reserved HTTP boundary for auth and expense operations.
src/app/api - Authentication · Centralizes token handling and password hashing.
src/lib/auth.ts - Database access · Encapsulates MongoDB connection infrastructure.
src/lib/db.ts - Domain models · Reserved boundary for user and expense entities.
src/models - Environment variables · Supplies database, JWT, and hashing configuration.
.env.example
Shared code
- Component library · Shared primitives and feature component extension point.
src/components - Button primitive
src/components/ui/button.tsx - Shared utilities
src/lib/utils.ts - Hooks extension point
src/hooks - Type contracts
src/types
Delivery controls
- CI workflow
.github/workflows/ci.yml - Pre-commit hook · Enforces branch naming before changes enter the workflow.
.husky/pre-commit - Branch-name check
scripts/check-branch-name.js
Other components
- npm runtime · Runs the Next.js application.
package.json
Connections 17
- npm runtime → Next.js config: configures
- Next.js config → Root layout: boots App Router
- Root layout → Root page: renders
- Root layout → Global styles: loads
- Root page → Component library: composes
- Component library → Button primitive: includes
- Root page → Hooks extension point: uses
- Root page → Type contracts: uses contracts
- API namespace → Authentication: will authenticate through
- API namespace → Database access: will persist through
- Database access → Domain models: loads schemas
- Authentication → Environment variables: reads secrets and cost
- Database access → Environment variables: reads MongoDB settings
- API namespace → Type contracts: uses contracts
- Shared utilities → Type contracts: uses contracts
- CI workflow → npm runtime: runs checks
- Pre-commit hook → Branch-name check: executes