A full-stack e-commerce application built with React frontend and Node.js backend, featuring MySQL database with comprehensive product management, shopping cart, order processing, and admin dashboard.
- Product Browsing: View products with search, filter, and sort options
- Shopping Cart: Add, update, remove items with real-time inventory checks
- User Authentication: Register, login, profile management
- Order Management: Place orders, track status, view history
- Categories: Browse products by categories
- Responsive Design: Works on desktop, tablet, and mobile
- Dashboard: Overview of sales, orders, and inventory
- Order Management: Update order status (pending → processing → shipped → delivered)
- Inventory Control: Monitor stock levels and low-stock alerts
- User Management: View and manage customer accounts
- Sales Reports: Analytics and reporting features
- RESTful API: Comprehensive backend API with proper error handling
- JWT Authentication: Secure user authentication and authorization
- Real-time Updates: Cart and inventory updates in real-time
- Data Validation: Input validation on both frontend and backend
- Error Handling: Comprehensive error handling and user feedback
- Security: Password hashing, SQL injection prevention, CORS protection
- Node.js (v16 or higher)
- MySQL (v8.0 or higher)
- Docker (optional, for containerized database)
- Git
git clone <repository-url>
cd DBMS_Project# Start MySQL and phpMyAdmin
docker-compose up -d
# Wait for MySQL to be ready (1-2 minutes)
docker logs cash_carry_mysqlcd backend
npm install
npm run db:reset # Creates database, tables, and sample data
npm run dev # Starts backend server# In a new terminal, from project root
chmod +x setup-frontend.sh
./setup-frontend.sh # Installs dependencies and creates necessary files
npm start # Starts frontend development server- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
- phpMyAdmin: http://localhost:8080 (root/root)
- API Health: http://localhost:5001/health
- Email: [email protected]
- Password: secret
- Features: Full admin access, order management, inventory control
- Email: [email protected]
- Password: secret
- Features: Shopping, cart, orders, profile management
- users: Customer and admin accounts
- categories: Product categories (8 categories)
- suppliers: Product suppliers (4 suppliers)
- products: Product catalog (16 sample products)
- inventory: Stock management and tracking
- shopping_cart: User shopping carts
- orders: Order management and tracking
- order_items: Individual order line items
- payments: Payment processing and history
- product_reviews: Customer reviews and ratings
- wishlists: User wishlists
- 8 Categories: Fruits & Vegetables, Dairy & Eggs, Meat & Seafood, etc.
- 16 Products: Fresh produce, dairy, meat, bakery items
- 4 Suppliers: Various food suppliers with contact details
- Inventory: Full stock tracking for all products
- Browse Products → Customer views product catalog
- Add to Cart → Products added with quantity validation
- Checkout → Order creation with customer details
- Payment → Demo payment processing
- Order Confirmation → Order placed successfully
- Admin Processing → Admin updates order status
- Shipping → Order marked as shipped
- Delivery → Order completed
POST /api/auth/login - User login
POST /api/auth/register - User registration
GET /api/auth/profile - Get user profile
GET /api/products - Get products (with filters)
GET /api/products/:id - Get single product
GET /api/categories - Get all categories
GET /api/cart - Get user cart
POST /api/cart - Add item to cart
PUT /api/cart/:id - Update cart item
DELETE /api/cart/:id - Remove from cart
GET /api/orders - Get user orders
POST /api/orders - Create new order
GET /api/orders/:id - Get order details
GET /api/admin/dashboard - Admin dashboard data
GET /api/admin/orders - All orders management
PUT /api/admin/orders/:id/status - Update order status
# Test API endpoints
curl http://localhost:5001/health
curl "http://localhost:5001/api/products?limit=5"
curl http://localhost:5001/api/categories
# Test login
curl -X POST http://localhost:5001/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "secret"}'# Run database tests
cd backend
npm run debug:products
npm run test:login
# Run frontend tests
cd ..
npm test- Set environment variables for production
- Configure production database
- Run
npm run build - Deploy to cloud service (AWS, Heroku, etc.)
- Update API base URL in production
- Run
npm run build - Deploy build folder to static hosting (Netlify, Vercel, etc.)
npm run dev # Start development server
npm run db:setup # Setup database
npm run db:reset # Reset database with fresh data
npm run db:check # Check database status
npm run test:login # Test login functionality
npm run debug:products # Debug products APInpm start # Start development server
npm run build # Build for production
npm test # Run tests-
Port 3306 already in use
- Solution: Using port 3307 for MySQL in docker-compose.yml
-
Frontend not loading products
- Check backend is running on port 5001
- Verify API calls in browser network tab
- Check CORS configuration
-
Login not working
- Run
npm run test:loginto verify credentials - Check JWT token generation
- Run
-
Database connection issues
- Ensure Docker containers are running
- Check database credentials in .env file
- Wait for MySQL to fully start (1-2 minutes)
# Check Docker containers
docker ps
# Check MySQL logs
docker logs cash_carry_mysql
# Test database connection
npm run db:check
# Test API endpoints
./debug-api.shDBMS_Project/
├── backend/ # Node.js backend
│ ├── config/ # Database and app configuration
│ ├── routes/ # API route handlers
│ ├── middleware/ # Authentication, validation
│ ├── utils/ # Helper functions
│ └── scripts/ # Database setup scripts
├── src/ # React frontend
│ ├── components/ # Reusable components
│ ├── pages/ # Page components
│ ├── contexts/ # React contexts (Auth, Cart)
│ └── services/ # API service layer
├── database/ # SQL schema and seed data
├── public/ # Static assets
└── docker-compose.yml # Docker configuration
- Frontend: React 18, React Router, Bootstrap 5, Axios
- Backend: Node.js, Express.js, MySQL2, JWT, bcrypt
- Database: MySQL 8.0 with stored procedures and triggers
- Development: Docker, phpMyAdmin, Nodemon
- Authentication: JWT tokens with bcrypt password hashing
- Styling: Bootstrap 5, Font Awesome, Custom CSS
This project is created for educational purposes as part of a Database Management Systems course.
This is an educational project. Feel free to fork and modify for learning purposes.
Built with ❤️ for DBMS Project 2024