# atulmy/fullstack-javascript-architecture architecture

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

- Interactive diagram: https://gitdiagram.com/atulmy/fullstack-javascript-architecture
- Repository: https://github.com/atulmy/fullstack-javascript-architecture

## Overview

##### Project Components – Identify and represent the following main elements
- Backend Services:
⁃ API Service (Node.js and Express) under “backend/api”
▸ Runs on PORT 8000; uses JWT authentication and an RPC (or REST) pattern.
⁃ Database Service (MongoDB) inside “backend/database”
▸ Runs on PORT 27017.
⁃ Proxy Service (NGINX) under “backend/proxy”
▸ Listens on standard HTTP/HTTPS ports (80/443) and routes traffic to the appropriate internal services.
- Frontend Applications:
⁃ Landing Website (“frontend/landing”) – Uses React with server-side rendering (Next.js), Material UI, and is configured for PORT 3000.
⁃ Web Application (“frontend/app/web”) – A single-page React app with Redux and React Router, served from PORT 5000.
⁃ Mobile Application (“frontend/app/mobile”) – Built with React Native (for both iOS and Android) with separate native configurations.
- Deployment:
⁃ Docker & Docker Compose (“deployment/docker-compose.yml”)

##### Mapping Relationships and Interactions
⁃ External Requests: Client traffic accessing URLs like example.com (landing), app.example.com (web app), and api.example.com (API) will first hit the NGINX proxy.
⁃ Proxy forwarding: The NGINX container dispatches requests based on the domain/port to the corresponding backend or frontend container.
⁃ Frontend-to-API communication:
▸ The landing, web, and mobile apps all communicate with the API (using the specified API_URL) for data operations.
- Separate network layers for deployment inside Docker Compose, where the containers share an internal network.

##### Architectural Patterns & Design Principles
- Microservices Architecture: Each service (API, database, proxy, frontends) is isolated and can be scaled or updated independently. Emphasize this separation.
- Containerization: Highlight that services are containerized using Docker and orchestrated with Docker Compose.
- API Layer: The backend API encapsulates business logic and exposes endpoints via RPC (or REST) – note JWT authentication and seeding approaches.
- Frontend Separation: Emphasize the distinct concerns:
▸ Landing website for marketing and SEO (with server-side rendering).
▸ Web application for comprehensive user interactions.
▸ Mobile application for native iOS/Android experiences.

- Below, include the NGINX proxy as the entry point.
▸ One side shows the backend ecosystem: API service connected to MongoDB.
- A container/ orchestration block on the side representing Docker Compose, which encapsulates all these services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Clients"
        Clients["Clients (Browsers/Mobile)"]:::client
    end

    Clients -->|"access"| Proxy["NGINX Proxy (80/443)"]:::infra

    subgraph "Backend Services"
        API["Backend API (Node.js/Express, Port 8000)"]:::backend
        DB["MongoDB (Port 27017)"]:::backend
    end

    Proxy -->|"routes API"| API
    API <-->|"API<->DB"| DB

    subgraph "Frontend Applications"
        Landing["Landing (SSR, Next.js, Port 3000)"]:::frontend
        Web["Web App (SPA, Port 5000)"]:::frontend
        Mobile["Mobile App (React Native)"]:::frontend
    end

    Proxy -->|"routes Frontend"| Landing
    Proxy -->|"routes Frontend"| Web
    Proxy -->|"routes Frontend"| Mobile

    Landing -->|"calls API"| API
    Web -->|"calls API"| API
    Mobile -->|"calls API"| API

    D["Deployment (Docker Compose)"]:::deploy

    D ---|"containerizes"| Proxy
    D ---|"containerizes"| API
    D ---|"containerizes"| DB
    D ---|"containerizes"| Landing
    D ---|"containerizes"| Web
    D ---|"containerizes"| Mobile

    click API "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/backend/api/src/index.js"
    click DB "https://github.com/atulmy/fullstack-javascript-architecture/tree/master/backend/database/Dockerfile"
    click Proxy "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/backend/proxy/nginx.conf"
    click Landing "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/frontend/landing/next.config.js"
    click Web "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/frontend/app/web/src/index.js"
    click Mobile "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/frontend/app/mobile/index.js"
    click D "https://github.com/atulmy/fullstack-javascript-architecture/blob/master/deployment/docker-compose.yml"

    classDef client fill:#AED6F1,stroke:#2E86C1,stroke-width:2px,color:#1B4F72;
    classDef infra fill:#F9E79F,stroke:#F4D03F,stroke-width:2px,color:#7D6608;
    classDef backend fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px,color:#641E16;
    classDef frontend fill:#D5F5E3,stroke:#27AE60,stroke-width:2px,color:#186A3B;
    classDef deploy fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px,stroke-dasharray: 5 5,color:#4A235A;
```
