Skip to content

Repository files navigation

CARA — Full-Stack E-Commerce

A full-stack clothing store: static HTML/CSS/JS frontend with a Node.js + Express + MongoDB backend. Built as a portfolio project.

Features

  • 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

Tech Stack

Frontend: HTML, CSS, vanilla JavaScript Backend: Node.js, Express, Mongoose Database: MongoDB Auth: JSON Web Tokens, bcryptjs

Project Structure

.
├── 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

Run Locally

  1. Install Node.js and have a MongoDB connection string (local or MongoDB Atlas).
  2. 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
  3. Open http://localhost:5000

Admin Access

  • Go to /admin.html
  • Log in with the admin account created by npm run seed:admin
  • Default: admin@cara.com / admin123 (change via ADMIN_EMAIL / ADMIN_PASSWORD env vars)

Deploy (Render free tier)

  1. Push this repo to GitHub.
  2. Create a free MongoDB Atlas cluster; copy its connection string.
  3. 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).
  4. 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.

About

Full-stack e-commerce web app — Node.js, Express, MongoDB, JWT auth, admin CRUD panel.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages