Robotics E-Commerce Application
Full-stack e-commerce platform with admin and database integration
Project Overview
Built a complete full-stack e-commerce web application for robotics products using Node.js, Express, and MySQL. The application implements JWT-based customer authentication, bcryptjs password hashing, product catalog with browsing and reviews, shopping cart and order workflow, and an admin interface for stock management protected by an environment-variable admin password.
The Problem
Demonstrating full-stack e-commerce development requires integrating a frontend UI, backend API, MySQL schema, secure JWT authentication, and an admin layer into a coherent, working application.
The Solution
Built a multi-tier web application with HTML/CSS/JS frontend, a Node.js/Express REST API backend, and a MySQL relational database — implementing the complete customer and admin journeys from product discovery to order completion.
Key Highlights
- Node.js + Express backend with MySQL persistence (db:init and db:seed scripts)
- JWT-based customer authentication for secure session management
- bcryptjs password hashing for secure credential storage
- Product catalog with browsing, filtering, and persistent customer reviews
- Shopping cart with quantity management and order tracking
- Admin stock updates protected by ADMIN_PASSWORD environment variable
- Environment-variable configuration (.env) for all sensitive credentials
- Start/stop PowerShell scripts for local development workflow
System Architecture
Code Spotlight
Real snippets from the codebase demonstrating key engineering decisions.
1const jwt = require('jsonwebtoken');
2const bcrypt = require('bcryptjs');
3
4// JWT authentication middleware
5function authenticateToken(req, res, next) {
6 const token = req.headers['authorization']?.split(' ')[1];
7 if (!token) return res.status(401).json({ error: 'Access denied' });
8
9 jwt.verify(token, process.env.JWT_SECRET, (err, user) => {
10 if (err) return res.status(403).json({ error: 'Invalid token' });
11 req.user = user;
12 next();
13 });
14}
15
16// Secure login — constant-time compare via bcrypt
17async function login(req, res) {
18 const { email, password } = req.body;
19 const [user] = await db.query(
20 'SELECT * FROM users WHERE email = ?', [email] // parameterized
21 );
22 if (!user || !(await bcrypt.compare(password, user.password_hash)))
23 return res.status(401).json({ error: 'Invalid credentials' });
24
25 const token = jwt.sign({ id: user.id, email }, process.env.JWT_SECRET, { expiresIn: '7d' });
26 res.json({ token });
27}Challenges & How I Solved Them
Designing JWT token lifecycle management for customer sessions
Implementing role separation between customer and admin routes without a full RBAC system
Building a checkout flow that atomically deducts inventory and records orders
Managing database schema initialization and seeding reproducibly across environments
Results
- →Fully functional e-commerce application with customer and admin workflows
- →Secure JWT authentication and bcryptjs-hashed credentials
- →MySQL-backed schema covering users, products, orders, order items, and reviews
- →Reproducible setup via db:init and db:seed npm scripts