How gavbarosee/gitdiagram works
Main Components
• Frontend:
• Located under the “src” directory.
• Built with Next.js, TypeScript, Tailwind CSS, and ShadCN.
• Contains dynamic routing (e.g., pages for user repositories) and UI components (found in src/components and src/app).
• Backend:
• Found in the “backend” folder.
• A FastAPI application structured as modular routers (e.g., “/routers/generate.py”, “/routers/modify.py”), services (like “claude_service.py”, GitHub and OpenAI services), and utility functions.
• Contains prompt engineering logic in backend/app/prompts.py for extracting and processing GitHub repository data.
• Database:
• PostgreSQL managed via Drizzle ORM, with schema and connection management under src/server/db.
• Reverse Proxy & Deployment Tools:
• Nginx configuration files under backend/nginx (api.conf and setup_nginx.sh) signal that Nginx is used to route incoming API requests.
• Dockerfiles, docker-compose.yml, and various shell scripts (e.g., deploy.sh, entrypoint.sh) showcase a containerized deployment and self-hosting strategy.
• External Integrations & Services:
• CI/CD:
• GitHub Actions are present (in .github/workflows) to automate deployments.
Relationships & Interactions
• The Frontend and Backend are decoupled but closely integrated via API calls. The frontend sends repository URLs or parameters to the backend.
• The backend also communicates with the PostgreSQL database for storing any persistent data or caching (as managed in src/server/db).
• Docker and Nginx act as orchestration and reverse proxy layers to ensure proper traffic distribution and service isolation.
• CI/CD pipelines ensure continuous integration and deployment, coordinating code changes across these layers.
Architectural Patterns and Key Technologies
• The project exhibits a clear separation of concerns between the frontend (UI, routing, React components) and backend (API endpoints, microservices architecture within the backend/app directory).
• Use of containerization (Docker) and reverse proxy (Nginx) indicates a microservices or loosely-coupled service architecture.
• The use of server actions in the backend and Next.js’s dynamic pages in the frontend are key design patterns.
• Integration with external services (GitHub, OpenAI) highlights an event-driven and API-first approach.
Elements
• Clear labels for:
• “Frontend (Next.js/TypeScript/Tailwind)” representing the src directory.
• “Backend (FastAPI/Python)” covering the app’s routers, services (o3-mini, Claude, GitHub service modules), and prompt engine.
• “Database (PostgreSQL/Drizzle ORM)” with an indication of the src/server/db structure.
• “Reverse Proxy/Deployment (Nginx, Docker Compose)” as seen in the backend/nginx and docker-compose.yml.
• “External Integrations” (GitHub API, OpenAI/Claude APIs).
• Data flow from the Frontend to the Backend APIs.
• Internal calls within the backend (e.g., from generate router to various service modules).
• Interactions with the Database and External Services.
• Components representing CI/CD (GitHub Actions workflows) as supporting infrastructure.