# atsurak/marscamp architecture

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

- Interactive diagram: https://gitdiagram.com/atsurak/marscamp
- Repository: https://github.com/atsurak/marscamp

## Overview

##### Project Type and Purpose
- From the file tree and README, this is a full‑stack “Mars Camp” online course portal.
- The frontend is a React single‑page application (SPA) under the `marscamp/` directory.
- The backend is a Node.js + Express API under `Server/`, connected to a MySQL database.
- Purpose: three user roles (Admin, Faculty, Student) interact via SPA → REST API → relational DB.

##### File Structure
- Top‑level:
- `marscamp/` → React app (with `public/`, `src/`, components, pages, actions, forms).
- `Server/` → Express server (with `routes/`, `queries/`, `scripts/`, `server.js`).
- `assets/demo/` → static demo video.
- Backend conventions:
- `Server/routes/*.js` define REST endpoints by resource (auth, courses, instructor, student, etc.).
- `Server/queries/*.sql` hold DDL and DML for DB initialization.
- `Server/scripts/mysql.js` exports a MySQL connection pool.
- Frontend conventions:
- `src/actions/` likely Redux or fetch wrappers for each user role.
- `src/components/` UI building blocks (cards, menus, layout).
- `src/forms/` CRUD forms for announcements, courses, posts, tests, feedback.
- `src/pages/` route targets (SignIn, Home, Course, Forum, Test, etc.).

##### Key README Insights
- Emphasis on relational database learning; uses MySQL with initialization scripts.
- Setup involves running `init.sql` to create tables and manual admin signup.
- API runs at `localhost:5000`, frontend at `localhost:3000`.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["User Browser"]:::ui
        subgraph "React SPA" 
            direction TB
            Entry["index.js / App.js"]:::ui
            Pages["Pages (src/pages/)"]:::ui
            Components["Components (src/components/)"]:::ui
            Cards["Cards (src/cards/)"]:::ui
            Forms["Forms (src/forms/)"]:::ui
            Actions["Actions (src/actions/)"]:::ui
            Token["useToken Hook"]:::ui
        end
        Asset["Demo Video Asset"]:::script
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Server["Express Server (server.js)"]:::backend
        Routes["RESTful Routes (Server/routes/)"]:::backend
        Pool["MySQL Pool (mysql.js)"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        InitSQL["init.sql"]:::script
        TablesSQL["tables.sql"]:::script
        FixesSQL["fixes.sql"]:::script
        DB["MySQL Database"]:::db
    end

    %% Data Flows
    Browser -->|"serves SPA (3000)"| Entry
    Entry --> Pages
    Entry --> Components
    Entry --> Cards
    Entry --> Forms
    Entry --> Actions
    Entry --> Token
    Browser --> Asset
    Browser -->|"REST API calls (5000)"| Server
    Server --> Routes
    Routes --> Pool
    Pool --> DB
    InitSQL --> DB
    TablesSQL --> DB
    FixesSQL --> DB

    %% Click Events
    click Entry "https://github.com/atsurak/marscamp/blob/main/marscamp/src/index.js"
    click Entry "https://github.com/atsurak/marscamp/blob/main/marscamp/src/App.js"
    click Pages "https://github.com/atsurak/marscamp/tree/main/marscamp/src/pages/"
    click Components "https://github.com/atsurak/marscamp/tree/main/marscamp/src/components/"
    click Cards "https://github.com/atsurak/marscamp/tree/main/marscamp/src/cards/"
    click Forms "https://github.com/atsurak/marscamp/tree/main/marscamp/src/forms/"
    click Actions "https://github.com/atsurak/marscamp/tree/main/marscamp/src/actions/"
    click Token "https://github.com/atsurak/marscamp/blob/main/marscamp/src/components/useToken.js"
    click Server "https://github.com/atsurak/marscamp/blob/main/Server/server.js"
    click Routes "https://github.com/atsurak/marscamp/tree/main/Server/routes/"
    click Pool "https://github.com/atsurak/marscamp/blob/main/Server/scripts/mysql.js"
    click InitSQL "https://github.com/atsurak/marscamp/blob/main/Server/queries/init.sql"
    click TablesSQL "https://github.com/atsurak/marscamp/blob/main/Server/queries/tables.sql"
    click FixesSQL "https://github.com/atsurak/marscamp/blob/main/Server/queries/fixes.sql"
    click Asset "https://github.com/atsurak/marscamp/tree/main/assets/demo/"

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,color:#000
    classDef backend fill:#90ee90,stroke:#000,color:#000
    classDef db fill:#ffa500,stroke:#000,color:#000
    classDef script fill:#f5deb3,stroke:#000,color:#000
```
