How lc708/gitdiagram works
Project Type and Purpose
• It leverages prompt engineering (see the backend’s “prompts.py”) alongside AI services (OpenAI’s o3-mini and previously Claude 3.5 Sonnet) to process repository data.
• The project is full-stack with a Next.js/TypeScript frontend and a FastAPI/Python backend, and it also uses a PostgreSQL database (with Drizzle ORM).
File Structure
• Notice the clear separation between “backend” and “src”:
• The “backend” folder contains the Python FastAPI server with components such as routers (e.g., “generate.py”, “modify.py”), services (connecting to AI and GitHub APIs), configuration (nginx), and utility scripts.
• The “src” folder drives the frontend (Next.js) and includes directories like “app” with pages, actions, and server-side utilities, as well as “components” which have UI building blocks.
• Additionally, configuration files like “docker-compose.yml”, “Dockerfile”, “drizzle.config.ts”, and CI/CD configurations in “.github/workflows” indicate considerations for containerization, deployment, and continuous integration.
Core Components to Highlight
a. Frontend (Client-Side)
• Next.js application using TypeScript, Tailwind CSS, and ShadCN.
b. Backend (API & Processing Layer)
• Python FastAPI server providing REST endpoints to process incoming requests.
• Key modules include:
• Routers (e.g., “generate.py”, “modify.py”) – they handle API endpoints.
• Services (e.g., “claude_service.py”, “o1_mini_openai_service.py”, etc.) – manage integration with external AI services and GitHub.
• Prompts (in “prompts.py”) – contain prompt engineering logic for data extraction and analysis.
• Contains automation scripts (entrypoint.sh, deploy.sh) and an Nginx configuration to reverse-proxy requests.
c. Database
• PostgreSQL powered by Drizzle ORM as seen in “src/server/db” indicating the storage of processed data or user-requested information.
• Initialization and migrations are managed via the command “pnpm db:push” and a local “start-database.sh” script.
d. External and Integration Services
• GitHub APIs: For fetching repository structure and details.
• CI/CD & Deployment: Vercel for the frontend and EC2 for the backend, along with GitHub Actions for deployment pipelines.
• Optional analytics (PostHog, Api-Analytics) for tracking usage.