How vkatvell/general-ledger works
Project Overview & Main Components
• This is a containerized full-stack ledger system with a FastAPI backend and a Next.js frontend. It uses PostgreSQL as its database, managed by Alembic migrations. Development and container orchestration are handled via Docker Compose.
• Key components to include:
• Frontend (Next.js application)
• Backend (FastAPI application)
• Database (PostgreSQL)
• Database migration tool (Alembic)
• Development/CI tools (Docker Compose, Dockerfiles, and test suites)
Analyzing the File Structure for Architectural Clues
• Backend:
• The “app” directory contains subdirectories for core configuration, database models, API routes, schemas, services, and utility functions. This indicates a layered design where routes handle HTTP requests, services include business logic, and models represent the DB structure.
• The “alembic” folder along with its migration scripts shows that there is a defined process for managing database schema changes.
• Frontend:
• The “frontend” directory is organized with pages (typically under “app”) and reusable components. There are dedicated areas for pages (pages and sections like accounts, entries, summary) and shared UI components built with TailwindCSS and ShadCN UI.
• Common configuration & tools:
• There are Dockerfiles at both the project root (backend) and inside the “frontend” directory, along with a docker-compose.yml file that orchestrates the containers and likely includes the PostgreSQL service.
• Test directories (“tests”, with integration and unit tests) and seed scripts hint at support for automated testing and data initialization during development.
a. Main Components:
• API Routes (endpoints for accounts, entries, summary)
• Business logic (services)
• Data validation/schemas
• DB models and session handling
• Core configuration settings and utility functions.
• Database: Represent PostgreSQL with its connection to the backend and noted usage of async SQLAlchemy.
• Migrations: A component representing the Alembic migration process that synchronizes with the database.
b. Relationships & Data Flow:
• Optionally, show the testing suite and development scripts interacting with the backend and database layers.
• If desired, add notes on seed data (from scripts/seed.py) that prepare initial database state.
c. Architectural Patterns & Design Principles:
• For the backend, note the layered architecture (routes → services → database/models) that enhances separation of concerns.
• Mention the containerization strategy where each major component (frontend, backend, database) runs isolated in its own Docker container.
• Use of asynchronous programming (FastAPI with async SQLAlchemy) for performance.
d. Relevant Technologies:
• Also mention development tools like Docker Compose, pre-commit hooks, and pytest for test automation.