# defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb architecture

> Architecture diagram of the GitHub repository defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb
- Repository: https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb

## Overview

#### Purpose and Entry Points
Autorizz is a server-rendered car-dealership system for browsing electric and gas vehicle listings, submitting bookings, and administering vehicles, customers, and services. Express application setup starts in `app.js`; the HTTP launcher is `bin/www`. Public users enter through the home/electric/gas route families, while administration is mounted under `/admin`.

#### Application Composition
`app.js` is the composition boundary: it configures Express, Handlebars views, static assets, MongoDB connectivity, and route mounting. User-facing vehicle flows are separated by powertrain in `routes/electric_index.js` and `routes/gas_index.js`; administrative operations are centralized in `routes/admin.js`.

#### Public Vehicle Discovery and Booking
Electric and gas routes query their corresponding vehicle collections, render catalogue/detail/booking pages, and accept booking/customer input. Templates implement the user-visible flow in `views/electric_index.hbs`, `views/gas_index.hbs`, `views/booking.hbs`, and `views/gasbooking.hbs`. Browser-side catalogue interactions are isolated in `public/javascripts/ev_cars.js` and `public/javascripts/gas_cars.js`.

#### Administrative Control Plane
The admin route owns login plus management screens for dealership records. Its view layer separates dashboard, vehicle lists/forms, service management, and customer records: `routes/admin.js`, `views/admin/admin_index.hbs`, `views/admin/electric_form.hbs`, and `views/admin/gas_form.hbs`. This is the operational boundary for maintaining catalogue and service data versus the public browsing flow.

#### Persistence Model
MongoDB, accessed through Mongoose models, is the primary persistence boundary. Domain collections are explicitly split into electric inventory, gas inventory, customers/bookings, services, and users/admin credentials: `models/ElectricModel.js`, `models/GasModel.js`, `models/CustomerModel.js`, `models/ServiceModel.js`, and `models/UserModel.js`. Seed/import-shaped collection data is supplied under `db_data/`, including `db_data/electricmodel.json` and `db_data/customer.json`.

#### Rendering and Static Delivery
The server renders Handlebars templates with shared layouts in `views/layouts/layout.hbs` and `views/layouts/layout_list.hbs`. Express serves CSS, browser JavaScript, and media from `public/`; feature-specific styling distinguishes the public booking/catalogue screens and admin interface, such as `public/css/booking.css` and `public/css/admin.css`.

#### External Runtime and Integration
The runtime is Node.js with Express and MongoDB/Mongoose; local operation expects a running MongoDB `autorizz` database. The repository also contains a mail integration boundary in `utils/mailer.js`, likely used for application notifications. The README identifies Heroku as a deployment target, while process startup is controlled by `bin/www`.

