# edizo-io/main_website architecture

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

- Interactive diagram: https://gitdiagram.com/edizo-io/main_website
- Repository: https://github.com/edizo-io/main_website

## Overview

#### Purpose and entry points
This is a three-part Edizo-style site platform: a public marketing/application portal, an authenticated admin CMS, and a Node backend API. Public and admin SPAs boot from `client/src/main.jsx` and `admin/src/main.jsx`; the API server entry point is `backend/index.js`.

#### Public client
The public Vite/React application composes landing-page sections and routed content for services, projects, internships, contact, and user dashboard flows. Its top-level route/application shell is `client/src/App.jsx`; page-level experiences live under `client/src/pages/Home.jsx`, `client/src/pages/ServicesPage.jsx`, and `client/src/pages/InternshipApplication.jsx`. Shared site state, including content and authentication boundaries, is represented by `client/src/context/SiteContext.jsx` and `client/src/context/AuthContext.jsx`.

#### Admin CMS
A separate Vite/React admin SPA manages site content and operational records. Authentication and protected-admin state originate in `admin/src/context/AuthContext.jsx`, while layout/navigation is centralized in `admin/src/layouts/AdminLayout.jsx`. The principal management surfaces cover home/about/contact/portfolio content, services, internships, applications, requests, users, and settings; representative paths are `admin/src/pages/ManageHomeView.jsx`, `admin/src/pages/ServicesView.jsx`, and `admin/src/pages/InternshipApplicationsView.jsx`.

#### API and authorization boundary
The backend exposes domain-specific HTTP route modules, with route-to-controller separation for CMS content, portfolio, media, analytics, settings, contacts, services, internships/jobs, and users. Core API assembly is `backend/index.js`; administrative endpoints are grouped in `backend/routes/adminRoutes.js`; authorization is enforced through `backend/middleware/authMiddleware.js`. Controllers such as `backend/controllers/pagesController.js`, `backend/controllers/mediaController.js`, and `backend/controllers/siteSettingsController.js` form the API-facing content boundary consumed by the two SPAs.

#### Content and operational data flow
Admin users authenticate, then create or update CMS entities and operational records through admin API routes. The backend persists those changes; the public client retrieves the resulting page, portfolio, service, internship, and site-setting data for display and application/contact flows. Public submissions enter dedicated backend routes including `backend/routes/contactRoutes.js`, `backend/routes/internshipRoutes.js`, and `backend/routes/serviceRoutes.js`; admin views provide the review side of those workflows.

#### Persistence, media, and lifecycle
The backend has an explicit relational database layer in `backend/db.js`, with initial schema and subsequent CMS/portfolio upgrades in `backend/schema.sql`, `backend/migrations/cms_upgrade.sql`, and `backend/migrate_portfolio.js`. Seed and migration scripts support content/database bootstrapping. Media is a first-class backend concern via `backend/routes/mediaRoutes.js` and `backend/controllers/mediaController.js`, rather than being solely static client assets.

#### Runtime and deployment shape
Both frontends are Vite-based Node projects (`client/vite.config.js`, `admin/vite.config.js`) deployed independently from the backend Node service. Production environment files exist for each frontend. Repository-level operational scripts such as `deploy.py`, `custom_deploy.py`, and `check_pm2.py` indicate server deployment/process management, with MySQL-oriented database administration implied by `open_mysql.py` and the SQL schema.

