# mohamedamine050/findini architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedamine050/findini
- Repository: https://github.com/mohamedamine050/findini

## Overview

1. **Overall shape**
   - This repo is a two-tier crowdfunding system called **Findini**:
     - a **Node.js/Express backend API** in `backend/`
     - a **React Native + Expo mobile app** in `Frontend/` and a near-duplicate copy in `my-app/`
   - The mobile app consumes the API over HTTP; the backend owns authentication, persistence, and file uploads.

2. **Backend boundary**
   - `backend/server.js` is the entry point.
   - `backend/config/db.js` connects the app to **MySQL**.
   - The backend is organized in classic layers: **routes → controllers → middleware → storage**.

3. **API surface**
   - Routes are split by domain:
     - `routes/auth.js` for signup/login/profile
     - `routes/user.js` for user administration
     - `routes/categories.js` for project categories
     - `routes/projects.js` for crowdfunding projects
   - This means the main backend architecture is a REST API centered on **users, categories, and projects**.

4. **Business logic layer**
   - Controllers in `backend/controllers/` contain the application rules:
     - `authController.js` handles registration, login, logout, and profile updates
     - `categoryController.js` manages category CRUD
     - `projectController.js` manages project listing/creation
     - `userController.js` handles user listing/deletion
   - The controllers are the main place where database and authentication logic meet.

5. **Security and request flow**
   - `backend/middleware/authenticate.js` protects private endpoints with **JWT-based auth**.
   - `bcryptjs` is used for password hashing per the README.
   - The expected flow is: login/register → issue JWT → client stores token → authenticated requests include that token for protected routes.

6. **File upload and static content**
   - `backend/middleware/upload.js` handles multipart uploads, likely using **Multer**.
   - Uploaded images are stored under `backend/public/uploads/` and are meant to be served back as static assets.
   - This is important architecturally because project/category images are not just metadata; they are a separate file-storage concern.

7. **Frontend app structure**
   - The mobile app is split into:
     - `screnn/` for user-facing screens
     - `screenadmin/` for administrator screens
     - `navigation/` for tab/navigation composition
   - `App.js` and `index.js` are the entry points, with `MainTabNavigator.js` defining the main app flow.

8. **Client-side feature areas**
   - User screens cover:
     - login/register
     - home
     - category browsing
     - profile
     - donation history
     - support, terms, privacy
   - Admin screens cover:
     - category management
     - project list/status
     - user list
     - adding categories
   - This implies a role-based UI split even though both roles live in the same mobile codebase.

9. **Client-server data flow**
   - The app likely uses **Axios** to call the backend endpoints listed in the README.
   - Auth state is probably persisted with **AsyncStorage**.
   - Image selection/upload on the client is supported by **expo-image-picker**, then sent to the backend upload middleware.
   - Categories and projects flow from MySQL → controllers → JSON API → mobile screens.

10. **Duplicate mobile app folder**
   - `Frontend/` and `my-app/` appear to contain the same React Native project structure and screen set.
   - For architecture-diagram purposes, treat this as either a duplicated app snapshot or an alternate working copy; the functional architecture is the same.

11. **Operational assets**
   - `backend/public/uploads/` contains persisted uploaded media on the server side.
   - The mobile app also has local `public/` image folders for bundled assets and category artwork.
   - `demo_mobile.mp4`, the GitHub Action workflow, and `untitled1.ipynb` are ancillary and do not change the runtime architecture.

12. **What to diagram**
   - The key diagram should show:
     - mobile client UI split into user/admin screens
     - REST calls into the Express backend
     - auth middleware on protected routes
     - controllers using MySQL
     - upload middleware writing files to `public/uploads`
   - The main trust boundary is between the mobile app and the backend API; the main data boundary is between the API and MySQL/file storage.