Main entry points: [`app.js`](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/app.js) (Express composition), [`routes/electric_index.js`](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/electric_index.js) (Electric routes), [`routes/gas_index.js`](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/gas_index.js) (Gas routes), [`routes/admin.js`](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/admin.js) (Admin routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_launcher{{"HTTP launcher<br/>Node entrypoint"}}
  node_app["Express composition<br/>Express app<br/>[app.js]"]
  node_layouts["Shared layouts<br/>Handlebars layouts<br/>[layout.hbs]"]
  node_static["Static assets<br/>Express static files"]
  node_mailer["Mail integration<br/>Notification utility<br/>[mailer.js]"]
end

subgraph group_public["Public experience"]
  node_electric_routes["Electric routes<br/>Express router<br/>[electric_index.js]"]
  node_gas_routes["Gas routes<br/>Express router<br/>[gas_index.js]"]
  node_electric_views["Electric catalogue views<br/>Handlebars views<br/>[electric_index.hbs]"]
  node_gas_views["Gas catalogue views<br/>Handlebars views<br/>[gas_index.hbs]"]
  node_booking_views["Booking views<br/>Handlebars views<br/>[booking.hbs]"]
  node_catalogue_scripts["Catalogue scripts<br/>Browser JavaScript<br/>[ev_cars.js]"]
end

subgraph group_admin["Administration"]
  node_admin_routes["Admin routes<br/>Express router<br/>[admin.js]"]
  node_admin_views["Admin screens<br/>Handlebars views<br/>[admin_index.hbs]"]
end

subgraph group_data["Persistence"]
  node_mongodb[("MongoDB autorizz<br/>MongoDB database")]
  node_inventory_models["Inventory models<br/>Mongoose models<br/>[ElectricModel.js]"]
  node_customer_model["Customer bookings<br/>Mongoose model<br/>[CustomerModel.js]"]
  node_operations_models["Service and user models<br/>Mongoose models<br/>[ServiceModel.js]"]
  node_seed_data["Seed data<br/>JSON imports<br/>[electricmodel.json]"]
end

node_launcher -->|"starts"| node_app
node_app -->|"mounts"| node_electric_routes
node_app -->|"mounts"| node_gas_routes
node_app -->|"/admin"| node_admin_routes
node_app -->|"renders with"| node_layouts
node_app -->|"serves"| node_static
node_app -->|"connects"| node_mongodb
node_electric_routes -->|"renders"| node_electric_views
node_gas_routes -->|"renders"| node_gas_views
node_electric_routes -->|"renders"| node_booking_views
node_gas_routes -->|"renders"| node_booking_views
node_catalogue_scripts -.->|"enhances"| node_electric_views
node_electric_routes -->|"queries"| node_inventory_models
node_gas_routes -->|"queries"| node_inventory_models
node_electric_routes -->|"creates bookings"| node_customer_model
node_gas_routes -->|"creates bookings"| node_customer_model
node_admin_routes -->|"renders"| node_admin_views
node_admin_routes -->|"manages"| node_inventory_models
node_admin_routes -->|"manages"| node_customer_model
node_admin_routes -->|"manages"| node_operations_models
node_inventory_models -->|"persists"| node_mongodb
node_customer_model -->|"persists"| node_mongodb
node_operations_models -->|"persists"| node_mongodb
node_seed_data -.->|"imports into"| node_mongodb
node_app -.->|"notifications"| node_mailer

click node_launcher "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/bin/www"
click node_app "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/app.js"
click node_layouts "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/layouts/layout.hbs"
click node_static "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/tree/master/public/css"
click node_electric_routes "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/electric_index.js"
click node_gas_routes "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/gas_index.js"
click node_electric_views "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/electric_index.hbs"
click node_gas_views "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/gas_index.hbs"
click node_booking_views "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/booking.hbs"
click node_catalogue_scripts "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/public/javascripts/ev_cars.js"
click node_admin_routes "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/admin.js"
click node_admin_views "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/admin/admin_index.hbs"
click node_inventory_models "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/ElectricModel.js"
click node_customer_model "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/CustomerModel.js"
click node_operations_models "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/ServiceModel.js"
click node_seed_data "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/db_data/electricmodel.json"
click node_mailer "https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/utils/mailer.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_launcher,node_app,node_layouts,node_static,node_mailer toneBlue
class node_electric_routes,node_gas_routes,node_electric_views,node_gas_views,node_booking_views,node_catalogue_scripts toneAmber
class node_admin_routes,node_admin_views toneMint
class node_mongodb,node_inventory_models,node_customer_model,node_operations_models,node_seed_data toneRose
```

## Components

### Runtime

- [HTTP launcher](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/bin/www): Node entrypoint · `bin/www`
- [Express composition](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/app.js): Express app · Configures middleware, views, static delivery, database connectivity, and route mounting. · `app.js`
- [Shared layouts](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/layouts/layout.hbs): Handlebars layouts · `views/layouts/layout.hbs`
- [Static assets](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/tree/master/public/css): Express static files · CSS, browser scripts, and media served from public/. · `public/css`
- [Mail integration](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/utils/mailer.js): Notification utility · `utils/mailer.js`

### Public experience

- [Electric routes](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/electric_index.js): Express router · Catalogue, detail, and booking flow for electric vehicles. · `routes/electric_index.js`
- [Gas routes](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/gas_index.js): Express router · Catalogue, detail, and booking flow for gas vehicles. · `routes/gas_index.js`
- [Electric catalogue views](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/electric_index.hbs): Handlebars views · `views/electric_index.hbs`
- [Gas catalogue views](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/gas_index.hbs): Handlebars views · `views/gas_index.hbs`
- [Booking views](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/booking.hbs): Handlebars views · Electric and gas booking pages. · `views/booking.hbs`
- [Catalogue scripts](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/public/javascripts/ev_cars.js): Browser JavaScript · Client-side electric and gas catalogue interactions. · `public/javascripts/ev_cars.js`

### Administration

- [Admin routes](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/routes/admin.js): Express router · Login and management of inventory, customers, and services. · `routes/admin.js`
- [Admin screens](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/views/admin/admin_index.hbs): Handlebars views · Dashboard and electric/gas vehicle management forms. · `views/admin/admin_index.hbs`

### Persistence

- **MongoDB autorizz**: MongoDB database · Primary dealership datastore accessed through Mongoose.
- [Inventory models](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/ElectricModel.js): Mongoose models · Separate electric and gas vehicle collections. · `models/ElectricModel.js`
- [Customer bookings](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/CustomerModel.js): Mongoose model · Customer and booking records. · `models/CustomerModel.js`
- [Service and user models](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/models/ServiceModel.js): Mongoose models · Service records and administrator credentials. · `models/ServiceModel.js`
- [Seed data](https://github.com/defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb/blob/master/db_data/electricmodel.json): JSON imports · Initial collection-shaped electric inventory and customer data. · `db_data/electricmodel.json`

## Connections

- HTTP launcher → Express composition: starts
- Express composition → Electric routes: mounts
- Express composition → Gas routes: mounts
- Express composition → Admin routes: /admin
- Express composition → Shared layouts: renders with
- Express composition → Static assets: serves
- Express composition → MongoDB autorizz: connects
- Electric routes → Electric catalogue views: renders
- Gas routes → Gas catalogue views: renders
- Electric routes → Booking views: renders
- Gas routes → Booking views: renders
- Catalogue scripts → Electric catalogue views: enhances
- Electric routes → Inventory models: queries
- Gas routes → Inventory models: queries
- Electric routes → Customer bookings: creates bookings
- Gas routes → Customer bookings: creates bookings
- Admin routes → Admin screens: renders
- Admin routes → Inventory models: manages
- Admin routes → Customer bookings: manages
- Admin routes → Service and user models: manages
- Inventory models → MongoDB autorizz: persists
- Customer bookings → MongoDB autorizz: persists
- Service and user models → MongoDB autorizz: persists
- Seed data → MongoDB autorizz: imports into
- Express composition → Mail integration: notifications
