How naresh5021/gitdiagram works
Project type and purpose
• Frontend built in Next.js + TypeScript + Tailwind, backend in Python FastAPI, persisting data in PostgreSQL via Drizzle ORM, and orchestrating calls to OpenAI/Anthropic & GitHub APIs.
File structure
• Top-level:
• backend/ ─ contains the FastAPI service, Dockerfile, entrypoint, rate-limit logic, nginx proxy, and shell scripts for deployment and DB setup
• src/ ─ Next.js app with React components, server actions (cache, GitHub, repo fetch), custom hooks, UI library under components/ui, global styles, env.js
• src/server/db/ ─ Drizzle ORM schema and connection code for Postgres
• docker-compose.yml & start-database.sh ─ define multi-container orchestration (FastAPI, Postgres, nginx)
• config files (tsconfig.json, next.config.js, drizzle.config.ts) and CI/CD workflows (.github/)
• Patterns:
• Layered architecture in the backend: routers → services → utils
• Separation of concerns in frontend: page.tsx for layouts, _actions for server-side operations, hooks for client caches
• API gateway/proxy via nginx
Extract insights from README
• Architecture: Frontend (Vercel) ↔ Backend (EC2) behind nginx
• Database: PostgreSQL + Drizzle ORM
• AI: OpenAI o4-mini (and Claude previously) consumed via a services layer
• CI/CD: GitHub Actions, Analytics with PostHog & Api-Analytics
Main components & interactions
a. Components:
• User Browser (React UI)
• Next.js Frontend:
– Client-side pages & components
– Server Actions/API Routes (src/app/_actions)
• API Gateway/Reverse Proxy (nginx in backend/nginx)
• FastAPI Backend:
– Routers (generate, modify)
– Core (rate limiter, prompts pipeline)
– Services (openai, claude, openrouter, GitHub)
– Utils (message formatting)
• PostgreSQL Database (Drizzle ORM)
• External services:
– OpenAI/Anthropic APIs
– GitHub REST API
• CI/CD & Analytics (GitHub Actions, PostHog)
b. Relationships & data flow:
1. Browser → Next.js Frontend (user inputs repo URL)
2. Frontend Server Action → Backend API (POST /generate) via nginx
3. FastAPI Router enforces rate limits → Core pipelines (prompts.py)
4. Core calls Service layer:
– GitHub Service fetches file tree & README
5. FastAPI stores any persistent data in Postgres via Drizzle
c. Architectural patterns & principles:
• Layered service architecture in backend (Router → Service → Utils)
• Strict frontend/backend separation with API boundary
• Stateless backend behind nginx, stateful Postgres for rate data or caching
d. Key technologies: Next.js, React, Tailwind, FastAPI, Python, Docker, nginx, PostgreSQL, Drizzle ORM, OpenAI o4-mini, GitHub API
Detail
• Layering (e.g., Router → Service → Utils → External)