A modern, scalable e-commerce platform built with Node.js, TypeScript, React, and Prisma.
🛒 ShopCraft – E-commerce Web App
🔗 Live Demo
This project supports a frontend-only demo mode powered by Mock Service Worker (MSW).
When no VITE_API_URL is provided, the frontend intercepts requests to /api/v1/* in the browser
and serves seeded mock data.
This allows the UI to run and be deployed as a static site (e.g. GitHub Pages) with zero backend, database, or environment variables.
- Node.js with Express
- TypeScript
- Prisma ORM with PostgreSQL
- RESTful API architecture
- React with TypeScript
- Vite
- TailwindCSS
shopcraft/
├── server/ # Backend API
│ ├── src/
│ │ ├── config/ # Database and configuration
│ │ ├── controllers/
│ │ ├── routes/
│ │ ├── middleware/
│ │ ├── models/
│ │ ├── services/
│ │ └── utils/
│ └── prisma/ # Database schema and migrations
└── client/ # Frontend application
- Node.js 18+
- npm or yarn
- Clone the repository
git clone git@github.com:kanyingidickson-dev/ShopCraft.git
cd shopcraft- Install server dependencies
cd server
npm install- Install client dependencies
cd ../client
npm install- Set up the database
cd ../server
npx prisma migrate dev
npx prisma generateStart the backend server:
cd server
npm run devStart the frontend:
cd client
npm run devRun the frontend without VITE_API_URL set. The app will start MSW automatically and mock the
API in the browser.
The API will be available at http://localhost:5000
The frontend will be available at http://localhost:5173
The frontend is configured to work under the repository subpath.
Ensure client/public/mockServiceWorker.js is committed (required for MSW in production demos).
GET /api/v1/products- List products (supports pagination/search)POST /api/v1/products- Create a new product (admin)GET /api/v1/products/:id- Get product by ID
GET /api/v1/categories- List all categoriesPOST /api/v1/categories- Create a new category (admin)
POST /api/v1/orders- Create a new order (authenticated)GET /api/v1/orders/me- Get orders for the authenticated userGET /api/v1/orders- List orders (admin, paginated)
GET /api/v1/openapi.json- OpenAPI specification (stub)
GET /health- API health status
The backend follows a layered architecture:
- Controllers: Handle HTTP requests and responses
- Routes: Define API endpoints
- Models: Database schema definitions (Prisma)
- Services: Business logic layer
- Middleware: Request processing and validation
Core entities:
- User: Customer and admin accounts
- Product: Product catalog with pricing and inventory
- Category: Product categorization
- Order: Customer orders with status tracking
- OrderItem: Individual items within orders
Build the server:
cd server
npm run buildRun in production mode:
npm start