How habibwritescode/penny-wise works
Project Type and Purpose
• Pennywise is a single-page application (SPA) built on Next.js + TypeScript.
• Purpose: Personal finance management (transactions, budgets, pots, recurring bills).
• Key users: End-users in a browser.
File Structure
• src/pages – Next.js route handlers:
– /_app.tsx, /_document.tsx (global setup)
– /api/hello.ts (API stub)
– UI pages under /, /login, /sign-up, /budgets, /pots, /transactions, /recurring-bills
• src/components – Reusable UI building blocks (Shadcn + Tailwind).
• src/modules – Feature modules (auth, budgets, overview, pots, transactions, recurring-bills) each with page, components, utils.
• src/lib/store – Zustand global state slices (auth, budget, pot, transaction).
• src/utils – Shared utility functions (formatters, schemas with zod).
• Config & tooling: next.config.mjs, tailwind.config.ts, tsconfig.json, ESLint, PostCSS.
Extract Architecture Insights from README
• UI: Next.js + React + Shadcn + Tailwind.
• State: Zustand for client-side state.
• Forms: React Hook Form + zod for validation.
• No explicit database code present – likely calls an external API or serverless functions.
Main Components
A. Client Browser
B. Next.js Frontend (Pages + Components)
C. State Management (Zustand Store)
D. API Layer (Next.js API Routes under /pages/api)
E. (Optional) Data Storage – e.g., database or third-party finance API
F. External Services – Authentication provider, analytics, etc.
Relationships and Data Flows
• Browser → Next.js pages/components: HTTP(S) requests and client-side routing.
• Pages ↔ Zustand store: Local read/write for UI state.
• Pages → API routes: RESTful calls for CRUD operations (transactions, budgets, pots, bills).
• API routes → Database or External Service: data persistence or integration.
• Components → Form Library (React Hook Form + zod): data entry and validation.
Architectural Patterns and Principles
• Feature-based modular structure (src/modules).
• Separation of concerns:
– UI layer (components)
– Business logic (module utils + store slices)
– API layer (serverless functions)
• Unidirectional data flow: API → store → UI, UI actions → store → API.
• Validation at boundary: zod schemas in forms and API inputs.
Technologies & Frameworks to Annotate
• Next.js (SSR, SSG, API routes)
• React + TypeScript
• Zustand (state slices)
• Tailwind CSS + Shadcn UI components
• React Hook Form + zod
• Build configs: PostCSS, ESLint, tsconfig