ApniDukaan is a full-stack e-commerce project implementing a microservices architecture. The repository includes a Next.js frontend, multiple Node.js/Express services, and infrastructure for local and containerized development.
This project demonstrates a modular e-commerce system with separate services for catalog, users, orders, payments, cart, search, notifications, and an API gateway. It also includes deployment and monitoring configurations.
- Product catalog, cart, checkout, and order management
- Authentication and role-based access control
- Payment integration (Stripe and Razorpay)
- Search (Elasticsearch) and analytics endpoints
- PWA setup with service worker
- Docker and Kubernetes manifests for deployment
- Prometheus and Grafana monitoring configuration
- Frontend:
Next.js,TypeScript,Tailwind CSS,Jest - Backend:
Node.js,Express,TypeScript - Data:
MongoDB,Redis - Search and messaging:
Elasticsearch,Kafka - Infrastructure:
Docker,Kubernetes,Nginx,Prometheus,Grafana
Prerequisites: Node.js >= 18, npm >= 8, MongoDB, Docker (optional), Git.
git clone https://github.com/your-username/apnidukaan-ecommerce.git
cd apnidukaan-ecommerce
npm installWorkspaces install all packages under frontend and backend/*.
- Copy environment examples where needed and adjust values.
- Root:
env.example→.env - Frontend:
frontend/.env.example→frontend/.env.local - Services: each service may include
.env.example
- Root:
You can also run:
npm run setup:env- Start all services (development):
npm run dev
- Start frontend only:
npm run dev:frontend
- Start selected backend services:
npm run dev:backend
- Build all workspaces:
npm run build
- Docker Compose (optional):
npm run docker:up
Default ports:
- Frontend:
http://localhost:3000 - API Gateway:
http://localhost:4000
apnidukaan-ecommerce/
├── frontend/ # Next.js application
├── backend/ # Microservices (api-gateway, catalog, user, order, payment, cart, search, notification, shared)
├── infrastructure/ # Docker and Kubernetes configs
├── docs/ # Documentation
├── scripts/ # Utility scripts
├── package.json # Root workspaces and scripts
└── README.md
Additional technical documentation is available under docs/:
docs/FEATURES_OVERVIEW.mddocs/DEVELOPMENT_GUIDE.mddocs/DEPLOYMENT_GUIDE.mddocs/API_DOCUMENTATION.md
This project is licensed under the MIT License. See LICENSE for details.
Each backend service has its own .env file with service-specific configurations.
# Local MongoDB
mongod --dbpath /path/to/your/db
# Or use MongoDB Atlas
# Update MONGODB_URI in .env files# Local Redis
redis-server
# Or use Redis Cloud
# Update REDIS_URL in .env files# Using Docker
docker run -d -p 9200:9200 -p 9300:9300 elasticsearch:7.17.0- Unit Tests: Individual component/function testing
- Integration Tests: API endpoint testing
- E2E Tests: Full user journey testing
# Run all tests
npm run test:all
# Run specific test suites
npm run test:frontend # Frontend tests only
npm run test:backend # Backend tests only
npm run test:integration # Integration tests only
# Run tests with coverage
npm run test:coverage
# Run tests in watch mode
npm run test:watch- Frontend: 95%+ coverage
- Backend: 90%+ coverage
- Integration: 85%+ coverage
# Start all services
docker-compose -f infrastructure/docker/docker-compose.yml up -d
# View logs
docker-compose -f infrastructure/docker/docker-compose.yml logs -f
# Stop services
docker-compose -f infrastructure/docker/docker-compose.yml down# Build specific service
docker build -t apnidukaan-catalog-service ./backend/catalog-service
# Run specific service
docker run -p 4001:4001 apnidukaan-catalog-service# Apply all manifests
kubectl apply -f infrastructure/k8s/
# Check deployment status
kubectl get pods
kubectl get services
# View logs
kubectl logs -f deployment/apnidukaan-frontend- Set up production environment variables
- Configure SSL certificates
- Set up monitoring and logging
- Configure backup strategies
-
Build production images
docker build -t apnidukaan-frontend:latest ./frontend docker build -t apnidukaan-api-gateway:latest ./backend/api-gateway # ... build other services -
Deploy to production
# Using Docker Compose docker-compose -f docker-compose.prod.yml up -d # Or using Kubernetes kubectl apply -f infrastructure/k8s/production/
- Prometheus: Metrics collection and storage
- Grafana: Visualization and dashboards
- AlertManager: Alert management
- Node Exporter: System metrics
- Custom Metrics: Application-specific metrics
- Grafana Dashboard: http://localhost:3001 (admin/admin)
- Prometheus: http://localhost:9090
- Health Checks: http://localhost:4000/health
- Application Metrics: Request rate, response time, error rate
- System Metrics: CPU, memory, disk usage
- Business Metrics: Orders, revenue, user activity
- Infrastructure Metrics: Database connections, cache hit rate
- Source: Amazon Product Dataset on Kaggle
- Scale: 1.3+ million products with real Amazon data
- Categories: 241+ product categories including:
- Fashion & Clothing (Women's, Men's, Kids')
- Electronics & Technology
- Home & Garden
- Toys & Games
- Beauty & Personal Care
- Sports & Outdoors
- Baby & Kids
- Pets & Animals
- Data Quality: Real product names, descriptions, prices, and categories
- Updates: Regular dataset synchronization for fresh product data
- Rich Metadata: Product descriptions, specifications, and attributes
- Category Hierarchy: Multi-level category organization
- Price Ranges: Realistic pricing data across all categories
- Inventory Management: Stock levels and availability tracking
- Search Optimization: Enhanced search with real product data
- Massive Product Catalog: 1.3M+ products with real Amazon data
- Advanced Categories: 241+ categories with hierarchical organization
- Smart Search: Elasticsearch-powered with real product data
- Shopping Cart: Persistent cart with real-time updates
- User Authentication: Secure JWT-based authentication
- Order Management: Complete order lifecycle management
- Payment Processing: Razorpay & Stripe integration with real APIs
- Reviews & Ratings: Customer review system
- Wishlist: Save products for later purchase
- PWA Support: Offline functionality and mobile app experience
- Multi-language: English/Hindi support with i18n
- Real-time Analytics: Business intelligence dashboard
- Notification System: Email, SMS, and push notifications
- Admin Panel: Comprehensive admin interface
- API Documentation: Complete REST & GraphQL APIs
- Monitoring: Full observability with Prometheus & Grafana
- Microservices Architecture: 8+ independent services
- Type Safety: 100% TypeScript coverage
- Testing: Comprehensive test suite (95%+ coverage)
- Security: OWASP-compliant security measures
- Performance: Optimized for speed and scalability
- SEO: Advanced search engine optimization
- Accessibility: WCAG 2.1 compliance
- Authentication: JWT-based authentication with refresh tokens
- Authorization: Role-based access control (RBAC)
- Input Validation: Comprehensive input sanitization
- Rate Limiting: API rate limiting to prevent abuse
- CORS: Proper cross-origin resource sharing configuration
- HTTPS: SSL/TLS encryption for all communications
- Security Headers: Comprehensive security headers
- Dependency Scanning: Regular security vulnerability scanning
- Regular security audits
- Dependency updates
- Secure coding practices
- Environment variable protection
- Database security
- API security
- Code Splitting: Dynamic imports for better loading
- Image Optimization: Next.js image optimization
- Caching: Redis caching for improved performance
- CDN Ready: Static asset optimization
- Database Indexing: Optimized database queries
- Bundle Optimization: Webpack optimization
- Lazy Loading: Component lazy loading
- Lighthouse Score: 95+ across all categories
- Core Web Vitals: Excellent performance
- Bundle Size: Optimized for production
- Load Time: < 2 seconds for initial load
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests for your changes
- Run the test suite:
npm run test:all - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow TypeScript best practices
- Write comprehensive tests
- Follow the existing code style
- Update documentation as needed
- Ensure all tests pass
- Ensure your code follows the project's coding standards
- Add tests for any new functionality
- Update documentation if needed
- Ensure all tests pass
- Request review from maintainers
- GraphQL API: Available at
/graphqlendpoint - REST API: Available at
/apiendpoints - OpenAPI Spec: Available at
/api/docs
# Kill process using port
lsof -ti:3000 | xargs kill -9# Check MongoDB status
brew services list | grep mongodb
# or
systemctl status mongod# Clean Docker containers and images
docker system prune -a- Check the Issues page
- Review the documentation
- Contact the development team
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js 14: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first styling
- Zustand: State management
- Apollo Client: GraphQL client
- PWA: Progressive Web App capabilities
- Node.js: JavaScript runtime
- Express.js: Web framework
- MongoDB: NoSQL database
- Redis: Caching and sessions
- Elasticsearch: Search engine
- Kafka: Message queuing
- JWT: Authentication tokens
- Docker: Containerization
- Kubernetes: Orchestration
- Nginx: Load balancing
- Prometheus: Metrics collection
- Grafana: Monitoring dashboards
- GitHub Actions: CI/CD pipeline
- Razorpay: Payment gateway integration
- Stripe: International payments
- MongoDB Atlas: Cloud database
- Redis Cloud: Cloud caching
- Elasticsearch Cloud: Managed search
- Kaggle Community: For the comprehensive Amazon product dataset
- Next.js Team: For the amazing React framework
- MongoDB Team: For the robust database solution
- Open Source Contributors: For the incredible ecosystem
- Razorpay: For seamless payment integration
- All Contributors: Who helped make this project possible
Ready to build the next generation of e-commerce? Clone this repository and start building your own enterprise-grade e-commerce platform with real Amazon product data!
git clone https://github.com/your-username/apnidukaan-ecommerce.git
cd apnidukaan-ecommerce
npm install
npm start