A full-stack e-commerce web application built with Next.js (React) frontend and Express.js backend.
- RESTful API for products, cart, and orders
- Product management (CRUD operations)
- Shopping cart functionality
- Order processing
- CORS enabled for cross-origin requests
- Sample product data included
- Modern, responsive UI design
- Product catalog display
- Shopping cart with add/remove functionality
- Real-time cart updates
- Order placement
- Mobile-responsive design
GET /api/products- Get all productsGET /api/products/:id- Get product by IDPOST /api/products- Add new product (admin)PUT /api/products/:id- Update product (admin)DELETE /api/products/:id- Delete product (admin)
GET /api/cart- Get cart itemsPOST /api/cart- Add item to cartPUT /api/cart/:id- Update cart item quantityDELETE /api/cart/:id- Remove item from cartDELETE /api/cart- Clear entire cart
GET /api/orders- Get all ordersPOST /api/orders- Create new orderGET /api/orders/:id- Get order by ID
GET /api/health- Server health check
e-commerce-web/
├── client/ # Next.js frontend
│ ├── src/
│ │ └── app/
│ │ ├── page.js # Main e-commerce page
│ │ ├── layout.js # App layout
│ │ ├── page.module.css # Styles
│ │ └── globals.css # Global styles
│ ├── public/ # Static assets
│ ├── package.json # Frontend dependencies
│ └── next.config.mjs # Next.js configuration
├── server/ # Express.js backend
│ ├── index.js # Main server file
│ └── package.json # Backend dependencies
├── package.json # Root package.json for scripts
└── README.md # This file
- Node.js (v16 or higher)
- npm or yarn
-
Install all dependencies
npm run install:all
Or install manually:
# Install root dependencies npm install # Install server dependencies cd server && npm install # Install client dependencies cd ../client && npm install
-
Development Mode (runs both client and server)
npm run dev
This will start:
- Backend server on http://localhost:5000
- Frontend application on http://localhost:3000
-
Run individually
# Run server only npm run server:dev # Run client only (in another terminal) npm run client:dev
-
Production Mode
# Build the client npm run build # Start both server and client npm start
The backend API is available at http://localhost:5000/api
The application comes with sample products:
- Laptop ($999.99)
- Smartphone ($699.99)
- Running Shoes ($129.99)
- Browse Products: View the product catalog on the homepage
- Add to Cart: Click "Add to Cart" on any product
- View Cart: Click the cart button in the header
- Place Order: In the cart modal, click "Place Order"
- Manage Products: Use the API endpoints to add/edit/delete products
- Express.js - Web framework
- CORS - Cross-origin resource sharing
- Node.js - Runtime environment
- Next.js 15.3.3 - React framework
- React 19.0.0 - UI library
- CSS Modules - Styling
- Modern responsive design
- Concurrently - Run multiple commands simultaneously
- npm scripts for workflow management
- Default port: 5000
- Can be changed via
PORTenvironment variable
- Next.js configuration in
client/next.config.mjs - Turbopack enabled for faster development
- Fork the repository
- Create a feature branch
- Make your changes
- Test the changes
- Submit a pull request
- User authentication and authorization
- Payment gateway integration
- Product search and filtering
- Product categories and tags
- User reviews and ratings
- Admin dashboard
- Database integration (MongoDB/PostgreSQL)
- Image upload functionality
- Email notifications
- Inventory management
This project is open source and available under the ISC License.