# yoteapp/yote architecture

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

- Interactive diagram: https://gitdiagram.com/yoteapp/yote
- Repository: https://github.com/yoteapp/yote

## Overview

##### Project type and purpose
- This is a “super-stack” full-stack application (“Yote”) that delivers:
- A web client (React + Redux)
- A native mobile client (React Native + Redux)
- A Node.js/Express API server (with Passport.js for auth)
- A MongoDB database (via Mongoose)

##### File structure
- Top-level directories:
- /web — React/Redux single-page application
- /mobile/Yote — React Native mobile application
- /server — Node.js/Express REST API
- /docs — project documentation (split into client, mobile, server)
- Each client folder contains its own build/config (e.g., craco, Babel, Gradle, Xcode workspace).
- The server follows an MVC-style structure: /resources (models/controllers/apis), /global (handlers, helpers), plus config files for different environments.

##### Key insights from README
- “Super-stack” = integrated web, mobile, and API layers
- Tech stack: MongoDB/Mongoose, Node/Express/Passport (server), React/React-Router/Redux (web), React Native/Redux (mobile)
- Emphasis on flexibility, extendability, performance, and caching server data in Redux stores.

##### Main components
A. Presentation Layer
- Web Client: React SPA
– Redux Toolkit for state
– React Router for navigation
- Mobile Client: React Native app
– Redux Toolkit for state
– Native modules via Buck/Gradle (Android) and CocoaPods/Xcode (iOS)
B. API Layer
- Node.js + Express server (app.js, index.js)
- Passport.js for authentication flows
- Resource modules (/resources/*): controllers, API routers, Mongoose models
- Error and request handlers (/global/handlers)
- Configuration per environment (development, production, staging)
C. Data Layer
- MongoDB database
- Mongoose ODM for schema definitions and queries
D. (Optional) Infrastructure / DevOps
- Docker (server container)
- nodemon for hot reload
- CI/CD docs in /docs/server/deployment.md

##### Relationships and interactions
- Web Client ↔ HTTP(S) REST API
- User travels through React Router → dispatch Redux actions → invoke api.js → call Express endpoints
- Mobile Client ↔ HTTP(S) REST API
- App.js bootstraps React Native → dispatch Redux actions → use serviceHooks/api.js → call Express endpoints
- API Server ↔ MongoDB
- Express routes → controller → Mongoose model → MongoDB CRUD
- Authentication flow
- Web/Mobile send credentials → Passport middleware → session or JWT → protected resource access

##### Architectural patterns & design principles
- Layered architecture: Presentation → API → Data
- RESTful resource modules (user, product, notification)
- MVC (controllers + models + routers) on server
- Centralized state management (Redux Toolkit) on clients
- Environment-specific configuration (12-factor /config directory)
- Test harness in each layer (/__tests__, jest.config.js)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        subgraph "Web Client (React + Redux)" 
            WebApp["Web Client\nReact + Redux\n• React Router\n• Redux Toolkit"]:::frontend
        end
        subgraph "Mobile Client (React Native + Redux)"
            MobileApp["Mobile Client\nReact Native + Redux\n• serviceHooks"]:::frontend
        end
    end

    subgraph "API Layer"
        APIServer["API Server\nNode.js + Express + Passport\n• /resources\n• /global/handlers\n• /config"]:::backend
    end

    subgraph "Data Layer"
        DB["MongoDB + Mongoose"]:::db
    end

    WebApp -->|"HTTPS REST calls"| APIServer
    MobileApp -->|"HTTPS REST calls"| APIServer
    APIServer -->|"Mongoose queries"| DB

    click WebApp "https://github.com/yoteapp/yote/tree/main/web/"
    click MobileApp "https://github.com/yoteapp/yote/tree/main/mobile/Yote/"
    click APIServer "https://github.com/yoteapp/yote/tree/main/server/"

    classDef frontend fill:#cbe6ff,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#c2f0c2,stroke:#228b22,color:#228b22;
    classDef db fill:#ffe6b3,stroke:#ff8c00,color:#8b4513;
```
