# fiyinfoluwaafol/splitease architecture

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

- Interactive diagram: https://gitdiagram.com/fiyinfoluwaafol/splitease
- Repository: https://github.com/fiyinfoluwaafol/splitease

## Overview

##### Main Components
- Frontend Component:
- Represents the web interface built with modern frameworks (React/Vite). Include key pages/components such as Login/Register forms, Dashboard, Group Expense Management, and NotFound screens.
- Backend Component:
- Built with Node.js/Express (as indicated by app.js and the route files), and includes core API endpoints (e.g., auth routes, main application routes).
- Submodules like middleware (e.g., JWT authentication), utility services (e.g., emailService for notifications), and route organization.
- Database:
- Represents the persistence layer, managed via Prisma ORM (schema.prisma and migrations are present).
- External Services & Integrations:
- Although not fully implemented yet, reserve space to denote integrations like Payment Gateways (PayPal, Venmo, etc.), AI/OCR modules, and notification systems (email/SMS using services like SendGrid or Twilio).

##### Relationships and Interactions
- Middleware (authentication) as a processing layer that intercepts API calls.

##### Architectural Patterns & Design Principles
- Demonstrate separation of concerns by showing the distinct frontend and backend layers.
- Modularization within the backend using subcomponents (routes, middleware, utils) to emphasize maintainability.
- Use of an ORM (Prisma) as the abstraction layer over the database.
- If needed, include a “Service Layer” within the backend to indicate business logic (for bill splitting, group management, payment tracking).

##### Essential Technologies & Frameworks
- Frontend: React, Vite, CSS Modules (or similar) – as seen by .jsx and .css files for various components.
- Backend: Node.js/Express for server handling, JWT for authentication (as visible with middleware), package management via npm (package.json files).
- Database: Prisma ORM managing schema migrations and database access.
- Additional: Mention placeholders for external payment gateways and notification services that are part of the project plan.

##### Final Touches
- Verify consistency by cross-referencing the file tree (which clearly separates “backend” and “frontend”) and the project plan in the README (which outlines features and integration points).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend (React/Vite)"
        F0["Frontend App"]:::frontend
        F1["Login/Register Page"]:::frontend
        F2["Dashboard Page"]:::frontend
        F3["Group Expense Management Page"]:::frontend
        F4["NotFound Page"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend API (Express/Node.js)"
        B1["API Server"]:::backend
        B2["Middleware (JWT Authentication)"]:::backend
        B3["Auth Routes"]:::backend
        B4["Main Routes"]:::backend
        B5["Utility Service (Email Notifications)"]:::backend
    end

    %% Database Layer (Prisma ORM)
    subgraph "Database (Prisma ORM)"
        D2["Prisma Schema"]:::database
        D3["Prisma Migrations"]:::database
    end

    %% External Services
    E1["External Services (Payment,AI/OCR,Notifications)"]:::external

    %% Frontend internal flows
    F0 --> F1
    F0 --> F2
    F0 --> F3
    F0 --> F4

    %% Frontend to Backend interactions
    F1 -->|"request_login"| B3
    F2 -->|"dashboard_request"| B4
    F3 -->|"expense_data"| B4
    F0 -->|"API_call"| B1

    %% Backend internal flows
    B1 -->|"auth_check"| B2
    B2 -->|"dispatch_to"| B3
    B2 -->|"dispatch_to"| B4
    B3 -->|"triggerCRUD"| D2
    B4 -->|"triggerCRUD"| D2
    B3 -->|"trigger_email"| B5
    B4 -->|"trigger_email"| B5
    B1 -->|"external_integration"| E1
    B5 -->|"send_notification"| E1

    %% Click Events
    click F0 "https://github.com/fiyinfoluwaafol/splitease/tree/main/frontend/"
    click B1 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/app.js"
    click B3 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/routes/auth.js"
    click B4 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/routes/index.js"
    click B2 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/middlewares/authenticateToken.js"
    click B5 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/utils/emailService.js"
    click D2 "https://github.com/fiyinfoluwaafol/splitease/blob/main/backend/prisma/schema.prisma"
    click D3 "https://github.com/fiyinfoluwaafol/splitease/tree/main/backend/prisma/migrations"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef database fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
