A modern, scalable, production-ready e-commerce platform built with Next.js, NestJS, PostgreSQL, and Redis. Features include user authentication, product catalog, shopping cart, order management, payment processing, admin dashboard, and more.
- Features
- Tech Stack
- Architecture
- Prerequisites
- Installation
- Configuration
- Running the Application
- Testing
- Deployment
- API Documentation
- Project Structure
- Contributing
- License
- π User Authentication - JWT-based auth + Google OAuth
- ποΈ Product Browsing - Advanced search, filters, and sorting
- π Shopping Cart - Real-time cart management with Redis
- β€οΈ Wishlist - Save products for later
- π³ Secure Checkout - Multiple payment options (Stripe integration)
- π¦ Order Tracking - Real-time order status updates
- β Reviews & Ratings - Product reviews with image uploads
- π± Responsive Design - Mobile-first, works on all devices
- π Notifications - Email and in-app notifications
- π Admin Dashboard - Comprehensive analytics and stats
- π¦ Product Management - CRUD operations for products
- π¦ Inventory Management - Stock tracking and low-stock alerts
- ποΈ Order Management - View, update, and track all orders
- π₯ Customer Management - View customer information
- ποΈ Coupon Management - Create and manage discount coupons
- π Analytics - Sales reports, revenue tracking, user insights
- π Bulk Operations - CSV import/export for products
- β‘ High Performance - Optimized with caching and CDN
- π Security - Best practices: CORS, Helmet, rate limiting, input validation
- π‘ RESTful API - Well-documented, versioned APIs
- π Search - Elasticsearch integration for fast product search
- π§ Email Service - Transactional emails (order confirmations, etc.)
- πΎ File Storage - S3-compatible object storage
- π Background Jobs - Bull queue for async processing
- π Logging - Structured logging with Winston
- π Error Tracking - Sentry integration
- π§ͺ Testing - Unit, integration, and E2E tests
- Framework: Next.js 14 (React 18)
- Language: TypeScript
- Styling: TailwindCSS
- UI Components: Shadcn UI
- State Management: Zustand
- Forms: React Hook Form + Zod validation
- API Client: Axios
- Authentication: NextAuth.js
- Framework: NestJS
- Language: TypeScript
- ORM: Prisma
- Authentication: Passport.js (JWT + OAuth)
- API Documentation: Swagger/OpenAPI
- Validation: class-validator
- Primary Database: PostgreSQL 15
- Cache: Redis 7
- Search: Elasticsearch 8
- File Storage: AWS S3 / MinIO
- Containerization: Docker
- Orchestration: Docker Compose / Kubernetes
- CI/CD: GitHub Actions
- Hosting: AWS / GCP / Azure / Vercel (frontend)
- Monitoring: DataDog / New Relic
- Error Tracking: Sentry
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT LAYER β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Web App β β Mobile Web β β Admin UI β β
β β (Next.js) β β (Responsive)β β (Next.js) β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββ
β CDN / NGINX β
βββββββββββ¬βββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββ
β β β
βββββββββΌβββββββββ ββββββββββΌβββββββ βββββββββββΌβββββββ
β Backend API β β Backend API β β Backend API β
β (NestJS) β β (NestJS) β β (NestJS) β
ββββββββββ¬ββββββββ ββββββββββ¬βββββββ ββββββββββ¬ββββββββ
β β β
ββββββββββββββββββββββΌβββββββββββββββββββββ
β
βββββββββββββββββββββββΌββββββββββββββββββββββ
β β β
βββββββββΌββββββββ ββββββββββΌβββββββββ βββββββββΌβββββββββ
β PostgreSQL β β Redis β β Elasticsearch β
β (Primary) β β (Cache) β β (Search) β
βββββββββββββββββ βββββββββββββββββββ ββββββββββββββββββ
See ARCHITECTURE.md for detailed architecture documentation.
Before you begin, ensure you have installed:
- Node.js >= 18.0.0 (Download)
- npm or yarn
- PostgreSQL >= 15 (Download)
- Redis >= 7 (Download)
- Docker (optional but recommended) (Download)
- Git (Download)
- Clone the repository
git clone https://github.com/yourusername/shopeasy.git
cd shopeasy- Start all services with Docker Compose
cd docker
docker-compose -f docker-compose.dev.yml up -dThis will start:
- PostgreSQL on port 5432
- Redis on port 6379
- Elasticsearch on port 9200
- Install backend dependencies
cd backend
npm install- Run database migrations
npx prisma migrate dev
npx prisma generate
npx prisma db seed- Install frontend dependencies
cd ../frontend
npm install- Clone the repository
git clone https://github.com/yourusername/shopeasy.git
cd shopeasy- Install PostgreSQL
- Create a database named
shopeasy
CREATE DATABASE shopeasy;- Install Redis
- Start Redis server on default port 6379
- Install Elasticsearch (Optional for full-text search)
- Download and start Elasticsearch
- Install dependencies and setup
# Backend
cd backend
npm install
npx prisma migrate dev
npx prisma generate
npx prisma db seed
# Frontend
cd ../frontend
npm installCreate backend/.env file:
# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/shopeasy?schema=public"
# JWT
JWT_SECRET="your-super-secret-jwt-key-change-in-production"
JWT_EXPIRES_IN="15m"
REFRESH_TOKEN_SECRET="your-refresh-token-secret"
REFRESH_TOKEN_EXPIRES_IN="7d"
# Google OAuth
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
GOOGLE_CALLBACK_URL="http://localhost:3000/api/v1/auth/google/callback"
# Redis
REDIS_HOST="localhost"
REDIS_PORT=6379
REDIS_PASSWORD=""
# Elasticsearch
ELASTICSEARCH_NODE="http://localhost:9200"
# AWS S3
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
AWS_REGION="us-east-1"
AWS_S3_BUCKET="shopeasy-uploads"
# Stripe
STRIPE_SECRET_KEY="sk_test_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
# Email
SMTP_HOST="smtp.gmail.com"
SMTP_PORT=587
SMTP_USER="your-email@gmail.com"
SMTP_PASSWORD="your-app-password"
SMTP_FROM="ShopEasy <noreply@shopeasy.com>"
# Application
PORT=3000
NODE_ENV="development"
FRONTEND_URL="http://localhost:3001"Create frontend/.env.local file:
NEXT_PUBLIC_API_URL=http://localhost:3000/api/v1
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your-google-client-idTerminal 1: Backend
cd backend
npm run start:devTerminal 2: Frontend
cd frontend
npm run devAccess the application:
- Frontend: http://localhost:3001
- Backend API: http://localhost:3000/api/v1
- API Documentation: http://localhost:3000/api/docs
Backend:
cd backend
npm run build
npm run start:prodFrontend:
cd frontend
npm run build
npm run startcd backend
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covcd frontend
# Unit tests
npm run test
# E2E tests (Playwright)
npx playwright test
# Watch mode
npm run test:watch# Build images
docker-compose -f docker-compose.prod.yml build
# Start services
docker-compose -f docker-compose.prod.yml up -d
# View logs
docker-compose -f docker-compose.prod.yml logs -fSee DEPLOYMENT.md for detailed deployment guides:
- AWS (EC2, ECS, RDS)
- Google Cloud Platform
- Microsoft Azure
- Vercel (frontend)
- Heroku
When running in development mode, access interactive API documentation at:
http://localhost:3000/api/docs
Complete API documentation is available in API-SPECIFICATION.md
Register a user:
curl -X POST http://localhost:3000/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "Password123!",
"firstName": "John",
"lastName": "Doe"
}'Get products:
curl http://localhost:3000/api/v1/products?limit=10&page=1shopeasy/
βββ backend/ # NestJS Backend
β βββ prisma/
β β βββ schema.prisma # Database schema
β β βββ migrations/ # Database migrations
β β βββ seed.ts # Database seeder
β βββ src/
β β βββ common/ # Shared utilities
β β βββ config/ # Configuration
β β βββ modules/ # Feature modules
β β βββ app.module.ts # Root module
β β βββ main.ts # Entry point
β βββ test/ # Tests
β βββ package.json
β
βββ frontend/ # Next.js Frontend
β βββ src/
β β βββ app/ # App router pages
β β βββ components/ # React components
β β βββ lib/ # Utilities, hooks, stores
β β βββ types/ # TypeScript types
β βββ public/ # Static assets
β βββ package.json
β
βββ docker/ # Docker configurations
β βββ docker-compose.dev.yml
β βββ docker-compose.prod.yml
β
βββ docs/ # Documentation
βββ ARCHITECTURE.md
βββ API-SPECIFICATION.md
βββ DATABASE-SCHEMA.md
βββ IMPLEMENTATION-PLAN.md
βββ DEPLOYMENT.md
We welcome contributions! Please see CONTRIBUTING.md for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Your Name - Initial work - YourGitHub
- NestJS for the amazing backend framework
- Next.js for the powerful React framework
- Prisma for the excellent ORM
- Shadcn UI for beautiful components
- All open-source contributors
For support, email support@shopeasy.com or join our Slack channel.
- User authentication & authorization
- Product catalog & search
- Shopping cart & wishlist
- Order management
- Payment integration (Stripe)
- Admin dashboard
- Mobile app (React Native)
- Multi-vendor marketplace
- Real-time chat support
- AI-powered recommendations
- Advanced analytics
- Internationalization (i18n)
- Progressive Web App (PWA)
- Lighthouse Score: 95+ (Performance, Accessibility, Best Practices, SEO)
- Response Time: < 200ms (P95)
- Uptime: 99.9% SLA
- Supported Concurrent Users: 10,000+
- OWASP Top 10 compliant
- Regular security audits
- Automated dependency updates (Dependabot)
- Input validation and sanitization
- SQL injection prevention
- XSS protection
- CSRF protection
- Rate limiting
- Secure headers (Helmet.js)
Made with β€οΈ by the ShopEasy Team
β Star us on GitHub β it helps!