A production-ready, high-performance e-commerce application built with Next.js 15, TypeScript and MongoDB. It ships with server-side rendering (SSR), role-based authentication, an admin dashboard, and seamless integrations for Tranzila payments and AliExpress product sourcing.
- Features
- Screenshot
- Demo
- Tech Stack
- Folder Structure
- Architecture Overview
- Getting Started
- Available Scripts
- Environment Variables
- Integrations
- Deployment
- Testing
- Contributing
- License
- Status
- π Role-based auth β NextAuth.js with JWT sessions (admin / user)
- π Shopping cart with persistent storage
- π¦ Order & inventory management via admin dashboard
- π Product catalog with search, filter & pagination
- βοΈ SSR & SSG for blazing-fast performance and SEO
- π³ Secure payments through Tranzila
- π€ AliExpress sourcing β import price, URL & auto-markup
- π Analytics ready β easily connect your favourite tools
- Next.js 15 (App Router)
- React 19 + TypeScript
- Tailwind CSS
- React Query
- Framer Motion
- Next.js API Routes
- MongoDB + Mongoose ODM
- JSON Web Tokens (JWT)
- Docker
- VPS (Ubuntu)
- Nginx reverse proxy
- GitHub Actions + webhooks for CI/CD
src/
ββ app/ # Next.js pages & layouts
ββ components/ # Reusable UI components
ββ controllers/ # API route handlers (MVC style)
ββ lib/ # Shared lib code (DB, auth)
ββ models/ # Mongoose schemas & types
ββ services/ # External service wrappers
ββ utils/ # Helpers & custom hooks
ββ styles/ # Global & scoped styles
- Client requests page β served by Next.js (SSR/SSG).
- API routes (under
src/pages/api) act as the BFF layer. - Handlers delegate to controllers which consume models (MongoDB).
- Auth guarded via middleware.ts (JWT validation & role checks).
- Static assets live in
public/and are served via Nginx in production.
- Node 18.17+
- pnpm or npm
- MongoDB instance (local or Atlas)
pnpm install # or npm installCopy .env.example to .env and fill in the values (see Environment Variables).
pnpm devThe app runs on http://localhost:3000 by default (Next.js) but proxies to 4000 in production.
pnpm build && pnpm start| Command | Description |
|---|---|
pnpm dev |
Start dev server with Turbopack |
pnpm build |
Compile for production |
pnpm start |
Serve built app on :4000 |
pnpm lint |
ESLint + TypeScript checks |
pnpm test |
Jest unit tests |
| Key | Description |
|---|---|
MONGODB_URI |
MongoDB connection string |
NEXTAUTH_URL |
Base URL for NextAuth |
NEXTAUTH_SECRET |
Session encryption key |
JWT_SECRET |
JWT signing secret |
NEXT_PUBLIC_API_URL |
Public URL for client API calls |
TRANZILA_TERMINAL_NAME |
Tranzila terminal ID |
TRANZILA_TERMINAL_PASSWORD |
Tranzila terminal password |
NEXT_PUBLIC_TRANZILA_TERMINAL_NAME |
Same as above, exposed to client |
ALIEXPRESS_APP_KEY |
AliExpress app key |
ALIEXPRESS_APP_SECRET |
AliExpress app secret |
ALIEXPRESS_ACCESS_TOKEN |
AliExpress OAuth access token |
ALIEXPRESS_REFRESH_TOKEN |
AliExpress refresh token |
ALIEXPRESS_TOKEN_EXPIRY |
ISO expiry date |
ALIEXPRESS_MARKUP_PERCENTAGE |
Auto-markup percentage for import prices |
DEBUG |
Enable verbose logging |
src/services/tranzilaService.ts wraps the Tranzila REST API. Credentials come from env vars. In production ensure your domain is whitelisted in the Tranzila back-office.
src/services/aliExpressService.ts interfaces with the AliExpress Open Platform to fetch product data. A markup percentage is applied before persisting the product.
This repo is optimised for a simple Docker + Nginx stack:
docker build -t ali-shop .
docker run -d --env-file .env --name ali-shop -p 4000:4000 ali-shopUse the provided nginx.conf (example in infra/) to reverse-proxy https://your-domain.com β http://localhost:4000.
CI/CD can be achieved with the included GitHub webhook that triggers a pull & redeploy script on the server.
Unit tests reside alongside modules and are executed with:
pnpm test- Fork project
- Create feature branch
git checkout -b feature/awesome - Commit changes & open PR
Ensure ESLint passes (
pnpm lint) before submitting.
Distributed under the MIT License. See LICENSE for details.
π§ Active development β suitable for personal & experimental use.

