How farvejfaru/hotel-booking-app works
Project type and purpose
• WanderLust is a full-stack CRUD web application:
• Backend: Node.js + Express.js
• Frontend: EJS templates + CSS served as static assets
• Database: MongoDB via Mongoose ODM
• Purpose: Allow users to view, create, edit, delete travel property listings.
File structure
• Top-level files
• app.js – app entry, Express server, routes, middleware
• package.json / package-lock.json – dependencies, scripts
• Directories
• init/ – database seeding scripts (data.js, index.js)
• models/ – Mongoose schema (listing.js)
• views/ – EJS templates
– layouts/ (boilerplate.ejs)
– includes/ (navbar.ejs, footer.ejs)
– listings/ (CRUD pages)
• public/ – static assets (CSS)
• Config files
• .gitignore, README.md
Extract architectural insights from README
• MVC pattern:
• Models (Mongoose)
• Views (EJS templates)
• Controllers / Routes (in app.js)
• Method-override middleware for PUT/DELETE
• Seed script to initialize the MongoDB dataset
Main components & interactions
a. Client (Browser)
– Sends HTTP requests for pages and form submissions
b. Express Server (app.js)
– Routing layer: defines GET/POST/PUT/DELETE for “/listings”
– Controller logic: calls model methods, picks views to render
– Middleware: body-parser, method-override, static file serving
c. View Layer
– EJS templates (layouts + partials + listing pages)
– CSS loaded from /public/css/style.css
d. Data Access Layer
– Mongoose model (models/listing.js)
– CRUD operations against MongoDB
e. Database
– MongoDB instance (local mongod)
f. Initialization Service
– init/index.js reads sample data (init/data.js) → populates DB
Architectural patterns & principles
• MVC separation: clean layering of Presentation, Business Logic, Data Access
• Single Express instance handles routing + middleware
• Reusable view components with EJS partials & layouts
• Seed/Init script separated from runtime code
Minimum elements
• Labels: “Client (Browser)”, “Express Server (app.js)”, “View Engine (EJS)”, “Model (Mongoose)”, “Database (MongoDB)”, “Init Service”