# giselearaujos/fiap-enterprise-challange-social-life-ring architecture

> Architecture diagram of the GitHub repository giselearaujos/fiap-enterprise-challange-social-life-ring, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/giselearaujos/fiap-enterprise-challange-social-life-ring
- Repository: https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring

## Overview

##### Project type and purpose
- From the README and folder names, this is a full-stack “Task Management” / social-engagement app with three distinct deliverables:
- A React Native / Expo mobile client (in mobile-app/)
- A static web client (HTML/CSS in web-app/) that could evolve into a ReactJS front end
- A Node.js + Express + TypeScript REST API backed by MongoDB (in web-api/)
- The business goal is to let users create, view and manage “tasks” (or social-impact actions) across mobile and web.

##### File structure
- Top-level folders:
- mobile-app/ – React Native + Expo, using Next-style app router (app/+*.tsx), custom components, screens, and a tasks-manager API service.
- web-api/ – Express server with controllers (health, tasks), a database layer (connection, entities), HTTP routing, and error handling.
- web-app/ – Static front-end (index.html + style.css + image assets).
- Notice architectural patterns:
- mobile-app/src/services calls the REST API
- web-api/src/controllers implements the API endpoints
- web-api/src/database encapsulates the MongoDB connection and entity definitions
- Config & infra files: Dockerfile for the API, Postman collections, tsconfig.json in each module, .prettierrc, .vscode, babel.config.js.

##### README for additional insights
- Technology stack: Node.js, Express, TypeScript, MongoDB on the back end; ReactJS on the web front end; React Native + Expo on mobile.
- The API is RESTful and documented/testable via Postman.

a. Clients
– Mobile App (React Native + Expo)
– Web App (HTML/CSS or ReactJS)
b. API Layer
– Express Server
– Controllers (health, tasks)
– Routing & HTTP middleware (web-api/src/http)
– Business logic / Entity layer (web-api/src/entities)
c. Data Persistence
– MongoDB cluster (database connection in web-api/src/database)
d. External/Support Tools
– Postman (for API testing)
– Docker (for containerizing the API)
– CI/CD or hosting (optional, not in tree)

##### Relationships and interactions
- Web App → API Server (HTTPS/JSON)
- API Server → MongoDB (native driver over TLS)
- Postman interacting with the API for testing.

##### Architectural patterns & design principles
- REST API pattern (separate controllers, shared error handler, centralized routing)
- 3-tier separation: Presentation (clients), Application (Express controllers + services), Data (MongoDB + entities)
- Client-side service layer (tasks-manager-api.ts) abstracts HTTP calls
- Modular folder structure (controllers, http, database, entities)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Mobile App (React Native + Expo)" 
        direction TB
        MA_Router["Router (Next-style app)"]:::mobile
        MA_Screens["Screens (src/screens)"]:::mobile
        MA_Components["UI Components (src/components)"]:::mobile
        MA_Service["Tasks API Service (src/services/tasks-manager-api.ts)"]:::mobile
    end

    subgraph "Static Web App (HTML/CSS)"
        direction TB
        Web_HTML["index.html"]:::frontend
        Web_CSS["style.css"]:::frontend
        Web_Images["images/"]:::frontend
    end

    %% API Layer
    subgraph "REST API Server (Node.js + Express + TypeScript)" 
        direction TB
        API_Entry["Server Entry (src/index.ts)"]:::backend

        subgraph "HTTP Layer"
            direction TB
            HTTP_Index["http/index.ts"]:::backend
            HTTP_Routes["http/routes.ts"]:::backend
            HTTP_Errors["http/errors.ts"]:::backend
        end

        subgraph "Controllers"
            direction TB
            Ctrl_Health["health-controller.ts"]:::backend
            Ctrl_Tasks["tasks-controller.ts"]:::backend
            Ctrl_Shared["shared.ts"]:::backend
        end

        subgraph "Database Layer"
            direction TB
            DB_Conn["database/connection.ts"]:::backend
            DB_Index["database/index.ts"]:::backend
        end

        subgraph "Entities"
            direction TB
            Ent_Task["task.ts"]:::backend
            Ent_Shared["shared.ts"]:::backend
            Ent_Index["index.ts"]:::backend
        end
    end

    %% Data Persistence
    MongoDB["MongoDB Cluster"]:::db

    %% External Tools
    Postman["Postman Collections"]:::external
    Docker["Dockerfile"]:::external

    %% Connections
    MA_Service -->|"/tasks HTTP/JSON"| API_Entry
    Web_HTML -->|"/tasks HTTP/JSON"| API_Entry
    API_Entry --> HTTP_Index
    HTTP_Index --> HTTP_Routes
    HTTP_Index --> HTTP_Errors
    HTTP_Routes --> Ctrl_Health
    HTTP_Routes --> Ctrl_Tasks
    Ctrl_Tasks --> DB_Conn
    DB_Conn --> MongoDB
    Ctrl_Shared --> Ctrl_Health
    Ctrl_Shared --> Ctrl_Tasks
    DB_Conn --> DB_Index
    DB_Index --> Ent_Task
    DB_Index --> Ent_Shared
    Ent_Index --> Ent_Task
    Ent_Index --> Ent_Shared
    Postman -->|API Testing| API_Entry
    Docker -->|Containerizes| API_Entry

    %% Click Events
    click MA_Router "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/tree/master/mobile-app/app/"
    click MA_Screens "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/tree/master/mobile-app/src/screens/"
    click MA_Components "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/tree/master/mobile-app/src/components/"
    click MA_Service "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/mobile-app/src/services/tasks-manager-api.ts"
    click Web_HTML "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-app/index.html"
    click Web_CSS "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-app/style.css"
    click Web_Images "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/tree/master/web-app/images/"
    click API_Entry "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/index.ts"
    click HTTP_Index "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/http/index.ts"
    click HTTP_Routes "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/http/routes.ts"
    click HTTP_Errors "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/http/errors.ts"
    click Ctrl_Health "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/controllers/health-controller.ts"
    click Ctrl_Tasks "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/controllers/tasks-controller.ts"
    click Ctrl_Shared "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/controllers/shared.ts"
    click DB_Conn "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/database/connection.ts"
    click DB_Index "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/database/index.ts"
    click Ent_Task "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/entities/task.ts"
    click Ent_Shared "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/entities/shared.ts"
    click Ent_Index "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/src/entities/index.ts"
    click Docker "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/tree/master/web-api/Dockerfile"
    click Postman "https://github.com/giselearaujos/fiap-enterprise-challange-social-life-ring/blob/master/web-api/postman/Tasks Manager.postman_collection.json"

    %% Styles
    classDef mobile fill:#D0E8FF,stroke:#0284C7,color:#033E8C
    classDef frontend fill:#E0F7FA,stroke:#00796B,color:#004D40
    classDef backend fill:#E6F4EA,stroke:#2E7D32,color:#1B5E20
    classDef db fill:#FFF3E0,stroke:#FB8C00,color:#E65100
    classDef external fill:#F5F5F5,stroke:#9E9E9E,color:#616161
```