Main entry points: [`backend/config/db.js`](https://github.com/mohamedamine050/findini/blob/main/backend/config/db.js) (MySQL), [`backend/server.js`](https://github.com/mohamedamine050/findini/blob/main/backend/server.js) (Server entry), [`backend/controllers/projectController.js`](https://github.com/mohamedamine050/findini/blob/main/backend/controllers/projectController.js) (Project controller), [`backend/middleware/authenticate.js`](https://github.com/mohamedamine050/findini/blob/main/backend/middleware/authenticate.js) (Auth middleware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile client"]
  node_mobile_app["Mobile app<br/>expo client<br/>[App.js]"]
  node_mobile_entry["App entry<br/>bootstrap<br/>[index.js]"]
  node_nav["Main nav<br/>navigation"]
  node_user_screens["User screens<br/>ui screens"]
  node_admin_screens["Admin screens<br/>admin ui"]
  node_api_client["API access<br/>http client"]
end

subgraph group_backend["Backend API"]
  node_server_entry["Server entry<br/>express bootstrap<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>route module<br/>[auth.js]"]
  node_user_routes["User routes<br/>route module<br/>[user.js]"]
  node_category_routes["Category routes<br/>route module<br/>[categories.js]"]
  node_project_routes["Project routes<br/>route module<br/>[projects.js]"]
  node_auth_ctrl["Auth controller<br/>business logic<br/>[authController.js]"]
  node_user_ctrl["User controller<br/>business logic<br/>[userController.js]"]
  node_category_ctrl["Category controller<br/>business logic"]
  node_project_ctrl["Project controller<br/>business logic"]
  node_auth_mw["Auth middleware<br/>jwt guard<br/>[authenticate.js]"]
  node_upload_mw["Upload middleware<br/>multipart handler<br/>[upload.js]"]
end

subgraph group_storage["Data & files"]
  node_db[("MySQL<br/>database<br/>[db.js]")]
  node_uploads["File uploads<br/>object storage"]
end

node_mobile_entry -->|"starts"| node_mobile_app
node_mobile_app -->|"uses"| node_nav
node_nav -->|"routes to"| node_user_screens
node_nav -->|"routes to"| node_admin_screens
node_user_screens -->|"calls"| node_api_client
node_admin_screens -->|"calls"| node_api_client
node_api_client -->|"HTTP"| node_auth_routes
node_api_client -->|"HTTP"| node_category_routes
node_api_client -->|"HTTP"| node_project_routes
node_api_client -->|"HTTP"| node_user_routes
node_server_entry -->|"mounts"| node_auth_routes
node_server_entry -->|"mounts"| node_user_routes
node_server_entry -->|"mounts"| node_category_routes
node_server_entry -->|"mounts"| node_project_routes
node_auth_routes -->|"delegates"| node_auth_ctrl
node_user_routes -->|"delegates"| node_user_ctrl
node_category_routes -->|"delegates"| node_category_ctrl
node_project_routes -->|"delegates"| node_project_ctrl
node_auth_ctrl -->|"protected by"| node_auth_mw
node_user_ctrl -->|"protected by"| node_auth_mw
node_category_ctrl -->|"protected by"| node_auth_mw
node_project_ctrl -->|"protected by"| node_auth_mw
node_auth_ctrl -->|"reads/writes"| node_db
node_user_ctrl -->|"reads/writes"| node_db
node_category_ctrl -->|"reads/writes"| node_db
node_project_ctrl -->|"reads/writes"| node_db
node_project_ctrl -->|"uses"| node_upload_mw
node_upload_mw -->|"stores"| node_uploads
node_db -.->|"separate from"| node_uploads

click node_mobile_app "https://github.com/mohamedamine050/findini/blob/main/Frontend/App.js"
click node_mobile_entry "https://github.com/mohamedamine050/findini/blob/main/Frontend/index.js"
click node_nav "https://github.com/mohamedamine050/findini/blob/main/Frontend/navigation/MainTabNavigator.js"
click node_user_screens "https://github.com/mohamedamine050/findini/tree/main/Frontend/screnn"
click node_admin_screens "https://github.com/mohamedamine050/findini/tree/main/Frontend/screenadmin"
click node_server_entry "https://github.com/mohamedamine050/findini/blob/main/backend/server.js"
click node_auth_routes "https://github.com/mohamedamine050/findini/blob/main/backend/routes/auth.js"
click node_user_routes "https://github.com/mohamedamine050/findini/blob/main/backend/routes/user.js"
click node_category_routes "https://github.com/mohamedamine050/findini/blob/main/backend/routes/categories.js"
click node_project_routes "https://github.com/mohamedamine050/findini/blob/main/backend/routes/projects.js"
click node_auth_ctrl "https://github.com/mohamedamine050/findini/blob/main/backend/controllers/authController.js"
click node_user_ctrl "https://github.com/mohamedamine050/findini/blob/main/backend/controllers/userController.js"
click node_category_ctrl "https://github.com/mohamedamine050/findini/blob/main/backend/controllers/categoryController.js"
click node_project_ctrl "https://github.com/mohamedamine050/findini/blob/main/backend/controllers/projectController.js"
click node_auth_mw "https://github.com/mohamedamine050/findini/blob/main/backend/middleware/authenticate.js"
click node_upload_mw "https://github.com/mohamedamine050/findini/blob/main/backend/middleware/upload.js"
click node_db "https://github.com/mohamedamine050/findini/blob/main/backend/config/db.js"
click node_uploads "https://github.com/mohamedamine050/findini/tree/main/backend/public/uploads"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mobile_app,node_mobile_entry,node_nav,node_user_screens,node_admin_screens,node_api_client toneBlue
class node_server_entry,node_auth_routes,node_user_routes,node_category_routes,node_project_routes,node_auth_ctrl,node_user_ctrl,node_category_ctrl,node_project_ctrl,node_auth_mw,node_upload_mw toneAmber
class node_db,node_uploads toneMint
```

## Components

### Mobile client

React Native + Expo app; `my-app/` is a near-duplicate working copy of `Frontend/`.

- [Mobile app](https://github.com/mohamedamine050/findini/blob/main/Frontend/App.js): expo client · Primary React Native app; duplicated in `Frontend/` and `my-app/`. · `Frontend/App.js`
- [App entry](https://github.com/mohamedamine050/findini/blob/main/Frontend/index.js): bootstrap · Application entrypoint for the mobile runtime. · `Frontend/index.js`
- [Main nav](https://github.com/mohamedamine050/findini/blob/main/Frontend/navigation/MainTabNavigator.js): navigation · Primary tab/navigation composition. · `Frontend/navigation/MainTabNavigator.js`
- [User screens](https://github.com/mohamedamine050/findini/tree/main/Frontend/screnn): ui screens · Login, register, home, profile, categories, and support/legal screens. · `Frontend/screnn`
- [Admin screens](https://github.com/mohamedamine050/findini/tree/main/Frontend/screenadmin): admin ui · Category, project, and user management screens. · `Frontend/screenadmin`
- **API access**: http client · Client-side HTTP calls, token handling, and upload requests.

### Backend API

Express REST service with layered routing, controllers, auth, and upload handling.

- [Server entry](https://github.com/mohamedamine050/findini/blob/main/backend/server.js): express bootstrap · Backend application startup and route mounting. · `backend/server.js`
- [Auth routes](https://github.com/mohamedamine050/findini/blob/main/backend/routes/auth.js): route module · Signup, login, profile, and session endpoints. · `backend/routes/auth.js`
- [User routes](https://github.com/mohamedamine050/findini/blob/main/backend/routes/user.js): route module · User administration endpoints. · `backend/routes/user.js`
- [Category routes](https://github.com/mohamedamine050/findini/blob/main/backend/routes/categories.js): route module · Category CRUD endpoints. · `backend/routes/categories.js`
- [Project routes](https://github.com/mohamedamine050/findini/blob/main/backend/routes/projects.js): route module · Crowdfunding project endpoints. · `backend/routes/projects.js`
- [Auth controller](https://github.com/mohamedamine050/findini/blob/main/backend/controllers/authController.js): business logic · Registration, login, logout, and profile updates. · `backend/controllers/authController.js`
- [User controller](https://github.com/mohamedamine050/findini/blob/main/backend/controllers/userController.js): business logic · User listing and deletion logic. · `backend/controllers/userController.js`
- [Category controller](https://github.com/mohamedamine050/findini/blob/main/backend/controllers/categoryController.js): business logic · Category CRUD and related rules. · `backend/controllers/categoryController.js`
- [Project controller](https://github.com/mohamedamine050/findini/blob/main/backend/controllers/projectController.js): business logic · Project listing and creation logic. · `backend/controllers/projectController.js`
- [Auth middleware](https://github.com/mohamedamine050/findini/blob/main/backend/middleware/authenticate.js): jwt guard · JWT-based protection for private endpoints. · `backend/middleware/authenticate.js`
- [Upload middleware](https://github.com/mohamedamine050/findini/blob/main/backend/middleware/upload.js): multipart handler · Multipart image handling, likely via Multer. · `backend/middleware/upload.js`

### Data & files

MySQL persistence and server-side uploaded media.

- [MySQL](https://github.com/mohamedamine050/findini/blob/main/backend/config/db.js): database · Primary relational datastore. · `backend/config/db.js`
- [File uploads](https://github.com/mohamedamine050/findini/tree/main/backend/public/uploads): object storage · Server-side persisted uploaded media served as static assets. · `backend/public/uploads`

## Connections

- App entry → Mobile app: starts · Bootstraps the mobile app.
- Mobile app → Main nav: uses · Defines primary app navigation.
- Main nav → User screens: routes to · User-facing flows.
- Main nav → Admin screens: routes to · Admin-facing flows.
- User screens → API access: calls · User screens fetch and submit backend data.
- Admin screens → API access: calls · Admin screens manage categories, projects, and users.
- API access → Auth routes: HTTP · Auth-related requests.
- API access → Category routes: HTTP · Category requests.
- API access → Project routes: HTTP · Project requests.
- API access → User routes: HTTP · User administration requests.
- Server entry → Auth routes: mounts · Registers route modules.
- Server entry → User routes: mounts · Registers route modules.
- Server entry → Category routes: mounts · Registers route modules.
- Server entry → Project routes: mounts · Registers route modules.
- Auth routes → Auth controller: delegates · Route handlers forward to business logic.
- User routes → User controller: delegates · Route handlers forward to business logic.
- Category routes → Category controller: delegates · Route handlers forward to business logic.
- Project routes → Project controller: delegates · Route handlers forward to business logic.
- Auth controller → Auth middleware: protected by · Private auth/profile flows require JWT validation.
- User controller → Auth middleware: protected by · Admin user management is guarded.
- Category controller → Auth middleware: protected by · Category management is guarded.
- Project controller → Auth middleware: protected by · Project management may require authenticated access.
- Auth controller → MySQL: reads/writes · User records and credentials.
- User controller → MySQL: reads/writes · User administration data.
- Category controller → MySQL: reads/writes · Category records.
- Project controller → MySQL: reads/writes · Project and crowdfunding data.
- Project controller → Upload middleware: uses · Project assets are uploaded as multipart content.
- Upload middleware → File uploads: stores · Writes image files to server-side upload storage.
- MySQL → File uploads: separate from · Database data and file storage are distinct concerns.
