# ieee-student-branch-emsi-marrakesh/ieee-website architecture

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

- Interactive diagram: https://gitdiagram.com/ieee-student-branch-emsi-marrakesh/ieee-website
- Repository: https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website

## Overview

1. **High-level shape**
   - This repo is a **React 19 + Vite 7** website for the IEEE Student Branch EMSI Marrakesh.
   - It is primarily a **content-driven front end** with a small **serverless backend** for form submissions.
   - The architecture splits cleanly into:
     - reusable UI and page composition in `src/`
     - static media in `public/assets/`
     - email/contact endpoints in `api/`
     - deployment/runtime configuration for Vercel.

2. **Frontend shell and composition**
   - `src/main.tsx` boots the app, and `src/App.tsx` is the top-level composition/routing layer.
   - The app is built from reusable **site sections** such as:
     - `Hero`, `About`, `Cells`, `Events`, `Achievements`, `Team`, `Supervisors`, `Contact`
   - Shared chrome is handled by `Navbar` and `Footer`.
   - This suggests a single-site experience where the homepage is assembled from sections, while some content also gets its own pages.

3. **Page-level structure**
   - Dedicated page components exist for:
     - `AchievementsPage`
     - `EventsPage`
     - `TeamPage`
     - `NotFound`
   - The presence of these files indicates a **multi-page SPA-style experience** or route-based rendering within the React app.
   - The homepage likely highlights summaries, while the dedicated pages provide fuller galleries/lists.

4. **Content is data-driven, not hard-coded**
   - Core site content lives in `src/data/`:
     - `events.ts`
     - `achievements.ts`
     - `team.ts`
     - `supervisors.ts`
     - `cells.ts`
     - `institutions.ts`
     - `socials.ts`
   - These files act as the main **content source of truth** for the UI.
   - This is important architecturally: the UI reads from typed data modules rather than embedding content directly in components.

5. **Reusable interaction components**
   - The site uses a set of focused components for user interactions:
     - `EventModal` for event details
     - `AchievementCard` for achievement presentation
     - `MediaCarousel` for image/video browsing
     - `JoinUsDialog` for membership/contact flow
     - `PolicyDialogs` for policy/legal content
   - These components sit between raw data and the page shells, which keeps the sections simple and consistent.

6. **UI system and design primitives**
   - `src/components/ui/` contains shadcn-style primitives:
     - button, card, dialog, form, input, label, textarea
   - These are the low-level building blocks used across the site.
   - Styling is handled with **Tailwind CSS**, and `src/lib/utils.ts` likely contains small composition helpers used by these primitives.

7. **Media and asset strategy**
   - Static assets live in `public/assets/` and are organized by domain:
     - achievements
     - cells
     - events
     - supervisors
     - team
   - Event media is subdivided by academic year and event name, including video files.
   - This structure supports a **content gallery architecture** where event cards/modal/carousel components resolve media directly from predictable paths.

8. **Backend boundary: serverless contact/join requests**
   - The `api/` directory contains:
     - `contact.ts`
     - `send.ts`
     - `contact-template.ts`
     - `joinus-template.ts`
   - This indicates a small **serverless API layer** responsible for sending messages, likely via email.
   - The front end’s contact/join-us dialogs submit to these endpoints instead of embedding email logic in the browser.
   - The environment setup in `.env.example` and the README’s `vercel dev` guidance confirm that these functions depend on runtime secrets.

9. **Data flow for user actions**
   - Typical flows are:
     - visitor opens a section/page
     - component reads structured data from `src/data/*`
     - UI renders cards, dialogs, and media
     - form submissions from contact/join-us dialogs call `api/*`
     - the serverless layer formats output using the template files and sends the request onward
   - So the site is mostly read-only content, with a narrow write path for communication.

10. **Performance and asset handling**
   - The README mentions lazy loading and automated asset optimization.
   - `scripts/optimize.sh` suggests a build-time/media optimization step outside the React app itself.
   - This is a meaningful architectural concern because the site carries a large amount of event/video media, so performance depends on both frontend lazy loading and asset preparation.

11. **Deployment/runtime**
   - `vercel.json` shows the site is intended to run on **Vercel**.
   - The README explicitly recommends `vercel dev` so that both the frontend and serverless functions run together with environment variables.
   - That means the production boundary is:
     - static React app
     - Vercel-hosted serverless functions
     - environment-driven configuration for external services.

