# imadbils/justintime- architecture

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

- Interactive diagram: https://gitdiagram.com/imadbils/justintime-
- Repository: https://github.com/imadbils/justintime-

## Overview

##### Project type and purpose
- JustInTime is a lightweight full-stack personal project management app.
- It uses Bun as both the web server (static file hosting) and API router (backend) and React + Tailwind CSS (frontend).
- Data persistence is handled via a local JSON file (`data/projects.json`).

##### File structure
- Top level:
- build.ts, bunfig.toml, bun.lock, package.json – build and runtime config for Bun
- data/projects.json – the sole “database”
- src/ – frontend and API code in TypeScript/TSX
- In src/:
- frontend.tsx, index.html, index.css, index.tsx, App.tsx, APITester.tsx
– React entry points, components, styling, and a small API tester UI
- There is no separate “backend” folder; Bun’s routing code likely lives alongside the React files or is bootstrapped via build.ts.

##### README for additional insights
- Confirms stack: Bun (server+API), React (UI), Tailwind (styles), local JSON storage
- Features: CRUD operations against `projects.json` via a simple REST-style API

a. Main components
- Client (Browser) running the React + Tailwind UI
- Bun server (HTTP static file server + REST API router)
- Data store (local JSON file)
b. Relationships / data flows
1. Browser requests `index.html` and JS/CSS assets → Bun server serves static files.
2. React app bootstraps in the browser.
3. User actions in the UI → HTTP fetch calls to Bun server API endpoints (`/projects`, `/projects/:id`).
4. Bun server reads/writes `data/projects.json` → performs CRUD operations.
5. Server returns JSON responses → React updates UI.
c. Architectural patterns and design principles
- Layered separation: Presentation (React) ↔ API layer (Bun routes) ↔ Storage (JSON file).
- Single‐page application (SPA) on the frontend.
- Minimal “database” abstraction: Direct file I/O on JSON.
d. Key technologies/frameworks
- Bun: fast JavaScript runtime, bundler, server, and router
- TypeScript everywhere for type safety
- React for UI components (App.tsx, APITester.tsx)
- Tailwind CSS for styling
- JSON file as lightweight persistence

- Browser → Bun server (GET/POST/PUT/DELETE)
- Bun server → JSON file (read/write)
- Bun server → Browser (serve static files, return JSON)
- Blue for client-side (React + Tailwind)
- Green for server-side (Bun)
- Orange for storage (JSON file)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::client

    subgraph "React Frontend"
        direction TB
        HTML["index.html"]:::client
        CSS["index.css"]:::client
        Entry["index.tsx"]:::client
        FrontendTS["frontend.tsx"]:::client
        App["App.tsx"]:::client
        APITester["APITester.tsx"]:::client
    end

    subgraph "Bun Server"
        direction TB
        Static["Static File Server"]:::server
        API["API Router"]:::server
        BuildTS["build.ts"]:::server
        Bunfig["bunfig.toml"]:::server
        Lock["bun.lock"]:::server
        Package["package.json"]:::server
        TSConfig["tsconfig.json"]:::server
    end

    Data["projects.json"]:::storage

    Browser -->|Requests assets| Static
    Browser -->|Sends API calls| API
    Static -->|Serves files| Browser
    API -->|Returns JSON responses| Browser
    API -->|Read/Write| Data

    click HTML "https://github.com/imadbils/justintime-/blob/main/src/index.html"
    click CSS "https://github.com/imadbils/justintime-/blob/main/src/index.css"
    click Entry "https://github.com/imadbils/justintime-/blob/main/src/index.tsx"
    click FrontendTS "https://github.com/imadbils/justintime-/blob/main/src/frontend.tsx"
    click App "https://github.com/imadbils/justintime-/blob/main/src/App.tsx"
    click APITester "https://github.com/imadbils/justintime-/blob/main/src/APITester.tsx"
    click BuildTS "https://github.com/imadbils/justintime-/blob/main/build.ts"
    click Bunfig "https://github.com/imadbils/justintime-/blob/main/bunfig.toml"
    click Lock "https://github.com/imadbils/justintime-/blob/main/bun.lock"
    click Package "https://github.com/imadbils/justintime-/blob/main/package.json"
    click TSConfig "https://github.com/imadbils/justintime-/blob/main/tsconfig.json"
    click Data "https://github.com/imadbils/justintime-/blob/main/data/projects.json"

    classDef client fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef server fill:#d4edda,stroke:#333,stroke-width:1px
    classDef storage fill:#ffe5b4,stroke:#333,stroke-width:1px
```
