# andreypividori/polytechtours-padelstarterkit architecture

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

- Interactive diagram: https://gitdiagram.com/andreypividori/polytechtours-padelstarterkit
- Repository: https://github.com/andreypividori/polytechtours-padelstarterkit

## Overview

##### Project type and purpose
- This is a full-stack web application "Corpo Padel" for managing corporate padel tournaments.
- Tech stack:
- Backend: FastAPI with JWT auth, SQLAlchemy/SQLite, Pytest tests
- Frontend: Vue 3 + Vue Router + Pinia, Axios client, Tailwind CSS, Cypress E2E

##### Key high-level components
- User’s Browser (UI)
- Frontend Application (Vue)
- Components, Views, Router, Pinia store, Axios service
- Backend Application (FastAPI)
- API layer (auth endpoints, dependency injection)
- Core (configuration, security/jwt, hashing, brute-force lockout)
- Models (SQLAlchemy ORM)
- Schemas (Pydantic)
- Database connector (SQLite)
- Persistent Store: SQLite file
- External/Internal services
- JWT issuer/validator (built into backend)
- Environment/config service (.env files)
- Test suites (unit tests + E2E) – optional to include as side-components

##### Relationships and data-flow
- Browser → Frontend (served via Vite dev server or static hosting)
- Frontend → Backend: HTTPS requests via Axios interceptors, sending JWT in headers
- Backend → Database: SQLAlchemy sessions read/write to SQLite file
- Backend (Security module) ↔ JWT tokens (create/verify)
- Frontend store (Pinia) persists auth state and routes guard navigation

##### Architectural patterns & design principles
- Clear separation of concerns:
- Presentation (Vue components + router guards)
- State management (Pinia)
- Service layer (Axios wrapper with interceptors)
- API layer / business logic (FastAPI routers, dependency injection)
- Data access (SQLAlchemy models + database module)
- Layered architecture in backend:
- API → core services → data access → persistence
- Token-based stateless authentication (JWT)
- Configuration via environment variables (.env)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Entities
    Browser["User Browser"]:::client

    subgraph "Frontend (Vue 3)" 
        direction TB
        FE_Main["main.js"]:::frontend
        FE_Components["Components"]:::frontend
        FE_Views["Views"]:::frontend
        FE_Router["Router"]:::frontend
        FE_Store["Pinia Store"]:::frontend
        FE_API["API Service"]:::frontend
        FE_Styles["main.css & tailwind.config.js"]:::frontend
    end

    subgraph "Backend (FastAPI)"
        direction TB
        BE_Main["app/main.py"]:::backend
        subgraph "API Layer"
            direction TB
            BE_Auth["auth.py"]:::backend
            BE_Deps["deps.py"]:::backend
        end
        subgraph "Core Services"
            direction TB
            BE_Config["config.py"]:::backend
            BE_Security["security.py"]:::backend
        end
        subgraph "Data Access"
            direction TB
            BE_DBConn["database.py"]:::backend
            BE_Models["models.py"]:::backend
            BE_Schemas["schemas/auth.py"]:::backend
        end
        BE_DBFile["padel_corpo.db"]:::db
    end

    %% Relationships
    Browser -->|"UI Interactions"| FE_Components
    Browser --> FE_Views
    FE_Components -->|renders| FE_Views
    FE_Views -->|navigates via Router| FE_Router
    FE_Router -->|guards/auth| FE_Store
    FE_Store -->|stores JWT| FE_API
    FE_API -->|HTTP REST + JWT| BE_Main
    BE_Main -->|routes to| BE_Auth
    BE_Auth -->|uses deps| BE_Deps
    BE_Auth -->|issues/verifies JWT| BE_Security
    BE_Security -->|reads config| BE_Config
    BE_Main -->|DB session| BE_DBConn
    BE_DBConn -->|ORM operations| BE_Models
    BE_Models -->|validate/input| BE_Schemas
    BE_DBConn -->|reads/writes| BE_DBFile

    %% Click Events - Frontend
    click FE_Main "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/frontend/src/main.js"
    click FE_Components "https://github.com/andreypividori/polytechtours-padelstarterkit/tree/main/frontend/src/components"
    click FE_Views "https://github.com/andreypividori/polytechtours-padelstarterkit/tree/main/frontend/src/views"
    click FE_Router "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/frontend/src/router/index.js"
    click FE_Store "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/frontend/src/stores/auth.js"
    click FE_API "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/frontend/src/services/api.js"
    click FE_Styles "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/frontend/src/assets/main.css"
    click FE_Styles "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/tailwind.config.js"

    %% Click Events - Backend
    click BE_Main "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/main.py"
    click BE_Auth "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/api/auth.py"
    click BE_Deps "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/api/deps.py"
    click BE_Config "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/core/config.py"
    click BE_Security "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/core/security.py"
    click BE_DBConn "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/database.py"
    click BE_Models "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/models/models.py"
    click BE_Schemas "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/app/schemas/auth.py"
    click BE_DBFile "https://github.com/andreypividori/polytechtours-padelstarterkit/blob/main/backend/padel_corpo.db"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef frontend fill:#bbf,stroke:#333,stroke-width:1px
    classDef backend fill:#bfb,stroke:#333,stroke-width:1px
    classDef db fill:#fbf,stroke:#333,stroke-width:1px
```
