# codingarctic/iste444-project2 architecture

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

- Interactive diagram: https://gitdiagram.com/codingarctic/iste444-project2
- Repository: https://github.com/codingarctic/iste444-project2

## Overview

##### Project Type and Purpose
- This is a full-stack “CRUD Car Marketplace” demo application.
- The README calls out a React single-page frontend, an Express/Node.js REST API backend, and an SQLite database for storage.
- Key features include user authentication (demo-level), per-user car listings, logging to file, and full Create/Read/Update/Delete operations via REST.

##### File Structure
- Top-level directories:
- backend/ – contains server.js, package.json, and a db/ folder with the SQL schema.
- frontend/ – contains a Vite-based React app with src/, public/, and config files.
- Root package.json orchestrates install and start scripts that launch both services concurrently.
- Configuration files:
- frontend/vite.config.js, eslint.config.js
- backend/.gitignore, server.js pointing at API base URL and DB file.
- Patterns: classic client-server split, SPA frontend, REST API layer, file-based SQL DB.

##### Extract Insights from the README
- Stack: SQLite, React, Express, Node.js.
- Environment configuration: API base URLs toggled in apiRequest.js (frontend) and server.js (backend).
- Start command: “npm run start” launches both sides together.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::external

    %% Frontend Zone
    subgraph "Frontend (Browser)" 
        direction TB
        SPA["React SPA"]:::frontend
        Pages["Pages"]:::frontend
        Components["UI Components"]:::frontend
        APIClient["apiRequest.js"]:::utility
        Context["ContentProvider"]:::utility
        ViteConfig["vite.config.js"]:::utility
    end

    %% Backend Zone
    subgraph "Backend (Server)"
        direction TB
        Server["server.js (Express Entry)"]:::backend
        Router["Router"]:::backend
        Auth["Auth Middleware"]:::utility
        Controllers["Controllers"]:::backend
        DataAccess["DB Module"]:::backend
        Logger["Logger Module"]:::utility
        DB["SQLite Database"]:::database
    end

    %% Root Orchestrator
    Orchestrator["package.json (Root)"]:::external

    %% Interactions
    User -->|"Interacts with"| SPA
    SPA -->|"renders Pages"| Pages
    SPA -->|"uses Components"| Components
    SPA -->|"uses Context"| Context
    SPA -->|"configured by"| ViteConfig

    Pages -->|"Home, Login, MyListings"| HomePage["Home.jsx"]:::frontend
    Pages -->|"Home, Login, MyListings"| LoginPage["Login.jsx"]:::frontend
    Pages -->|"Home, Login, MyListings"| MyListingsPage["MyListings.jsx"]:::frontend

    Components -->|"includes CarDialog, Card, Nav"| CarDialog["CarDialog.jsx"]:::frontend
    Components -->|"includes CarDialog, Card, Nav"| Card["Card.jsx"]:::frontend
    Components -->|"includes CarDialog, Card, Nav"| Nav["Nav.jsx"]:::frontend

    SPA -->|"calls API"| APIClient
    APIClient -->|"HTTP GET/POST /api/*"| Server

    Server -->|"routes to"| Router
    Router -->|"applies"| Auth
    Router -->|"dispatches to"| Controllers
    Controllers -->|"executes SQL"| DataAccess
    Controllers -->|"writes log"| Logger
    DataAccess -->|"reads/writes"| DB
    Logger -->|"writes file"| DBLog["create_database.sql"]:::database

    Server -->|"responds JSON"| APIClient
    APIClient -->|"delivers data"| SPA

    Orchestrator -->|"launches"| SPA
    Orchestrator -->|"launches"| Server

    %% Click Events
    click SPA "https://github.com/codingarctic/iste444-project2/tree/main/frontend/src"
    click HomePage "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/pages/Home.jsx"
    click LoginPage "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/pages/Login.jsx"
    click MyListingsPage "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/pages/MyListings.jsx"
    click Components "https://github.com/codingarctic/iste444-project2/tree/main/frontend/src/components"
    click CarDialog "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/components/CarDialog.jsx"
    click Card "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/components/Card.jsx"
    click Nav "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/components/Nav.jsx"
    click APIClient "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/utils/apiRequest.js"
    click Context "https://github.com/codingarctic/iste444-project2/blob/main/frontend/src/utils/ContentProvider.jsx"
    click ViteConfig "https://github.com/codingarctic/iste444-project2/blob/main/frontend/vite.config.js"
    click Server "https://github.com/codingarctic/iste444-project2/blob/main/backend/server.js"
    click Orchestrator "https://github.com/codingarctic/iste444-project2/blob/main/package.json"
    click DBLog "https://github.com/codingarctic/iste444-project2/blob/main/backend/db/create_database.sql"
    classDef frontend fill:#D6EFFF,stroke:#333,stroke-width:1px
    classDef backend fill:#D0F0C0,stroke:#333,stroke-width:1px
    classDef database fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef utility fill:#E0E0E0,stroke:#333,stroke-width:1px
    classDef external fill:#F8F8F8,stroke:#333,stroke-width:1px
```
