The Bike Bazaar
A server-rendered marketplace for bicycle lovers to browse, buy, and sell bikes and accessories. Users can create accounts, post listings with images, make offers on bikes, and manage their own listings.
Demo
Overview
The Bike Bazaar is a full-stack Node.js web application where users can sign up, post bicycles for sale, browse all listings, and submit offers on bikes they're interested in.
The app uses server-side rendering with EJS templates, MongoDB via Mongoose for data persistence, and Express for routing and middleware. Authentication is handled with bcrypt password hashing and express-session for session management.
Sellers can create listings with a title, condition, price, details, and uploaded images (handled by Multer). Buyers can browse all available bikes, search listings, and make offers directly through the platform.
The Problem
- Needed a platform that supports the full lifecycle of a bike listing — creation, browsing, offers, and management — all in one place
- User authentication and authorization had to be handled securely with proper session management
- File uploads for listing images required server-side handling and validation
The Solution
- Built a complete CRUD workflow for bike listings with Mongoose models for Bike, User, and Offer collections
- Implemented secure authentication using bcrypt for password hashing and express-session for persistent login sessions
- Used Multer middleware for image uploads with server-side file storage
- Added input validation with express-validator to sanitize user submissions
Technical Implementation
MVC Architecture
The app follows a Model-View-Controller pattern with Mongoose schemas in models/ (Bike, User, Offer), route handlers in controllers/, Express route definitions in routes/, and EJS templates in views/ with shared partials for header, footer, nav, and flash messages.
Authentication & Sessions
User passwords are hashed with bcrypt before storage. Express-session manages login state with server-side sessions. Auth middleware protects routes that require login and ensures users can only edit or delete their own listings.
Image Uploads with Multer
Listing images are uploaded via Multer middleware, stored on the server in an images/ directory, and served as static assets. Each listing supports image attachments to showcase the bike being sold.
Offer System
Buyers can submit offers on any listing. Offers are stored as a separate Mongoose model linked to both the bike listing and the user who made the offer, allowing sellers to review and manage incoming offers.
Next Project
Kineticarrow_forward