# bader-idris/nuxt3-fullstack-portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/bader-idris/nuxt3-fullstack-portfolio
- Repository: https://github.com/bader-idris/nuxt3-fullstack-portfolio

## Overview

##### Main Components
- Frontend: The “client” directory is your Nuxt 3 application. It contains pages (e.g., index, about, projects), components (both global and specific ones like SnakeGame), composables, plugins, configuration for internationalization (i18n), assets (CSS, SCSS, sounds, images, etc.), and more.
- Backend: The “server” directory consists of API routes (under “server/api/v1”), authentication logic (social logins, reset-password, verification, etc.), middleware, models (especially bridging Mongo and possibly other databases), utilities, and websocket support.
- Database & Data Stores: Look at the “server/models” folder (with MongoDB schema files) and configuration for Mongo, PostgreSQL (psql config), and Redis. These indicate a multi-database environment.
- Docker & Deployment Infrastructure: Notice several Docker-related files (e.g., a.prod-certbot.yml, b.dev.yml) and configurations for services like Nginx, Certbot (SSL renewal), and fail2ban for security.
- Mobile: The README also discusses setting up mobile environments with Capacitor. While there isn’t a separate “mobile” folder, configuration files (like capacitor.config.ts) and instructions for adding Android/iOS support indicate that mobile builds are integrated.
- External Services: The configuration hints at external integrations such as social authentication (Facebook, Google), email sending (using nodemailer utilities), and Certbot for SSL certificates.

##### Relationships & Interactions
- The Nuxt frontend communicates with the backend API services via REST endpoints defined in the “server/api/v1” directory.
- The backend API interacts with various databases (MongoDB, Postgres, Redis) as indicated by the separate configuration folders and model definitions.
- External authentication services (e.g., Facebook, Google) interact through dedicated endpoints and callback handlers.
- The Docker configuration ties together multiple containers for the client, server, Nginx reverse proxy, certificate management, and security (e.g., fail2ban).
- Mobile applications (built via Capacitor) will interface with the same backend APIs, and their assets are managed within the client’s assets and Capacitor configuration files.

##### Architectural Patterns & Design Principles
- Clear separation of concerns: The client (Nuxt 3) is completely decoupled from the server (API endpoints, business logic, data models), which enables independent scaling or modifications.
- MVC pattern on the backend: Organized APIs, middleware, models, and utilities indicate a pattern that separates data representation, business logic, and control logic.
- Containerization and orchestration: Docker files and configurations underscore a microservices or multi-container approach, ensuring that each part of the system (such as the server, Nginx reverse proxy, cron jobs for certificate renewal) can be deployed and managed independently.
- Internationalization: i18n directories show that localization is a first-class requirement in the design of the client interface.
- Extensibility: The modular folder structures allow for adding new features, components, or endpoints without disrupting the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        F1("Nuxt Frontend (Client)"):::frontend
    end

    %% Mobile/Capacitor
    subgraph "Mobile/Capacitor"
        M("Mobile/Capacitor Support"):::mobile
    end

    %% Backend Layer
    subgraph "Backend Layer"
        B("Backend API Server"):::backend
        E("API Endpoints"):::backend
        A("Auth Endpoints"):::backend
    end

    %% Database & Data Models
    subgraph "Database & Data Models"
        D1("MongoDB Models"):::database
        D2("PostgreSQL Config"):::database
        D3("Redis Config"):::database
    end

    %% Docker & Deployment Infrastructure
    subgraph "Docker & Deployment"
        Dp1("Docker Prod Certbot"):::docker
        Dd("Docker Dev"):::docker
        subgraph "Server Docker Config"
            Sd1("Dockerfile"):::docker
            Sd2("Bun Dockerfile"):::docker
        end
        Nc("Nginx & Certbot"):::docker
    end

    %% External Services
    subgraph "External Services"
        subgraph "Social Authentication"
            Fa("Facebook Auth"):::external
            Fc("Facebook Callback"):::external
            Ga("Google Auth"):::external
            Gc("Google Callback"):::external
        end
        subgraph "Email Utilities"
            E1("nodemailerConfig"):::external
            E2("sendEmail"):::external
            E3("sendResetPasswordEmail"):::external
            E4("sendVerificationEmail"):::external
        end
    end

    %% Connections
    F1 -->|"calls"| E
    M -->|"calls"| E
    B --> E
    E --> A
    A -->|"uses"| Fa
    A -->|"uses"| Fc
    A -->|"uses"| Ga
    A -->|"uses"| Gc
    E -->|"queries"| D1
    E -->|"queries"| D2
    E -->|"queries"| D3
    E -->|"sends"| E1
    E -->|"sends"| E2
    E -->|"sends"| E3
    E -->|"sends"| E4

    Dp1 --> F1
    Dp1 --> B
    Dd --> F1
    Dd --> B
    Sd1 --> B
    Sd2 --> B
    Nc --> B

    %% Styles
    classDef frontend fill:#a2d9ce,stroke:#1abc9c,stroke-width:2px;
    classDef backend fill:#f9e79f,stroke:#f1c40f,stroke-width:2px;
    classDef database fill:#fadbd8,stroke:#e74c3c,stroke-width:2px;
    classDef docker fill:#d6eaf8,stroke:#3498db,stroke-width:2px;
    classDef mobile fill:#f5b7b1,stroke:#e67e22,stroke-width:2px;
    classDef external fill:#d5f5e3,stroke:#2ecc71,stroke-width:2px;

    %% Click Events
    click F1 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/client/"
    click B "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/"
    click E "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/api/v1/"
    click A "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/api/v1/auth/"
    click D1 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/models/mongo/"
    click D2 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/config/psql/"
    click D3 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/config/redis/"
    click Dp1 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/a.prod-certbot.yml"
    click Dd "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/b.dev.yml"
    click Sd1 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/config/Dockerfile"
    click Sd2 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/config/bun.Dockerfile"
    click Nc "https://github.com/bader-idris/nuxt3-fullstack-portfolio/tree/bader/server/config/nginx/"
    click M "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/capacitor.config.ts"
    click Fa "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/api/v1/auth/facebook.ts"
    click Fc "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/api/v1/auth/facebook/callback.ts"
    click Ga "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/api/v1/auth/google.ts"
    click Gc "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/api/v1/auth/google/callback.ts"
    click E1 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/utils/nodemailerConfig.ts"
    click E2 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/utils/sendEmail.ts"
    click E3 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/utils/sendResetPasswordEmail.ts"
    click E4 "https://github.com/bader-idris/nuxt3-fullstack-portfolio/blob/bader/server/utils/sendVerificationEmail.ts"
```
