A full-stack clothing store: static HTML/CSS/JS frontend with a Node.js + Express + MongoDB backend. Built as a portfolio project.
- Product catalog with search, category filtering, and pagination (server-side)
- User registration & login with JWT auth and bcrypt-hashed passwords
- Shopping cart, checkout, and order history
- Admin panel (
/admin.html) — log in as admin to add / edit / delete products in the browser (full CRUD against a protected REST API) - Server-side price validation on orders (never trusts client prices) and automatic stock decrement
- Newsletter subscription
Frontend: HTML, CSS, vanilla JavaScript Backend: Node.js, Express, Mongoose Database: MongoDB Auth: JSON Web Tokens, bcryptjs
.
├── index.html, shop.html, admin.html, ... # frontend pages
├── style.css, script.js # shared frontend assets
├── images/ # product & UI images
└── backend/
├── server.js # entry point (DB connect + listen)
├── server-app.js # Express app (routes + static serving)
├── models/ # user, product, order schemas
├── routes/ # auth, products, orders, cart, newsletter
├── middleware/auth.js # protect + adminOnly
├── seed.js # seed sample products
└── seedAdmin.js # create an admin user
- Install Node.js and have a MongoDB connection string (local or MongoDB Atlas).
- From the
backend/folder:cd backend npm install cp .env.example .env # then edit .env with your values npm run seed # add sample products (optional) npm run seed:admin # create admin@cara.com / admin123 npm start
- Open http://localhost:5000
- Go to
/admin.html - Log in with the admin account created by
npm run seed:admin - Default:
admin@cara.com/admin123(change viaADMIN_EMAIL/ADMIN_PASSWORDenv vars)
- Push this repo to GitHub.
- Create a free MongoDB Atlas cluster; copy its connection string.
- On Render: New → Web Service → connect the repo.
- Build command:
cd backend && npm install - Start command:
cd backend && node server.js - Add env vars:
MONGO_URI(Atlas string),JWT_SECRET(any long random string).
- Build command:
- After first deploy, seed data from Render's Shell tab:
cd backend && npm run seed && npm run seed:admin
Note: Render's free tier sleeps after ~15 min of inactivity; the first request after sleeping takes ~30s to wake.