# glowiep/fullstack-fastapi architecture

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

- Interactive diagram: https://gitdiagram.com/glowiep/fullstack-fastapi
- Repository: https://github.com/glowiep/fullstack-fastapi

## Overview

##### Project Overview
This is a full-stack web application built with FastAPI backend and a React/TypeScript frontend, using PostgreSQL as the database. The project follows a modern web architecture with clear separation of concerns.

##### Main Components

A. Frontend Layer:
- React/TypeScript Application (indicated by tsconfig.json and vite.config.ts)
- Key components:
- Authentication pages (Login)
- Dashboard
- Home page
- Static assets handling

B. Backend Layer (FastAPI):
- API Layer (v1)
- Core Services
- Security Layer
- Database Layer
- Dependencies
- Models & Schemas

C. Database Layer:
- PostgreSQL Database

##### Connection Flows

- Frontend → Backend API calls
- API → Core Services interactions
- Security layer intercepting requests
- Database interactions
- Rate limiter middleware flow

##### Detailed Component Breakdown

**Frontend:**
**[React/TypeScript App]**
- Routes
- Pages
- Auth
- Dashboard
- Home
- Assets

**Backend:**
**[FastAPI Application]**
- API (v1)
- Endpoints
- Base
- Doc
- Message
- Core
- Config
- Middleware
- Routers
- Security
- Authentication
- Authorization
- Database Layer
- Models
- CRUD Operations

**Database:**
**[PostgreSQL]**

##### Additional Elements

Include:
- Environment configuration flow (.env)
- Testing components
- Build/deployment flow (Dockerfile, zeabur_fastapi.yaml)
- External service connections

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph Client
        FE[React Frontend]
        Router[Router]
        Auth[Authentication Pages]
        Dashboard[Dashboard]
        Home[Home]
        Assets[Static Assets]
        
        FE --> Router
        Router --> Auth
        Router --> Dashboard
        Router --> Home
        FE --> Assets
    end

    subgraph "Application Server"
        API[API Layer v1]
        Core[Core Services]
        Security[Security Layer]
        Dependencies[Dependencies]
        RateLimiter[Rate Limiter]
        Models[Data Models]
        Schemas[Data Schemas]
        CRUD[CRUD Operations]
        Config[Configuration]
        Middleware[API Middleware]
        Auth_Service[Authentication Service]
        Auth_Z[Authorization Service]
        Lifespan[Application Lifecycle]
        Testing[API Testing]

        API --> Core
        Security --> API
        Dependencies --> API
        RateLimiter --> API
        Core --> Models
        Core --> Schemas
        Core --> CRUD
        Core --> Config
        Core --> Middleware
        Security --> Auth_Service
        Security --> Auth_Z
        Core --> Lifespan
        Testing -.-> API
    end

    subgraph "Data Layer"
        DB[(PostgreSQL Database)]
        CRUD --> DB
        Models --> DB
    end

    Client --> API
    
    click FE "https://github.com/glowiep/Fullstack-FastAPI/tree/main/frontend/src"
    click Auth "https://github.com/glowiep/Fullstack-FastAPI/tree/main/frontend/src/pages/Auth"
    click Dashboard "https://github.com/glowiep/Fullstack-FastAPI/blob/main/frontend/src/pages/Dashboard.tsx"
    click Home "https://github.com/glowiep/Fullstack-FastAPI/blob/main/frontend/src/pages/Home.tsx"
    click Router "https://github.com/glowiep/Fullstack-FastAPI/blob/main/frontend/src/routes.tsx"
    click API "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/fastapi/api/v1/endpoints"
    click Core "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/fastapi/core"
    click Security "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/security"
    click Dependencies "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/fastapi/dependencies/database.py"
    click RateLimiter "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/fastapi/dependencies/rate_limiter.py"
    click Models "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/fastapi/models"
    click Schemas "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/fastapi/schemas"
    click CRUD "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/fastapi/crud"
    click Config "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/fastapi/core/config.py"
    click Middleware "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/fastapi/core/middleware.py"
    click Auth_Service "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/security/authentication.py"
    click Auth_Z "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/security/authorization.py"
    click Lifespan "https://github.com/glowiep/Fullstack-FastAPI/blob/main/backend/fastapi/core/lifespan.py"
    click Testing "https://github.com/glowiep/Fullstack-FastAPI/tree/main/backend/tests"

    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef backend fill:#4CAF50,stroke:#2E7D32,color:white
    classDef database fill:#FF9800,stroke:#F57C00,color:white
    classDef security fill:#F44336,stroke:#D32F2F,color:white

    class FE,Router,Auth,Dashboard,Home,Assets frontend
    class API,Core,Dependencies,Models,Schemas,CRUD,Config,Middleware,Lifespan,Testing backend
    class DB database
    class Security,RateLimiter,Auth_Service,Auth_Z security
```
