How clarkchan123/gitdiagram works
Main Components
• Frontend: Built with Next.js, TypeScript, Tailwind CSS, and ShadCN. It’s responsible for the user interface including:
• Pages under src/app (e.g., page.tsx, layout.tsx)
• Server Actions (found in src/app/_actions for caching, GitHub calls, etc.)
• Backend: Powered by FastAPI and Python (inside the backend/ directory). Key directories and files include:
• The API entry point (backend/app/main.py)
• Routers (generate.py and modify.py) which handle specific endpoints
• Core logic for rate limiting, prompt engineering, and requests (backend/app/core/limiter.py, prompts.py)
• Service layers invoking external AI and GitHub integrations (found within backend/app/services)
• Utility scripts (e.g., format_message.py)
• Database: PostgreSQL is used along with Drizzle ORM. The backend’s database integration is contained in:
• The start-database.sh script for launching a database container
• Database-related code in src/server/db (index.ts, schema.ts)
• External Services & Integrations:
• AI Services: Utilizes OpenAI (o3-mini) and formerly Claude 3.5 Sonnet, which are leveraged through dedicated service modules.
• GitHub Services: Uses GitHub integration for extracting repository information.
• CI/CD & Deployment: Docker, docker-compose (docker-compose.yml), GitHub Actions (workflows), and Nginx (in backend/nginx) for routing.
• Analytics (PostHog, Api-Analytics) as mentioned in the README.
Relationships and Interactions
• The Frontend consumes REST API endpoints exposed by the Backend.
• External API service modules (e.g., claude_service, o3_mini_openai_service) handle communication with the respective AI providers.
• CI/CD pipelines (via GitHub Actions) and Docker configurations manage deployment and orchestration between the different containers (frontend on Vercel; backend on EC2 or Docker).
Architectural Patterns and Design Principles
• Separation of concerns is clearly observed: the frontend (UI and presentation) is separate from the backend (logic, API, prompt engineering).
• Microservices- or service-oriented principles are evident in how the backend organizes functionality into routers, services, and utility modules.
• Use of Docker containers and orchestration (docker-compose) for encapsulating environments and dependency isolation.
• API-driven architecture connecting user interactions through a clear request-response flow.
Relevant Technologies, Frameworks, and Libraries
• Frontend: Next.js, React, TypeScript, Tailwind CSS, and ShadCN for UI components.
• Backend: FastAPI, Python, and supplementary libraries for rate limiting and prompt engineering.
• Database: PostgreSQL paired with Drizzle ORM, and database interaction layers in the src/server/db directory.
• External Integrations: Communication with AI endpoints (OpenAI o3-mini, Claude) and GitHub API.
• Other Dev Tools: Docker (with Dockerfile for backend), GitHub Actions for continuous integration and deployment, and Nginx for API routing configuration.