How n1sp/kakei-lite works
Project type and purpose
• kakei-lite is a full-stack, personal finance (家計簿) web application built with Next.js and TypeScript.
• The user interface is implemented with shadcn/ui components.
• The backend is currently implemented as Next.js API routes (serverless functions) that speak REST, with a SQLite store via Supabase Client.
File structure
Top-level directories and their roles:
• src/app: Next.js App Router pages, layouts, CSS entrypoint.
• app/api/expenses → Serverless endpoints (GET, POST, PUT, DELETE)
• app/expense/* → UI pages: dashboard, additional expense pages
• app/notes → notes feature page
• src/components: Reusable UI elements (badge, button, table, etc.)
• src/features/expense: Domain logic for “expense” feature
• api/client.ts, endpoint.ts → thin client wrappers for REST calls
• components → feature-specific UI (ExpenseList, ExpenseSummaryCard)
• hooks/useExpenses.ts → custom React hooks for data fetching
• src/lib: Shared utilities
• supabaseClient.ts → initializes Supabase client for SQLite
• utils.ts → general helper functions
• src/utils: Formatting helpers
• Configuration files: next.config.ts (Next.js), tsconfig.json, eslint, postcss
README for additional insights
• Architecture described as “Frontend and Backend separated”, REST API
• Future migration: backend will move to Spring Boot + PostgreSQL, Dockerized
• Current DB: SQLite via Supabase client
Main components and their interactions
a. Next.js Frontend (React + shadcn/ui)
b. Next.js Serverless API (app/api/expenses routes)
c. Data Access Layer (supabaseClient → SQLite)
d. Browser (client) communicating via fetch or React Query to API
e. Future External Services: Spring Boot REST API, PostgreSQL, Docker
Architectural patterns and design principles
• App Router (Next.js 13) separating pages/layouts and API routes
• Feature-based module decomposition under src/features/expense
• Client-server separation within same repo (monorepo style)
• Custom hooks for data fetching (separation of concerns)
• Shared UI library (shadcn/ui) and utility modules