# yasirali0/full-stack-fastapi-template architecture

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

- Interactive diagram: https://gitdiagram.com/yasirali0/full-stack-fastapi-template
- Repository: https://github.com/yasirali0/full-stack-fastapi-template

## Overview

##### Main Components
- Frontend: Represent the React web client (located in the “frontend” folder). This component is built with modern JavaScript/TypeScript tooling (using Vite, Chakra UI, and Playwright for testing) and interacts with the backend API.
- Backend: Represent the FastAPI application (located in the “backend” folder). Key modules include:
– API Routes: Under “backend/app/api/routes”, which includes endpoints for items, users, login, and utilities.
– Core Services: In “backend/app/core” for configuration management, database connections (using SQLModel) and security (password hashing, JWT).
– Database Migration: The “alembic” folder inside “backend/app” runs migration scripts for the database (PostgreSQL).
– Email Templates: A dedicated module for email templates used in account creation and password resets.
– Testing: A comprehensive suite under “backend/app/tests”, using Pytest.
- Database: Show the PostgreSQL database (mentioned in the README) that interacts with the backend via the ORM (SQLModel).
- External Services & Deployment Tools:
– Reverse Proxy / Load Balancer (Traefik), as described in the README and Docker Compose files.
– Docker and Docker Compose, indicated by multiple Dockerfiles and Compose configuration files.
– GitHub Actions workflows (found in “.github/workflows”) ensuring CI/CD pipeline integration.
– Environment configurations (through .env files, copier settings, and deployment documents).

##### Relationships and Interactions
- The Backend sends emails (using SMTP, as configured in the .env files) for notifications like account recovery.

##### Architectural Patterns and Important Details
- Testing Infrastructure: Optionally include a testing component showing the integration tests with Playwright (frontend) and Pytest (backend) to show continuous quality assurance.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        FE["React Frontend"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE["FastAPI Backend"]:::backend
        subgraph "Backend Components"
            AR["API Routes"]:::backendComp
            CS["Core Services"]:::backendComp
            DM["Database Migration"]:::backendComp
            AC["Alembic Config (alembic.ini)"]:::backendComp
            ET["Email Templates"]:::backendComp
            TS["Backend Tests (Pytest)"]:::backendComp
        end
        BE --> AR
        BE --> CS
        BE --> DM
        DM --> AC
        BE --> ET
        BE --> TS
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        TR["Traefik Reverse Proxy"]:::infra
        DC["Docker Compose"]:::infra
        CI["CI/CD Pipeline"]:::infra
        ENV["Environment Configurations"]:::infra
        SMTP["SMTP Email Service"]:::infra
    end

    %% Database
    DB["PostgreSQL Database"]:::database

    %% Connections between layers
    FE -->|"HTTPSRequest"| TR
    TR -->|"RoutesTo"| BE
    BE -->|"CRUDOperations"| DB
    BE -->|"SendsEmail"| SMTP

    %% Orchestration and configuration
    DC -->|"Orchestrates"| FE
    DC -->|"Orchestrates"| BE
    DC -->|"Orchestrates"| TR
    CI -->|"Triggers"| DC
    ENV -->|"Supplies"| BE
    ENV -->|"Supplies"| SMTP

    %% Click Events
    click FE "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/frontend/"
    click BE "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/"
    click AR "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/app/api/routes/"
    click CS "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/app/core/"
    click DM "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/app/alembic/"
    click AC "https://github.com/yasirali0/full-stack-fastapi-template/blob/master/backend/alembic.ini"
    click ET "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/app/email-templates/"
    click TS "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/backend/app/tests/"
    click TR "https://github.com/yasirali0/full-stack-fastapi-template/blob/master/docker-compose.traefik.yml"
    click DC "https://github.com/yasirali0/full-stack-fastapi-template/blob/master/docker-compose.yml"
    click CI "https://github.com/yasirali0/full-stack-fastapi-template/tree/master/.github/workflows/"
    click ENV "https://github.com/yasirali0/full-stack-fastapi-template/blob/master/.env"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef backendComp fill:#E0FFFF,stroke:#000,stroke-width:1px;
    classDef infra fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef database fill:#FFB6C1,stroke:#000,stroke-width:1px;
```
