Shop-Zone started as a React storefront with hard-coded products. To make it real I built a separate Express API, my first Node.js backend, and deployed it to Render with MongoDB Atlas.
Structure
Routes, controllers, models and middleware live in separate folders. Route files only map URLs to controller functions, which keeps each file small.
Authentication
Passwords are hashed with bcryptjs (salt rounds of 10) and login returns a JWT that expires in 30 days. A protect middleware verifies the token and loads the user; an admin middleware checks the isAdmin flag.
Routes
- POST /register and /login; GET /profile (protected)
- GET products and product by ID are public; create, update and delete require admin
- POST an order and GET my orders for any signed-in user; admins list all orders and mark them delivered
Deployment details
CORS is limited to an allow-list that includes the deployed frontend, and a seeder script loads sample products into MongoDB.
What is next
The React app currently consumes the product endpoints only. Wiring login, checkout and order history to the existing API is the obvious next step.
Read the full case study: Shop-Zone