How vietnguyen1612/gitdiagram works
Main Components
• Frontend:
• Located primarily in the “src” directory.
• Built using Next.js with TypeScript, Tailwind CSS, and ShadCN components.
• Contains pages, reusable UI components (buttons, dialogs, cards, etc.), and server-side and client-side logic (e.g., API key dialogs, hooks like useDiagram).
• Backend:
• Found under the “backend” directory.
• Implements a FastAPI server in Python.
• Contains Dockerfile, deployment scripts, and an Nginx configuration for API gateways.
• Database:
• Managed via a PostgreSQL instance (with the schema and database operations living in “src/server/db” using Drizzle ORM).
• Supported by a shell script (start-database.sh) that starts a containerized Postgres instance.
• External Services:
• GitHub integration is key (both for public and private repositories).
• AI integration with OpenAI’s o3-mini and references to Anthropic API.
• These integrations are managed in the “services” subdirectory in the backend.
• Infrastructure/Deployment:
• Docker-compose configuration ensures containerized deployment of backend services and the database.
• CI/CD pipelines are provided via GitHub Actions located in “.github/workflows”.
• Deployment is split with Frontend hosted on Vercel and Backend on EC2.
• Nginx configuration is used for routing and load balancing the API traffic.
Relationships and Interactions
• The backend also interacts with the repository’s metadata (from GitHub, potentially via the GitHub service) and might use caching or rate limiting (as hinted in “limiter.py” in the core).
• The Database stores relevant metadata and application state using PostgreSQL, which is connected via the backend through Drizzle ORM.
• CI/CD pipelines (GitHub Actions) trigger build and deploy steps ensuring that changes in code are reflected in container deployments, with Docker-compose managing the backend and database.
Architectural Patterns and Principles
• Modular Separation: Clear separation between frontend, backend, and database with dedicated directories.
• API-Centric Communication: The frontend communicates with backend endpoints using REST or server actions.
• Service-Oriented Components: Backend “services” for abstracting integrations with GitHub and AI providers.
• Containerization: Docker and docker-compose ensure replicable and isolated environments.
• Scalability & Maintainability: Rate limiting, prompt automation, and external API modularity hint at a scalable design.
• Infrastructure-as-Code: Use of GitHub Actions and Dockerfiles reflect best practices for automation and continuous deployment.
Relevant Technologies and Tools
• Frontend: Next.js, TypeScript, Tailwind CSS, ShadCN UI components.
• Backend: FastAPI (Python), Docker containerization, Nginx configuration, prompt engineering with a strong reliance on AI services.
• Database: PostgreSQL integrated using Drizzle ORM.
• External APIs: OpenAI o3-mini, Anthropic API, GitHub API.
• CI/CD: GitHub Actions for automation.
• Deployment: Vercel for frontend and EC2 for backend.