# nimbleturkiye/quovote architecture

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

- Interactive diagram: https://gitdiagram.com/nimbleturkiye/quovote
- Repository: https://github.com/nimbleturkiye/quovote

## Overview

##### Main Components
- Frontend:
- Built with Vue.js (evidenced by files like App.vue, router.js, and Vue-specific configurations).
- Contains assets, components, views, and state management files, indicating a clear MVC or component-based design.
- Backend:
- A Node.js/Express application (files such as app.js, bootstrap.js, and routes under backend/src/routes).
- Contains directories for models (event, question, singularity, user) which suggest business logic encapsulation.
- Includes utility libraries like email verification plugins, rate limiters, and singularity checks.
- Has configurations for Docker (Dockerfile, dev.Dockerfile) and ESLint/Prettier settings.
- Email Service:
- Email functionality is defined under backend/src/lib/email, with templates and verification plugins.
- Email configuration details are expected to be set up via environment variables (as mentioned in the README).
- Docker Deployment:
- Dockerfiles are present in both frontend and backend directories, plus a docker-compose.yml at the root to orchestrate services.
- External Services & Integrations:
- The README hints at using mailtrap.io for testing email, indicating integration with external SMTP services.
- A potential socket connection (file: backend/src/socket-connection.js) for real-time features, if applicable.

##### Relationships and Interactions
- The frontend sends HTTP (or WebSocket) requests to the backend.
- The backend exposes REST APIs (and possibly socket connections) to manage Q&A sessions, user registration, and event protection.
- The backend interacts with data models (in models/) to process events, questions, and user singularity.
- An internal email service (within the backend) handles email verifications using templates, and interacts with an external SMTP server.
- Docker Compose orchestrates the frontend and backend services, ensuring they can communicate (e.g., the frontend using its .env configuration to call the backend API).

##### Architectural Patterns and Technologies
- Separation of Concerns: The clear division between frontend and backend components ensures clarity and modularity.
- MVC / Component-Based Architecture:
- Backend uses routes, models, and libraries structured logically.
- Frontend uses components, views, and a store (state management) that aligns with modern Vue.js practices.
- Docker-Based Deployment: Multiple Dockerfiles and a docker-compose configuration highlight containerized deployment with environment variable management.
- Email Verification and Rate Limiting Modules: Custom libraries indicate usage of middleware for additional security and user validation.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% Deployment Layer
  subgraph "Deployment"
    direction TB
    DC["Docker/Docker Compose"]:::docker
    FE["QuoVote Frontend (Vue.js)"]:::frontend
    BE["QuoVote Backend (Express/Node.js)"]:::backend
    DC --> FE
    DC --> BE
  end

  %% Frontend to Backend Communication
  FE -->|"HTTP Requests/Websocket"| BE

  %% Backend Internal Components
  subgraph "Backend Components"
    direction TB
    API["API Endpoints/Routes"]:::backend
    BL["Business Logic (Controllers/Services)"]:::backend
    DM["Data Models (Event,Question,User,Singularity)"]:::backend
    UL["Utility Libraries (RateLimiter,SingularityChecker)"]:::backend
    ES["Email Service"]:::email
    SC["Socket Connection"]:::socket
  end

  %% Linking Backend Main Node to Internal Components
  BE -->|"HandlesRequests"| API
  API -->|"Invokes"| BL
  BL -->|"ProcessesData"| DM
  BL -->|"Utilizes"| UL
  BL -->|"TriggersEmail"| ES
  BE -->|"RealTimeUpdates"| SC

  %% External Email Integration
  ES -->|"SendsEmails"| SMTP["External SMTP (Mailtrap.io)"]:::external

  %% Click Event Mappings
  click FE "https://github.com/nimbleturkiye/quovote/tree/master/frontend/"
  click BE "https://github.com/nimbleturkiye/quovote/tree/master/backend/"
  click ES "https://github.com/nimbleturkiye/quovote/tree/master/backend/src/lib/email/"
  click DC "https://github.com/nimbleturkiye/quovote/blob/master/docker-compose.yml"
  click SC "https://github.com/nimbleturkiye/quovote/blob/master/backend/src/socket-connection.js"

  %% Class Styles for Colouring
  classDef frontend fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
  classDef backend fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
  classDef docker fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
  classDef email fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
  classDef external fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
  classDef socket fill:#FFECB3,stroke:#FF6F00,stroke-width:2px;
```
