# sinungp/sewa-alat-outdoor architecture

> Architecture diagram of the GitHub repository sinungp/sewa-alat-outdoor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sinungp/sewa-alat-outdoor
- Repository: https://github.com/sinungp/sewa-alat-outdoor

## Overview

CampCraft Outdoor is a camping-gear rental platform: customers browse equipment and bundles, choose rental dates, place and track bookings; staff authenticate to manage bookings, inventory, bundles, landing-page settings, FAQs, and staff accounts. The sampled backend confirms REST endpoints and a database abstraction with an in-memory fallback. The README documents the broader CMS and customer features, but frontend source excerpts were not provided, so frontend wiring is shown only at the documented page/API level.

Main entry points: [`server.js`](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js) (REST API), [`assets/js/app.js`](https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/app.js) (Client behavior), [`db.js`](https://github.com/sinungp/sewa-alat-outdoor/blob/main/db.js) (Storage adapter), [`index.html`](https://github.com/sinungp/sewa-alat-outdoor/blob/main/index.html) (Rental site)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer rental"]
  node_index["Rental site<br/>[index.html]"]
  node_clientjs["Client behavior<br/>[app.js]"]
  node_clientdata["Catalog data<br/>[data.js]"]
  node_clientstate["Rental state<br/>[state.js]"]
  node_clientui["Client UI<br/>[ui.js]"]
end

subgraph group_staff["Staff CMS"]
  node_login["Staff login<br/>[login.html]"]
  node_dashboard["CMS dashboard<br/>[admin.html]"]
end

subgraph group_backend["REST backend"]
  node_server["REST API<br/>[server.js]"]
  node_auth["Staff authentication<br/>[server.js]"]
  node_bookings["Bookings and tracking<br/>[server.js]"]
  node_catalog["Gear and bundles<br/>[server.js]"]
  node_cms["Settings and FAQs<br/>[server.js]"]
  node_staffmgmt["Staff management<br/>[server.js]"]
end

subgraph group_storage["Persistence"]
  node_db["Storage adapter<br/>[db.js]"]
  node_postgres[("PostgreSQL")]
end

node_renter(("Customer"))
node_staff(("Staff"))

node_renter -->|"browses"| node_index
node_index -->|"runs"| node_clientjs
node_clientjs -->|"uses catalog"| node_clientdata
node_clientjs -->|"updates rental"| node_clientstate
node_clientjs -->|"renders"| node_clientui
node_clientjs -->|"requests catalog and bookings"| node_server
node_server -->|"returns API data"| node_clientjs
node_staff -->|"signs in"| node_login
node_login -->|"submits credentials"| node_server
node_staff -->|"manages rentals"| node_dashboard
node_dashboard -->|"calls protected APIs"| node_server
node_server -->|"checks identity and roles"| node_auth
node_server -->|"handles booking and tracking"| node_bookings
node_server -->|"serves and manages gear"| node_catalog
node_server -->|"manages settings and FAQs"| node_cms
node_server -->|"manages staff accounts"| node_staffmgmt
node_auth -->|"reads and writes users"| node_db
node_bookings -->|"reads and writes bookings"| node_db
node_catalog -->|"reads and writes catalog"| node_db
node_cms -->|"reads and writes content"| node_db
node_staffmgmt -->|"reads and writes users"| node_db
node_db -.->|"queries when connected"| node_postgres

click node_index "https://github.com/sinungp/sewa-alat-outdoor/blob/main/index.html"
click node_clientjs "https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/app.js"
click node_clientdata "https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/data.js"
click node_clientstate "https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/state.js"
click node_clientui "https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/ui.js"
click node_login "https://github.com/sinungp/sewa-alat-outdoor/blob/main/login.html"
click node_dashboard "https://github.com/sinungp/sewa-alat-outdoor/blob/main/admin.html"
click node_server "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_auth "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_bookings "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_catalog "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_cms "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_staffmgmt "https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js"
click node_db "https://github.com/sinungp/sewa-alat-outdoor/blob/main/db.js"

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_index,node_clientjs,node_clientdata,node_clientstate,node_clientui toneBlue
class node_login,node_dashboard toneAmber
class node_server,node_auth,node_bookings,node_catalog,node_cms,node_staffmgmt toneMint
class node_db,node_postgres toneRose
class node_renter,node_staff toneIndigo
```

## Components

### Customer rental

- [Rental site](https://github.com/sinungp/sewa-alat-outdoor/blob/main/index.html): `index.html`
- [Client behavior](https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/app.js): `assets/js/app.js`
- [Catalog data](https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/data.js): `assets/js/data.js`
- [Rental state](https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/state.js): `assets/js/state.js`
- [Client UI](https://github.com/sinungp/sewa-alat-outdoor/blob/main/assets/js/ui.js): `assets/js/ui.js`

### Staff CMS

- [Staff login](https://github.com/sinungp/sewa-alat-outdoor/blob/main/login.html): `login.html`
- [CMS dashboard](https://github.com/sinungp/sewa-alat-outdoor/blob/main/admin.html): `admin.html`

### REST backend

- [REST API](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`
- [Staff authentication](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`
- [Bookings and tracking](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`
- [Gear and bundles](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`
- [Settings and FAQs](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`
- [Staff management](https://github.com/sinungp/sewa-alat-outdoor/blob/main/server.js): `server.js`

### Persistence

- [Storage adapter](https://github.com/sinungp/sewa-alat-outdoor/blob/main/db.js): `db.js`
- **PostgreSQL**

### Other components

- **Customer**
- **Staff**

## Connections

- Customer → Rental site: browses
- Rental site → Client behavior: runs
- Client behavior → Catalog data: uses catalog
- Client behavior → Rental state: updates rental
- Client behavior → Client UI: renders
- Client behavior → REST API: requests catalog and bookings
- REST API → Client behavior: returns API data
- Staff → Staff login: signs in
- Staff login → REST API: submits credentials
- Staff → CMS dashboard: manages rentals
- CMS dashboard → REST API: calls protected APIs
- REST API → Staff authentication: checks identity and roles
- REST API → Bookings and tracking: handles booking and tracking
- REST API → Gear and bundles: serves and manages gear
- REST API → Settings and FAQs: manages settings and FAQs
- REST API → Staff management: manages staff accounts
- Staff authentication → Storage adapter: reads and writes users
- Bookings and tracking → Storage adapter: reads and writes bookings
- Gear and bundles → Storage adapter: reads and writes catalog
- Settings and FAQs → Storage adapter: reads and writes content
- Staff management → Storage adapter: reads and writes users
- Storage adapter → PostgreSQL: queries when connected
