A modern, production-ready e-commerce platform built with Next.js 16, featuring a customer store and comprehensive admin dashboard. Designed with best practices in Docker, authentication, and state management.
- Product browsing with CDN-powered images via ImageKit
- Google OAuth authentication with NextAuth.js
- Secure checkout with Razorpay payment integration
- Order history and tracking
- Responsive design with Tailwind CSS
- Complete product management (CRUD operations)
- Real-time order tracking and status updates
- Inventory management across warehouses
- Delivery person assignment system
- Interactive data tables with TanStack Table
- Multi-stage Docker builds - Production-optimized images (~150MB)
- Type-safe full-stack - End-to-end TypeScript with Zod validation
- Modern state management - Zustand + TanStack Query
- Server Actions enabled - Reduced client-side JavaScript
- Performance optimized - Turbopack for development, ImageKit for images
graph TB
A[Next.js App Router] --> B[Frontend UI]
A --> C[API Routes]
B --> D[Cusomter Store]
B --> E[Admin Dashboard]
C --> F[Authentication]
C --> G[Product Management]
C --> H[Order Processing]
F --> I[PostgreSQL via Drizzle]
G --> I
H --> I
J[Docker Container] --> A
J --> K[Environment Variables]
L[ImageKit CDN] --> M[Image Storage]
- Node.js 18+ and npm
- Docker & Docker Compose
- PostgreSQL database (or Supabase)
- Clone and install dependencies
git clone https://github.com/pankaj-yadav73/choco.git
cd choco
npm install- Configure environment
cp .env.example .env
# Fill in your environment variables in .env- Run development server
npm run dev- Access the application
- Customer store: http://localhost:3000
- Admin dashboard: http://localhost:3000/admin
- API documentation: Available in the codebase
# Build and run with Docker Compose
docker-compose up -d
# Rebuild with no cache
docker-compose build --no-cache
# View logs
docker logs choco-choco-app-1 -f
# Stop containers
docker-compose downchoco/
βββ src/
β βββ app/
β β βββ (client)/ # Customer-facing pages
β β βββ admin/ # Admin dashboard pages
β β βββ api/ # REST API endpoints
β βββ lib/
β β βββ db/ # Database schema and connection
β β βββ auth/ # NextAuth configuration
β β βββ validators/ # Zod validation schemas
β βββ http/ # API client configuration
β βββ store/ # Zustand state stores
β βββ components/ # Reusable UI components
βββ Dockerfile # Multi-stage build configuration
βββ docker-compose.yml # Service orchestration
βββ drizzle.config.ts # Database migrations
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 16 + React 19 | SSR/SSG with App Router |
| Styling | Tailwind CSS + Radix UI | Utility-first styling + accessible components |
| Database | PostgreSQL + Drizzle ORM | Type-safe database operations |
| Auth | NextAuth.js | Google OAuth with session management |
| Forms | React Hook Form + Zod | Type-safe form validation |
| State | Zustand + TanStack Query | Client + server state management |
| Images | ImageKit | CDN with automatic optimization |
| Container | Docker | Production-ready deployment |
| Payments | Razorpay | Secure payment processing |
Create a .env file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@host:port/database"
# Authentication
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"
# Application
NEXT_PUBLIC_BACKEND_URL="http://localhost:3000/api"
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY="your-encryption-key"
# Image Storage
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY="your-public-key"
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT="https://ik.imagekit.io/your-endpoint"
IMAGEKIT_PRIVATE_KEY="your-private-key" # Server-onlyThe application uses PostgreSQL with the following core tables:
- users - User accounts with role-based permissions
- products - Product catalog with pricing and images
- orders - Customer orders with status tracking
- warehouses - Inventory storage locations
- inventories - Stock management across warehouses
- deliveryPersons - Delivery personnel assignment
This project implements several Docker production best practices:
- Multi-stage builds - Separate build and runtime stages
- Non-root user - Container runs as
nextjsuser (UID 1001) - Standalone output - Minimal production image with only necessary files
- Build vs runtime env vars - Proper separation of configuration
- Health checks - Container orchestration readiness
# Start development server with Turbopack
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Database migrations
npm run db:generate # Generate migration files
npm run db:run # Run migrations| Method | Endpoint | Description |
|---|---|---|
GET |
/api/products |
List all products |
POST |
/api/products |
Create new product |
GET |
/api/products/[id] |
Get single product |
POST |
/api/orders |
Create new order |
GET |
/api/orders |
List all orders (admin) |
PATCH |
/api/orders/status |
Update order status |
GET |
/api/orders/history |
Get user's order history |
- Multi-stage builds reducing image size by 85%
- Proper environment variable management
- Security best practices (non-root user)
- End-to-end TypeScript
- Zod validation on both client and server
- Drizzle ORM with autocomplete queries
- Google OAuth with NextAuth.js
- Role-based access control (customer/admin)
- Secure session management
- Image optimization via ImageKit CDN
- Server Actions reducing client bundle
- Turbopack for faster development
(Add your screenshots here)
- Customer product page
- Admin dashboard
- Order management interface
- Docker build output
This project demonstrates:
- Next.js App Router patterns
- Docker containerization best practices
- Full-stack TypeScript development
- Modern authentication flows
- Production deployment considerations
vercel# Build and push to registry
docker build -t yourusername/choco .
docker push yourusername/choconpm run build
npm start- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Pankaj Yadav
- GitHub: @Py8050147
- Portfolio: [Your Portfolio Link]
- LinkedIn: [https://www.linkedin.com/in/pankaj-kumar-a08b921b2/]
β Star this repo if you found it helpful! β