# karlamagueta/parkencantado architecture

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

- Interactive diagram: https://gitdiagram.com/karlamagueta/parkencantado
- Repository: https://github.com/karlamagueta/parkencantado

## Overview

##### Main Components

A. Frontend Layer:
- Static Content Delivery (HTML, CSS, JS)
- User Interface Components:
- Main Site Section (attractions, events, space)
- Contact Forms
- Testimonials Section
- Administrative Interface

B. Backend Layer:
- FastAPI Application Server
- Authentication System (evident from auth.py)
- Admin Panel
- Email Service Integration

C. Database Layer:
- Database System (indicated by db.py)
- Session Management

**[Client Layer]**

- ▼
**[Web Server]**

- ▼
**[Application Layer]**

- ▼
**[Database Layer]**

##### Component Details

A. Client Layer:
- Public Website Interface
- Admin Interface
- Static Assets (CSS/JS/Images)

B. Application Layer (FastAPI):
- Create sections for:
- Route Handlers (main.py)
- Authentication Service (auth.py)
- Admin Controller (admin.py)
- Email Service
- Configuration Management (config.py, settings.toml)

C. Database Layer:
- Database Connection (db.py)
- Session Management (session.py)

##### Flow Representations

- User request flows
- Authentication flows
- Admin operations
- Email sending processes
- Static asset delivery

##### Architectural Patterns to Highlight

- MVC Pattern:
- Models (db.py)
- Views (templates)
- Controllers (main.py, admin.py)
- Service-based architecture for email and authentication
- Static asset organization

##### Additional Notes

- Separation between public and admin areas
- Email notification system
- Test coverage representation
- Configuration dependencies

This structure reflects the project's nature as a web application with both public-facing and administrative components, built with FastAPI and following modern web development practices.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI["Public Website Interface"]:::frontend
        Admin["Admin Interface"]:::frontend
        Static["Static Assets"]:::frontend
    end

    subgraph "Application Layer"
        Routes["Route Handlers"]:::backend
        AuthService["Authentication Service"]:::security
        AdminCtrl["Admin Controller"]:::backend
        EmailSvc["Email Service"]:::service
        Config["Configuration"]:::config
    end

    subgraph "Database Layer"
        DB[(Database)]:::database
        Sessions["Session Management"]:::database
    end

    subgraph "Templates"
        MainTemplates["Main Templates"]:::template
        AdminTemplates["Admin Templates"]:::template
        EmailTemplates["Email Templates"]:::template
    end

    subgraph "Static Assets"
        CSS["CSS Styles"]:::static
        JS["JavaScript"]:::static
        Images["Images"]:::static
    end

    subgraph "Testing"
        Tests["Test Suite"]:::test
    end

    UI --> Routes
    Admin --> AuthService
    Admin --> AdminCtrl
    Routes --> AuthService
    Routes --> EmailSvc
    Routes --> DB
    AdminCtrl --> DB
    AuthService --> Sessions
    EmailSvc --> EmailTemplates
    UI --> MainTemplates
    Admin --> AdminTemplates
    UI --> Static
    Admin --> Static
    Static --> CSS
    Static --> JS
    Static --> Images

    %% Click Events
    click Static "https://github.com/karlamagueta/parkencantado/tree/main/app/static/"
    click CSS "https://github.com/karlamagueta/parkencantado/tree/main/app/static/css/"
    click JS "https://github.com/karlamagueta/parkencantado/tree/main/app/static/js/"
    click Images "https://github.com/karlamagueta/parkencantado/tree/main/app/static/img/"
    click MainTemplates "https://github.com/karlamagueta/parkencantado/tree/main/app/templates/"
    click AdminTemplates "https://github.com/karlamagueta/parkencantado/tree/main/app/templates/admin/"
    click EmailTemplates "https://github.com/karlamagueta/parkencantado/tree/main/app/templates/email/"
    click AuthService "https://github.com/karlamagueta/parkencantado/blob/main/app/auth.py"
    click AdminCtrl "https://github.com/karlamagueta/parkencantado/blob/main/app/admin.py"
    click DB "https://github.com/karlamagueta/parkencantado/blob/main/app/db.py"
    click Sessions "https://github.com/karlamagueta/parkencantado/blob/main/app/session.py"
    click Routes "https://github.com/karlamagueta/parkencantado/blob/main/app/main.py"
    click Config "https://github.com/karlamagueta/parkencantado/blob/main/app/config.py"
    click Tests "https://github.com/karlamagueta/parkencantado/tree/main/tests/"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white
    classDef template fill:#1abc9c,stroke:#16a085,color:white
    classDef static fill:#34495e,stroke:#2c3e50,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef test fill:#e67e22,stroke:#d35400,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend"]:::frontend
        Backend["Backend"]:::backend
        DatabaseComp["Database"]:::database
        SecurityComp["Security"]:::security
        ServiceComp["Service"]:::service
        TemplateComp["Template"]:::template
        StaticComp["Static"]:::static
        ConfigComp["Config"]:::config
        TestComp["Test"]:::test
    end
```
