# nexit-ux/dealit architecture

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

- Interactive diagram: https://gitdiagram.com/nexit-ux/dealit
- Repository: https://github.com/nexit-ux/dealit

## Overview

DEALIT is an EJS/Express C2C marketplace. Buyers browse and search postings, while sellers register or log in, create listings with images and location, and manage their own listings. The graph follows the evidenced Express route/controller flow, authentication and validation middleware, Mongoose models, and external image/geocoding services. README-documented OpenRouter description assistance and Mapbox map display are retained as optional features; their implementation wiring was not shown in the sampled source.

Main entry points: [`controllers/postings.js`](https://github.com/nexit-ux/dealit/blob/main/controllers/postings.js) (Posting workflows), [`models/posting.js`](https://github.com/nexit-ux/dealit/blob/main/models/posting.js) (Posting model), [`app.js`](https://github.com/nexit-ux/dealit/blob/main/app.js) (Express application), [`routes/posting.js`](https://github.com/nexit-ux/dealit/blob/main/routes/posting.js) (Posting routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_marketplace["Marketplace"]
  node_server["Express application<br/>[app.js]"]
  node_posting_routes["Posting routes<br/>[posting.js]"]
  node_posting_controller["Posting workflows<br/>[postings.js]"]
end

subgraph group_identity["Identity &amp; access"]
  node_user_routes["Account routes<br/>[user.js]"]
  node_user_controller["Account workflows<br/>[users.js]"]
  node_access_middleware["Access controls<br/>[middleware.js]"]
end

subgraph group_persistence["Data &amp; validation"]
  node_posting_model["Posting model<br/>[posting.js]"]
  node_user_model["User model<br/>[user.js]"]
  node_validation["Posting validation<br/>[schema.js]"]
  node_categories["Listing categories<br/>[categories.js]"]
  node_session_store[("Session store<br/>[app.js]")]
  node_mongo[("MongoDB")]
  node_seed_data["Sample listings<br/>[data.js]"]
  node_seed_loader["Database initializer<br/>[index.js]"]
end

subgraph group_integrations["External services"]
  node_cloud_config["Image storage config<br/>[cloudConfig.js]"]
  node_cloudinary["Cloudinary"]
  node_geocoding["Mapbox geocoding"]
  node_mapbox_display["Mapbox maps"]
  node_openrouter["OpenRouter AI"]
end

subgraph group_presentation["Views &amp; maps"]
  node_posting_views["Posting pages"]
  node_browser_map["Listing map<br/>[map.js]"]
  node_user_views["Account pages"]
end

node_seller(("Marketplace user"))

node_seller -->|"uses"| node_server
node_server -->|"mounts"| node_posting_routes
node_server -->|"mounts"| node_user_routes
node_posting_routes -->|"guards"| node_access_middleware
node_posting_routes -->|"dispatches"| node_posting_controller
node_posting_routes -->|"configures uploads"| node_cloud_config
node_cloud_config -.->|"stores images"| node_cloudinary
node_posting_controller -->|"queries"| node_posting_model
node_posting_controller -->|"geocodes location"| node_geocoding
node_geocoding -->|"provides geometry"| node_posting_model
node_posting_controller -->|"renders"| node_posting_views
node_posting_controller -->|"uses categories"| node_categories
node_posting_model -->|"constrains"| node_categories
node_posting_model -.->|"persists"| node_mongo
node_posting_views -.->|"displays location"| node_browser_map
node_browser_map -.->|"renders map"| node_mapbox_display
node_seller -->|"authenticates"| node_user_routes
node_user_routes -->|"dispatches"| node_user_controller
node_user_routes -->|"saves redirect"| node_access_middleware
node_user_controller -->|"registers users"| node_user_model
node_user_controller -->|"renders"| node_user_views
node_server -->|"configures Passport"| node_user_model
node_server -->|"configures sessions"| node_session_store
node_access_middleware -->|"checks ownership"| node_posting_model
node_access_middleware -->|"validates input"| node_validation
node_posting_controller -.->|"assists descriptions"| node_openrouter
node_seed_loader -->|"loads"| node_seed_data
node_seed_loader -->|"inserts listings"| node_posting_model

click node_server "https://github.com/nexit-ux/dealit/blob/main/app.js"
click node_posting_routes "https://github.com/nexit-ux/dealit/blob/main/routes/posting.js"
click node_posting_controller "https://github.com/nexit-ux/dealit/blob/main/controllers/postings.js"
click node_posting_views "https://github.com/nexit-ux/dealit/tree/main/views/postings"
click node_browser_map "https://github.com/nexit-ux/dealit/blob/main/public/js/map.js"
click node_user_routes "https://github.com/nexit-ux/dealit/blob/main/routes/user.js"
click node_user_controller "https://github.com/nexit-ux/dealit/blob/main/controllers/users.js"
click node_user_views "https://github.com/nexit-ux/dealit/tree/main/views/users"
click node_access_middleware "https://github.com/nexit-ux/dealit/blob/main/middleware.js"
click node_posting_model "https://github.com/nexit-ux/dealit/blob/main/models/posting.js"
click node_user_model "https://github.com/nexit-ux/dealit/blob/main/models/user.js"
click node_validation "https://github.com/nexit-ux/dealit/blob/main/schema.js"
click node_categories "https://github.com/nexit-ux/dealit/blob/main/utils/categories.js"
click node_session_store "https://github.com/nexit-ux/dealit/blob/main/app.js"
click node_cloud_config "https://github.com/nexit-ux/dealit/blob/main/cloudConfig.js"
click node_seed_data "https://github.com/nexit-ux/dealit/blob/main/init/data.js"
click node_seed_loader "https://github.com/nexit-ux/dealit/blob/main/init/index.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_server,node_posting_routes,node_posting_controller,node_seller toneBlue
class node_user_routes,node_user_controller,node_access_middleware toneAmber
class node_posting_model,node_user_model,node_validation,node_categories,node_session_store,node_mongo,node_seed_data,node_seed_loader toneMint
class node_cloud_config,node_cloudinary,node_geocoding,node_mapbox_display,node_openrouter toneRose
class node_posting_views,node_browser_map,node_user_views toneIndigo
```

## Components

### Marketplace

- [Express application](https://github.com/nexit-ux/dealit/blob/main/app.js): `app.js`
- [Posting routes](https://github.com/nexit-ux/dealit/blob/main/routes/posting.js): `routes/posting.js`
- [Posting workflows](https://github.com/nexit-ux/dealit/blob/main/controllers/postings.js): `controllers/postings.js`

### Identity & access

- [Account routes](https://github.com/nexit-ux/dealit/blob/main/routes/user.js): `routes/user.js`
- [Account workflows](https://github.com/nexit-ux/dealit/blob/main/controllers/users.js): `controllers/users.js`
- [Access controls](https://github.com/nexit-ux/dealit/blob/main/middleware.js): `middleware.js`

### Data & validation

- [Posting model](https://github.com/nexit-ux/dealit/blob/main/models/posting.js): `models/posting.js`
- [User model](https://github.com/nexit-ux/dealit/blob/main/models/user.js): `models/user.js`
- [Posting validation](https://github.com/nexit-ux/dealit/blob/main/schema.js): `schema.js`
- [Listing categories](https://github.com/nexit-ux/dealit/blob/main/utils/categories.js): `utils/categories.js`
- [Session store](https://github.com/nexit-ux/dealit/blob/main/app.js): `app.js`
- **MongoDB**
- [Sample listings](https://github.com/nexit-ux/dealit/blob/main/init/data.js): `init/data.js`
- [Database initializer](https://github.com/nexit-ux/dealit/blob/main/init/index.js): `init/index.js`

### External services

- [Image storage config](https://github.com/nexit-ux/dealit/blob/main/cloudConfig.js): `cloudConfig.js`
- **Cloudinary**
- **Mapbox geocoding**
- **Mapbox maps**
- **OpenRouter AI**

### Views & maps

- [Posting pages](https://github.com/nexit-ux/dealit/tree/main/views/postings): `views/postings`
- [Listing map](https://github.com/nexit-ux/dealit/blob/main/public/js/map.js): `public/js/map.js`
- [Account pages](https://github.com/nexit-ux/dealit/tree/main/views/users): `views/users`

### Other components

- **Marketplace user**

## Connections

- Marketplace user → Express application: uses (evidence: `README.md`)
- Express application → Posting routes: mounts (evidence: `app.js`)
- Express application → Account routes: mounts (evidence: `app.js`)
- Posting routes → Access controls: guards (evidence: `routes/posting.js`)
- Posting routes → Posting workflows: dispatches (evidence: `routes/posting.js`)
- Posting routes → Image storage config: configures uploads (evidence: `routes/posting.js`)
- Image storage config → Cloudinary: stores images (evidence: `README.md`)
- Posting workflows → Posting model: queries (evidence: `controllers/postings.js`)
- Posting workflows → Mapbox geocoding: geocodes location (evidence: `controllers/postings.js`)
- Mapbox geocoding → Posting model: provides geometry
- Posting workflows → Posting pages: renders (evidence: `controllers/postings.js`)
- Posting workflows → Listing categories: uses categories (evidence: `controllers/postings.js`)
- Posting model → Listing categories: constrains (evidence: `models/posting.js`)
- Posting model → MongoDB: persists (evidence: `README.md`)
- Posting pages → Listing map: displays location (evidence: `README.md`)
- Listing map → Mapbox maps: renders map (evidence: `README.md`)
- Marketplace user → Account routes: authenticates (evidence: `README.md`)
- Account routes → Account workflows: dispatches (evidence: `routes/user.js`)
- Account routes → Access controls: saves redirect (evidence: `routes/user.js`)
- Account workflows → User model: registers users (evidence: `controllers/users.js`)
- Account workflows → Account pages: renders (evidence: `controllers/users.js`)
- Express application → User model: configures Passport (evidence: `app.js`)
- Express application → Session store: configures sessions (evidence: `app.js`)
- Access controls → Posting model: checks ownership (evidence: `middleware.js`)
- Access controls → Posting validation: validates input (evidence: `middleware.js`)
- Posting workflows → OpenRouter AI: assists descriptions (evidence: `README.md`)
- Database initializer → Sample listings: loads (evidence: `init/index.js`)
- Database initializer → Posting model: inserts listings (evidence: `init/index.js`)
