# yashurade27/vercel-c architecture

> Architecture diagram of the GitHub repository yashurade27/vercel-c, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yashurade27/vercel-c
- Repository: https://github.com/yashurade27/vercel-c

## Overview

##### Project type and purpose
- This is a full-stack, microservices-style deployment platform (“Vercel Clone”) for React apps.
- The frontend is a React/Vite/Tailwind UI; there are three separate Node.js/TypeScript back-end services (“vercel”, “vercel-request-handler”, “vercel-deploy-service”).
- Core features: file upload, build orchestration (via queues), object storage (Cloudflare R2), and deployment (AWS SDK).

##### File structure
- Top-level:
– README.md (project overview)
– frontend/ (static React app)
– vercel/ (main API entrypoint)
– vercel-request-handler/ (async request processor)
– vercel-deploy-service/ (build & deploy engine)
- Each backend has Express-style src/index.ts, plus aws.ts, utils.ts.
- Redis is used as a queue (implied by “Redis for Queuing System”).
- Cloudflare R2 is used for storing user-uploaded assets and build artifacts.
- Build: uses tsc (TypeScript compiler) and Node.js for each service.

##### README insights
- Frontend runs via `npm run dev` (Vite).
- Backends are started by building (`tsc -b`) then `node dist/index.js`.
- Stack: ReactJS, TypeScript, TailwindCSS, Redis (queue), Cloudflare R2 (object store), Node.js/Express, AWS SDK.

a. Main components (containers):
- Browser / React UI (frontend)
- API Gateway service (“vercel” Express app)
- Redis Queue
- Request Handler service (“vercel-request-handler”)
- Deploy Service (“vercel-deploy-service”)
- Cloudflare R2 (object storage)
- AWS (build & hosting, if used – via aws.ts)
b. Relationships & data flows:
1. User (Browser) → HTTPS → API Gateway (“vercel”)
2. API Gateway handles uploads → writes files to R2 → enqueues a job in Redis
3. Request Handler service pulls job from Redis → performs any preprocessing or validation → enqueues next job or calls Deploy Service
4. Deploy Service picks up build job → uses AWS SDK (see aws.ts) to spin up build environment, compile code, produce static assets → writes build output back to R2 (or AWS S3/CloudFront)
5. API Gateway or a status service can poll Redis or subscribe to job-complete events to report status back to the UI
c. Architectural patterns & design principles:
- Microservices / containerized Node.js services, each with a single responsibility
- Asynchronous, queue-based workflow (Redis)
- Externalized object storage (Cloudflare R2) for decoupling build artifacts from services
- Clear separation: frontend vs. API vs. worker vs. build engine
d. Key technologies & libraries:
- Frontend: React, Vite, TypeScript, TailwindCSS
- API & Workers: Node.js, Express, TypeScript
- Queue: Redis
- Storage: Cloudflare R2 (S3-compatible)
- Build/Deploy: AWS SDK (via aws.ts), Node child processes for tsc, Vite

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend
    subgraph "Frontend Layer"
        Browser["Browser / React UI\n(React, Vite, TS, Tailwind)"]:::frontend
    end

    %% Backend services
    subgraph "Back-end Services"
        APIGateway["API Gateway\n(vercel: Node.js/Express/TS)"]:::backend
        RequestHandler["Request Handler\n(vercel-request-handler: Node.js/Express/TS)"]:::backend
        DeployService["Deploy Service\n(vercel-deploy-service: Node.js/Express/TS)"]:::backend
    end

    %% External systems
    subgraph "External Systems"
        RedisQueue["Redis Queue\n(Redis)"]:::db
        R2["Cloudflare R2\n(Object Storage)"]:::db
        AWS["AWS\n(Build & Hosting via AWS SDK)"]:::external
    end

    %% Connections
    Browser -->|"HTTPS"| APIGateway
    APIGateway -->|"S3 PUT"| R2
    APIGateway -->|"Enqueue job"| RedisQueue
    RequestHandler -->|"Pull job"| RedisQueue
    RequestHandler -->|"Enqueue build job"| RedisQueue
    DeployService -->|"Pull build job"| RedisQueue
    DeployService -->|"Write artifacts"| R2
    DeployService -->|"AWS SDK calls"| AWS
    Browser -->|"Poll status (HTTPS)"| APIGateway

    %% Click Events
    click Browser "https://github.com/yashurade27/vercel-c/tree/main/frontend/"
    click APIGateway "https://github.com/yashurade27/vercel-c/tree/main/vercel/"
    click RequestHandler "https://github.com/yashurade27/vercel-c/tree/main/vercel-request-handler/"
    click DeployService "https://github.com/yashurade27/vercel-c/tree/main/vercel-deploy-service/"
    click R2 "https://github.com/yashurade27/vercel-c/blob/main/vercel/src/files.ts"

    %% Styles
    classDef frontend fill:#fcefa1,stroke:#333,stroke-width:1px
    classDef backend fill:#cfe2f3,stroke:#333,stroke-width:1px
    classDef db fill:#d9ead3,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#f4cccc,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
