How defcon27/autorizz-car-dealership-system-using-nodejs-express-mongodb works
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 Express composition · electric_index.js Electric routes · gas_index.js Gas routes · admin.js Admin routes
Components 18
Runtime
- HTTP launcher
bin/www - Express composition · Configures middleware, views, static delivery, database connectivity, and route mounting.
app.js - Shared layouts
views/layouts/layout.hbs - Static assets · CSS, browser scripts, and media served from public/.
public/css - Mail integration
utils/mailer.js
Public experience
- Electric routes · Catalogue, detail, and booking flow for electric vehicles.
routes/electric_index.js - Gas routes · Catalogue, detail, and booking flow for gas vehicles.
routes/gas_index.js - Electric catalogue views
views/electric_index.hbs - Gas catalogue views
views/gas_index.hbs - Booking views · Electric and gas booking pages.
views/booking.hbs - Catalogue scripts · Client-side electric and gas catalogue interactions.
public/javascripts/ev_cars.js
Administration
- Admin routes · Login and management of inventory, customers, and services.
routes/admin.js - Admin screens · Dashboard and electric/gas vehicle management forms.
views/admin/admin_index.hbs
Persistence
- MongoDB autorizz · Primary dealership datastore accessed through Mongoose.
- Inventory models · Separate electric and gas vehicle collections.
models/ElectricModel.js - Customer bookings · Customer and booking records.
models/CustomerModel.js - Service and user models · Service records and administrator credentials.
models/ServiceModel.js - Seed data · Initial collection-shaped electric inventory and customer data.
db_data/electricmodel.json
Connections 25
- 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