# luisramongv/crud_vue_and_nestjs architecture

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

- Interactive diagram: https://gitdiagram.com/luisramongv/crud_vue_and_nestjs
- Repository: https://github.com/luisramongv/crud_vue_and_nestjs

## Overview

##### Main Components
- Frontend: Built with Nuxt3, includes pages, components (like Navbar, ConfirmDialog), assets (e.g., Tailwind CSS), plugins (axios), and stores (userStore).
- Database: Although not directly represented in the file tree, the README and Docker Compose point to a PostgreSQL database.
- Docker & Docker Compose: Overseeing deployment and container orchestration.

##### Relationships and Interactions
- The Frontend interacts with the Backend API (HTTP calls) to perform CRUD operations.
- The Backend, built on NestJS, handles business logic and communicates with the PostgreSQL database via Prisma ORM.
- Docker Compose manages the interactions between these containers, ensuring correct networking (service discovery, environment variables).

##### Architectural Patterns and Design Principles
- The Backend uses a modular structure (modules for users, mail, and Prisma) which aligns with the modular/MVC pattern.
- Prisma ORM is used for migration management, schema definitions, and seed data, enforcing a code-first database approach.
- For the Frontend, Nuxt3 is used, which follows a page-driven design providing SSR and potentially static site generation.
- Containerization using Docker signifies a microservice or service-oriented architecture, where each component is independently built and deployed.

##### Specify Relevant Technologies
- Backend: NestJS, Prisma, Docker, Node.js, ESLint, Prettier.
- Frontend: Nuxt3, Tailwind CSS, Vue components, Pinia, Axios plugin.
- Infrastructure: Docker Compose, PostgreSQL (implied from context).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestration Layer
    DC["Docker Compose"]:::docker
    FD["Frontend Dockerfile"]:::docker
    BD["Backend Dockerfile"]:::docker
    DC ---|"Manages"| FD
    DC ---|"Manages"| BD

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        FE["Frontend (Nuxt3)"]:::frontend
        FE --> FP["Pages"]:::frontend
        FP --> FE_Index["index.vue"]:::frontend
        FP --> FE_Dashboard["dashboard.vue"]:::frontend
        FP --> FE_UserTable["UserTable.vue"]:::frontend

        FE --> FC["Components"]:::frontend
        FC --> FE_Navbar["Navbar.vue"]:::frontend
        FC --> FE_Confirm["ConfirmDialog.vue"]:::frontend

        FE --> FA["Assets"]:::frontend
        FA --> FE_Tailwind["tailwind.css"]:::frontend

        FE --> FPl["Plugins"]:::frontend
        FPl --> FE_Axios["axios.js"]:::frontend

        FE --> FS["Stores"]:::frontend
        FS --> FE_UserStore["userStore.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        BE["Backend (NestJS)"]:::backend
        BE --> BA["App Module"]:::backend
        BA --> BE_AppModule["app.module.ts"]:::backend
        BA --> BE_AppController["app.controller.ts"]:::backend
        BA --> BE_AppService["app.service.ts"]:::backend

        BE --> BM["Main Entry"]:::backend
        BM --> BE_MainTS["main.ts"]:::backend

        BE --> BMail["Mail Module"]:::backend
        BMail --> BE_MailModule["mail.module.ts"]:::backend
        BMail --> BE_MailService["mail.service.ts"]:::backend

        BE --> BUsers["Users Module"]:::backend
        BUsers --> BE_UsersController["users.controller.ts"]:::backend
        BUsers --> BE_UsersModule["users.module.ts"]:::backend
        BUsers --> BE_UsersService["users.service.ts"]:::backend

        BE --> BPrisma["Prisma Integration"]:::backend
        BPrisma --> BE_PrismaSchema["schema.prisma"]:::backend
        BPrisma --> BE_Migrations["Migrations"]:::backend
        BPrisma --> BE_Seed["seed.ts"]:::backend
        BPrisma --> BE_PrismaModule["prisma.module.ts"]:::backend
        BPrisma --> BE_PrismaService["prisma.service.ts"]:::backend
    end

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

    %% Interactions
    FE ---|"API_Request"| BE
    BE ---|"DB_Query"| DB

    %% Docker Compose manages core services
    DC ---|"Manages"| FE
    DC ---|"Manages"| BE
    DC ---|"Manages"| DB

    %% Click Events for Frontend
    click FE "https://github.com/luisramongv/crud_vue_and_nestjs/tree/main/frontend"
    click FE_Index "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/pages/index.vue"
    click FE_Dashboard "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/pages/dashboard.vue"
    click FE_UserTable "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/pages/UserTable.vue"
    click FE_Navbar "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/components/Navbar.vue"
    click FE_Confirm "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/components/ConfirmDialog.vue"
    click FE_Tailwind "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/assets/css/tailwind.css"
    click FE_Axios "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/plugins/axios.js"
    click FE_UserStore "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/frontend/stores/userStore.js"
    
    %% Click Events for Backend
    click BE "https://github.com/luisramongv/crud_vue_and_nestjs/tree/main/backend"
    click BE_AppModule "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/app.module.ts"
    click BE_AppController "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/app.controller.ts"
    click BE_AppService "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/app.service.ts"
    click BE_MainTS "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/main.ts"
    click BE_MailModule "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/mail/mail.module.ts"
    click BE_MailService "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/mail/mail.service.ts"
    click BE_UsersController "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/users/users.controller.ts"
    click BE_UsersModule "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/users/users.module.ts"
    click BE_UsersService "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/users/users.service.ts"
    click BE_PrismaSchema "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/prisma/schema.prisma"
    click BE_Migrations "https://github.com/luisramongv/crud_vue_and_nestjs/tree/main/backend/prisma/migrations"
    click BE_Seed "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/prisma/seed.ts"
    click BE_PrismaModule "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/prisma/prisma.module.ts"
    click BE_PrismaService "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/backend/src/prisma/prisma.service.ts"
    
    %% Click Events for Docker & Orchestration
    click DC "https://github.com/luisramongv/crud_vue_and_nestjs/blob/main/docker-compose.yml"
    click BD "https://github.com/luisramongv/crud_vue_and_nestjs/tree/main/backend/Dockerfile"
    click FD "https://github.com/luisramongv/crud_vue_and_nestjs/tree/main/frontend/Dockerfile"

    %% Styles
    classDef frontend fill:#D0E6A5,stroke:#333,stroke-width:2px;
    classDef backend fill:#FFADAD,stroke:#333,stroke-width:2px;
    classDef database fill:#C7CEEA,stroke:#333,stroke-width:2px;
    classDef docker fill:#FFF2CC,stroke:#333,stroke-width:2px;
```