12. **Overall diagram guidance**
   - A good architecture diagram would show three main layers:
     - **Presentation layer:** React sections/pages/components
     - **Content/media layer:** typed data files plus `public/assets/`
     - **Service layer:** Vercel serverless API functions for contact/join requests
   - The central dependency is from UI components to `src/data/*` and asset paths; the only significant outbound integration is through the `api/` endpoints.

Main entry points: [`src/sections`](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/sections) (Sections), [`src/pages`](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/pages) (Pages), [`src/App.tsx`](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/App.tsx) (App shell), [`api`](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/api) (API functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_main(("main<br/>entrypoint<br/>[main.tsx]"))
  node_app["App shell<br/>router/composer<br/>[App.tsx]"]
  node_nav["Navbar<br/>chrome<br/>[Navbar.tsx]"]
  node_footer["Footer<br/>chrome<br/>[Footer.tsx]"]
  node_sections["Sections"]
  node_pages["Pages"]
  node_dialogs["Dialogs<br/>interaction UI"]
  node_ui["UI kit<br/>primitives"]
  node_utils["Utils<br/>helpers<br/>[utils.ts]"]
end

subgraph group_content["Content"]
  node_eventsdata["Events data<br/>content module<br/>[events.ts]"]
  node_achievementsdata["Achievements data<br/>content module<br/>[achievements.ts]"]
  node_teamdata["Team data<br/>content module<br/>[team.ts]"]
  node_supportdata["Support data<br/>content module"]
  node_assets[("Media assets<br/>static media")]
end

subgraph group_service["Service"]
  node_api["API functions<br/>serverless"]
  node_contact(("Contact API<br/>endpoint<br/>[contact.ts]"))
  node_send(("Send mail<br/>mailer<br/>[send.ts]"))
  node_templates["Templates"]
end

subgraph group_platform["Platform"]
  node_optimize{{"Optimize script<br/>build script<br/>[optimize.sh]"}}
  node_vercel["Vercel config<br/>deployment<br/>[vercel.json]"]
  node_vite["Vite config<br/>build config<br/>[vite.config.ts]"]
end

node_main -->|"boots"| node_app
node_app -->|"uses"| node_nav
node_app -->|"uses"| node_footer
node_app -->|"renders"| node_sections
node_app -->|"routes to"| node_pages
node_sections -->|"reads"| node_eventsdata
node_sections -->|"reads"| node_achievementsdata
node_sections -->|"reads"| node_teamdata
node_sections -->|"reads"| node_supportdata
node_pages -->|"reads"| node_eventsdata
node_pages -->|"reads"| node_achievementsdata
node_pages -->|"reads"| node_teamdata
node_sections -->|"opens"| node_dialogs
node_pages -->|"opens"| node_dialogs
node_dialogs -->|"builds on"| node_ui
node_ui -->|"uses"| node_utils
node_dialogs -->|"submits to"| node_api
node_api -->|"contains"| node_contact
node_api -->|"contains"| node_send
node_api -->|"formats with"| node_templates
node_sections -->|"loads media"| node_assets
node_pages -->|"loads media"| node_assets
node_optimize -.->|"optimizes"| node_assets
node_vercel -->|"deploys"| node_api
node_vercel -->|"serves"| node_app
node_vite -->|"bundles"| node_main

click node_main "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/main.tsx"
click node_app "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/App.tsx"
click node_nav "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/components/Navbar.tsx"
click node_footer "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/components/Footer.tsx"
click node_sections "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/sections"
click node_pages "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/pages"
click node_dialogs "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/components"
click node_ui "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/components/ui"
click node_utils "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/lib/utils.ts"
click node_eventsdata "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/events.ts"
click node_achievementsdata "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/achievements.ts"
click node_teamdata "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/team.ts"
click node_supportdata "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/data"
click node_assets "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/public/assets"
click node_api "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/api"
click node_contact "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/api/contact.ts"
click node_send "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/api/send.ts"
click node_templates "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/api"
click node_optimize "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/scripts/optimize.sh"
click node_vercel "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/vercel.json"
click node_vite "https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/vite.config.ts"

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_main,node_app,node_nav,node_footer,node_sections,node_pages,node_dialogs,node_ui,node_utils toneBlue
class node_eventsdata,node_achievementsdata,node_teamdata,node_supportdata,node_assets toneAmber
class node_api,node_contact,node_send,node_templates toneMint
class node_optimize,node_vercel,node_vite toneRose
```

## Components

### Presentation

React app shell, pages, sections, and reusable UI

- [main](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/main.tsx): entrypoint · Bootstraps the React app · `src/main.tsx`
- [App shell](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/App.tsx): router/composer · Top-level composition and route selection · `src/App.tsx`
- [Navbar](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/components/Navbar.tsx): chrome · Primary site navigation · `src/components/Navbar.tsx`
- [Footer](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/components/Footer.tsx): chrome · Site footer and closing chrome · `src/components/Footer.tsx`
- [Sections](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/sections): page sections · Homepage content blocks like hero, about, events, team, and contact · `src/sections`
- [Pages](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/pages): route pages · Dedicated pages for achievements, events, team, and not found · `src/pages`
- [Dialogs](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/components): interaction UI · Event details, membership, policy, and media interactions · `src/components`
- [UI kit](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/components/ui): primitives · Reusable shadcn-style form and display components · `src/components/ui`
- [Utils](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/lib/utils.ts): helpers · Shared component utility helpers · `src/lib/utils.ts`

### Content

Typed site data and static media assets

- [Events data](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/events.ts): content module · Structured event content and metadata · `src/data/events.ts`
- [Achievements data](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/achievements.ts): content module · Structured achievements content · `src/data/achievements.ts`
- [Team data](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/src/data/team.ts): content module · Structured team member content · `src/data/team.ts`
- [Support data](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/src/data): content module · Supervisors, cells, institutions, and social links · `src/data`
- [Media assets](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/public/assets): static media · Images and videos for achievements, events, team, cells, and supervisors · `public/assets`

### Service

Serverless request handling and email templates

- [API functions](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/api): serverless · Contact and join-us request endpoints · `api`
- [Contact API](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/api/contact.ts): endpoint · Receives contact form submissions · `api/contact.ts`
- [Send mail](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/api/send.ts): mailer · Shared sending logic for outbound messages · `api/send.ts`
- [Templates](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/tree/main/api): email templates · Message formatting for contact and join-us flows · `api`

### Platform

Build, runtime, and deployment configuration

- [Optimize script](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/scripts/optimize.sh): build script · Build-time asset optimization · `scripts/optimize.sh`
- [Vercel config](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/vercel.json): deployment · Deployment and runtime configuration · `vercel.json`
- [Vite config](https://github.com/ieee-student-branch-emsi-marrakesh/ieee-website/blob/main/vite.config.ts): build config · Frontend build and dev server setup · `vite.config.ts`

## Connections

- main → App shell: boots · Application startup enters the root composer
- App shell → Navbar: uses · Shared chrome appears across the site
- App shell → Footer: uses · Shared chrome appears across the site
- App shell → Sections: renders · Homepage and section-based content
- App shell → Pages: routes to · Dedicated page views for fuller content
- Sections → Events data: reads · Sections render from structured content
- Sections → Achievements data: reads · Sections render from structured content
- Sections → Team data: reads · Sections render from structured content
- Sections → Support data: reads · Sections render from structured content
- Pages → Events data: reads · Pages reuse the same content source of truth
- Pages → Achievements data: reads · Pages reuse the same content source of truth
- Pages → Team data: reads · Pages reuse the same content source of truth
- Sections → Dialogs: opens · Sections launch detail and form interactions
- Pages → Dialogs: opens · Pages launch detail and form interactions
- Dialogs → UI kit: builds on · Dialogs are composed from shared primitives
- UI kit → Utils: uses · Primitives share helper logic
- Dialogs → API functions: submits to · Contact and join-us actions call serverless endpoints
- API functions → Contact API: contains · Contact request handler
- API functions → Send mail: contains · Shared outbound send logic
- API functions → Templates: formats with · Email/body templates for outbound messages
- Sections → Media assets: loads media · Section components resolve images and videos from public assets
- Pages → Media assets: loads media · Page views reuse the same asset tree
- Optimize script → Media assets: optimizes · Build-time media preparation
- Vercel config → API functions: deploys · Serverless functions run on Vercel
- Vercel config → App shell: serves · Hosts the frontend application
- Vite config → main: bundles · Frontend build entry and dev workflow