Main entry points: [`backend/index.js`](https://github.com/edizo-io/main_website/blob/main/backend/index.js) (API server assembly), [`backend/db.js`](https://github.com/edizo-io/main_website/blob/main/backend/db.js) (Relational database), [`client/src/App.jsx`](https://github.com/edizo-io/main_website/blob/main/client/src/App.jsx) (Public app and routes), [`backend/controllers/pagesController.js`](https://github.com/edizo-io/main_website/blob/main/backend/controllers/pagesController.js) (Content API controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public Portal"]
  node_public_boot["Public SPA bootstrap<br/>Vite React entry<br/>[main.jsx]"]
  node_public_shell["Public app and routes<br/>React application shell<br/>[App.jsx]"]
  node_public_pages["Public content and application pages<br/>page experiences"]
  node_public_state["Site and auth state<br/>React contexts<br/>[SiteContext.jsx]"]
end

subgraph group_admin["Admin CMS"]
  node_admin_boot["Admin SPA bootstrap<br/>Vite React entry<br/>[main.jsx]"]
  node_admin_auth["Admin authentication state<br/>React auth context<br/>[AuthContext.jsx]"]
  node_admin_shell["Admin layout and navigation<br/>protected application shell<br/>[AdminLayout.jsx]"]
  node_admin_surfaces["CMS and operations views<br/>management pages"]
end

subgraph group_api["Backend API"]
  node_api_server["API server assembly<br/>Node HTTP server<br/>[index.js]"]
  node_auth_middleware{{"Authorization middleware<br/>request guard<br/>[authMiddleware.js]"}}
  node_admin_routes["Administrative routes<br/>HTTP route module<br/>[adminRoutes.js]"]
  node_public_routes["Public workflow routes<br/>HTTP route modules<br/>[contactRoutes.js]"]
  node_content_controllers["Content API controllers<br/>controller layer<br/>[pagesController.js]"]
  node_media_api["Media management<br/>media route and controller<br/>[mediaRoutes.js]"]
end

subgraph group_data["Data &amp; Operations"]
  node_database[("Relational database<br/>MySQL-oriented persistence<br/>[db.js]")]
  node_schema_migrations["Schema and migrations<br/>database lifecycle scripts<br/>[schema.sql]"]
  node_deployment["Deployment and process management<br/>operations scripts<br/>[deploy.py]"]
end

node_public_boot -->|"mounts"| node_public_shell
node_public_shell -->|"routes to"| node_public_pages
node_public_shell -->|"uses"| node_public_state
node_public_pages -->|"reads content and submits workflows"| node_api_server
node_public_state -->|"auth/content requests"| node_api_server
node_admin_boot -->|"initializes"| node_admin_auth
node_admin_auth -->|"protects"| node_admin_shell
node_admin_shell -->|"hosts"| node_admin_surfaces
node_admin_surfaces -->|"manages CMS and records"| node_api_server
node_api_server -->|"applies"| node_auth_middleware
node_auth_middleware -->|"authorizes"| node_admin_routes
node_api_server -->|"mounts"| node_public_routes
node_api_server -->|"dispatches to"| node_content_controllers
node_admin_routes -->|"updates content"| node_content_controllers
node_public_routes -->|"stores submissions"| node_database
node_content_controllers -->|"reads and writes entities"| node_database
node_api_server -->|"mounts"| node_media_api
node_media_api -->|"persists media metadata"| node_database
node_schema_migrations -->|"creates and upgrades"| node_database
node_deployment -.->|"deploys and supervises"| node_api_server

click node_public_boot "https://github.com/edizo-io/main_website/blob/main/client/src/main.jsx"
click node_public_shell "https://github.com/edizo-io/main_website/blob/main/client/src/App.jsx"
click node_public_pages "https://github.com/edizo-io/main_website/blob/main/client/src/pages/InternshipApplication.jsx"
click node_public_state "https://github.com/edizo-io/main_website/blob/main/client/src/context/SiteContext.jsx"
click node_admin_boot "https://github.com/edizo-io/main_website/blob/main/admin/src/main.jsx"
click node_admin_auth "https://github.com/edizo-io/main_website/blob/main/admin/src/context/AuthContext.jsx"
click node_admin_shell "https://github.com/edizo-io/main_website/blob/main/admin/src/layouts/AdminLayout.jsx"
click node_admin_surfaces "https://github.com/edizo-io/main_website/blob/main/admin/src/pages/InternshipApplicationsView.jsx"
click node_api_server "https://github.com/edizo-io/main_website/blob/main/backend/index.js"
click node_auth_middleware "https://github.com/edizo-io/main_website/blob/main/backend/middleware/authMiddleware.js"
click node_admin_routes "https://github.com/edizo-io/main_website/blob/main/backend/routes/adminRoutes.js"
click node_public_routes "https://github.com/edizo-io/main_website/blob/main/backend/routes/contactRoutes.js"
click node_content_controllers "https://github.com/edizo-io/main_website/blob/main/backend/controllers/pagesController.js"
click node_media_api "https://github.com/edizo-io/main_website/blob/main/backend/routes/mediaRoutes.js"
click node_database "https://github.com/edizo-io/main_website/blob/main/backend/db.js"
click node_schema_migrations "https://github.com/edizo-io/main_website/blob/main/backend/schema.sql"
click node_deployment "https://github.com/edizo-io/main_website/blob/main/deploy.py"

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_public_boot,node_public_shell,node_public_pages,node_public_state toneBlue
class node_admin_boot,node_admin_auth,node_admin_shell,node_admin_surfaces toneAmber
class node_api_server,node_auth_middleware,node_admin_routes,node_public_routes,node_content_controllers,node_media_api toneMint
class node_database,node_schema_migrations,node_deployment toneRose
```

## Components

### Public Portal

- [Public SPA bootstrap](https://github.com/edizo-io/main_website/blob/main/client/src/main.jsx): Vite React entry · `client/src/main.jsx`
- [Public app and routes](https://github.com/edizo-io/main_website/blob/main/client/src/App.jsx): React application shell · `client/src/App.jsx`
- [Public content and application pages](https://github.com/edizo-io/main_website/blob/main/client/src/pages/InternshipApplication.jsx): page experiences · Services, landing content, and internship application flows. · `client/src/pages/InternshipApplication.jsx`
- [Site and auth state](https://github.com/edizo-io/main_website/blob/main/client/src/context/SiteContext.jsx): React contexts · `client/src/context/SiteContext.jsx`

### Admin CMS

- [Admin SPA bootstrap](https://github.com/edizo-io/main_website/blob/main/admin/src/main.jsx): Vite React entry · `admin/src/main.jsx`
- [Admin authentication state](https://github.com/edizo-io/main_website/blob/main/admin/src/context/AuthContext.jsx): React auth context · `admin/src/context/AuthContext.jsx`
- [Admin layout and navigation](https://github.com/edizo-io/main_website/blob/main/admin/src/layouts/AdminLayout.jsx): protected application shell · `admin/src/layouts/AdminLayout.jsx`
- [CMS and operations views](https://github.com/edizo-io/main_website/blob/main/admin/src/pages/InternshipApplicationsView.jsx): management pages · Manages content, services, internships, applications, users, and settings. · `admin/src/pages/InternshipApplicationsView.jsx`

### Backend API

- [API server assembly](https://github.com/edizo-io/main_website/blob/main/backend/index.js): Node HTTP server · `backend/index.js`
- [Authorization middleware](https://github.com/edizo-io/main_website/blob/main/backend/middleware/authMiddleware.js): request guard · `backend/middleware/authMiddleware.js`
- [Administrative routes](https://github.com/edizo-io/main_website/blob/main/backend/routes/adminRoutes.js): HTTP route module · `backend/routes/adminRoutes.js`
- [Public workflow routes](https://github.com/edizo-io/main_website/blob/main/backend/routes/contactRoutes.js): HTTP route modules · Accepts contact, internship, and service submissions. · `backend/routes/contactRoutes.js`
- [Content API controllers](https://github.com/edizo-io/main_website/blob/main/backend/controllers/pagesController.js): controller layer · Serves CMS pages, media, and site settings. · `backend/controllers/pagesController.js`
- [Media management](https://github.com/edizo-io/main_website/blob/main/backend/routes/mediaRoutes.js): media route and controller · Backend-owned media lifecycle. · `backend/routes/mediaRoutes.js`

### Data & Operations

- [Relational database](https://github.com/edizo-io/main_website/blob/main/backend/db.js): MySQL-oriented persistence · `backend/db.js`
- [Schema and migrations](https://github.com/edizo-io/main_website/blob/main/backend/schema.sql): database lifecycle scripts · Initial schema plus CMS and portfolio upgrades. · `backend/schema.sql`
- [Deployment and process management](https://github.com/edizo-io/main_website/blob/main/deploy.py): operations scripts · Deploys services and checks PM2 processes. · `deploy.py`

## Connections

- Public SPA bootstrap → Public app and routes: mounts
- Public app and routes → Public content and application pages: routes to
- Public app and routes → Site and auth state: uses
- Public content and application pages → API server assembly: reads content and submits workflows
- Site and auth state → API server assembly: auth/content requests
- Admin SPA bootstrap → Admin authentication state: initializes
- Admin authentication state → Admin layout and navigation: protects
- Admin layout and navigation → CMS and operations views: hosts
- CMS and operations views → API server assembly: manages CMS and records
- API server assembly → Authorization middleware: applies
- Authorization middleware → Administrative routes: authorizes
- API server assembly → Public workflow routes: mounts
- API server assembly → Content API controllers: dispatches to
- Administrative routes → Content API controllers: updates content
- Public workflow routes → Relational database: stores submissions
- Content API controllers → Relational database: reads and writes entities
- API server assembly → Media management: mounts
- Media management → Relational database: persists media metadata
- Schema and migrations → Relational database: creates and upgrades
- Deployment and process management → API server assembly: deploys and supervises
