How trancethehuman/gitdiagram works
Main Components
• Backend: The “backend” directory contains FastAPI code. It includes application initialization (app/__init__.py), core utilities (e.g., rate limiting in app/core/limiter.py), routers handling routes (generate.py and modify.py), services for interacting with third-party APIs (e.g., files in app/services), and prompt processing (in app/prompts.py).
• Database: Located under “src/server/db” and used by the backend with PostgreSQL as the engine and Drizzle ORM to manage the schema.
• External Services:
• GitHub API to fetch repository data.
• Optional analytics tools (PostHog, Api-Analytics).
• Deployment & DevOps: Docker Compose, Dockerfiles, Nginx configuration (for routing), GitHub Actions for CI/CD, and deployment scripts are part of the architecture.
Relationships and Interactions
• The Database is used by the backend to store/cach data if needed or maintain session/configuration states.
• External integrations are layered as additional services – for example, making HTTPS calls to GitHub or AI service endpoints.
Architectural Patterns and Design Principles
• Separation of Concerns: Clear division between the concerns of visualization (frontend), data processing and orchestration (backend), and persistence (database).
• API-Centric Communication: The frontend and backend interactions are designed using REST or server actions principles.
• Containerization: Use of Docker and Docker Compose encapsulates backend dependencies, while static/dynamic hosting (Vercel and EC2) separates deployment environments.
• Extensibility: The prompt-engineering based approach (centralized in the backend’s prompts.py) makes it easier to extend core functionality for different types of repositories.
Relevant Technologies
• Frontend: Next.js, TypeScript, Tailwind CSS, ShadCN UI components.
• Backend: FastAPI, Python, Gunicorn (if applicable), and server action utilities.
• Database: PostgreSQL managed through Drizzle ORM.
• Containerization: Docker, docker-compose, and Nginx for reverse-proxying.
• CI/CD & Deployment: GitHub Actions, Vercel (for the frontend), and EC2 (for the backend).