A complete starter project for Blejta — Kosovo reseller storefront. Contains frontend (Next.js App Router + Tailwind), backend (NestJS + Prisma + PostgreSQL), and Docker Compose setup.
- Node.js 20+
- Docker & Docker Compose (optional, for containerized setup)
- PostgreSQL (if not using Docker)
-
Start all services:
docker-compose up --build -d
-
Run database migrations:
docker-compose exec backend npx prisma migrate dev -
Seed the database:
docker-compose exec backend npm run seed -
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:7058
- PostgreSQL: localhost:5432
-
Navigate to backend:
cd backend -
Install dependencies:
npm install
-
Set up environment:
cp .env.example .env # Edit .env with your database URL -
Set up database:
# Make sure PostgreSQL is running npx prisma generate npx prisma migrate dev npm run seed -
Start backend:
npm run start:dev
Backend will run at: http://localhost:7058
-
Navigate to frontend:
cd frontend -
Install dependencies:
npm install
-
Set up environment:
cp .env.example .env.local # Edit .env.local with your API URL -
Start frontend:
npm run dev
Frontend will run at: http://localhost:3000
blejta-root/
├─ docker-compose.yml
├─ .gitignore
├─ README.md
├─ backend/ # NestJS backend
│ ├─ src/
│ │ ├─ main.ts
│ │ ├─ app.module.ts
│ │ ├─ prisma.service.ts
│ │ ├─ products/
│ │ └─ orders/
│ ├─ Dockerfile
│ └─ package.json
├─ frontend/ # Next.js frontend
│ ├─ app/
│ │ ├─ layout.tsx
│ │ ├─ page.tsx
│ │ ├─ products/
│ │ ├─ cart/
│ │ ├─ checkout/
│ │ └─ admin/
│ ├─ components/
│ ├─ lib/
│ ├─ Dockerfile
│ └─ package.json
└─ backend/prisma/ # Prisma schema and migrations
├─ schema.prisma
└─ seed.ts
- Frontend: Next.js 15 (App Router) + React + TailwindCSS + Zustand
- Backend: NestJS + Prisma ORM + PostgreSQL
- Dev Tools: Docker Compose, TypeScript
- ✅ Product browsing and detail pages
- ✅ Shopping cart with Zustand state management
- ✅ Checkout flow with Stripe payment integration
- ✅ Real payment processing with Stripe
- ✅ Admin dashboard for viewing orders
- ✅ User authentication & authorization (JWT)
- ✅ RESTful API for products, orders, and payments
- ✅ Docker Compose setup for easy development
npm run start:dev- Start development servernpm run build- Build for productionnpm run prisma:generate- Generate Prisma clientnpm run prisma:migrate- Run database migrationsnpm run seed- Seed database with sample data
npm run dev- Start development servernpm run build- Build for productionnpm run start- Start production server
GET /products- Get all productsGET /products/:id- Get single product
POST /orders- Create new orderGET /orders- Get all orders (admin only)GET /orders/:id- Get single orderPATCH /orders/:id- Update order status
POST /payments/create-intent- Create payment intentPOST /payments/confirm- Confirm paymentPOST /payments/webhook- Stripe webhook handler
POST /auth/register- Register new userPOST /auth/login- Login userGET /auth/me- Get current user (protected)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/blejta?schema=public
PORT=7058
JWT_SECRET=your_secret_key
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
NEXT_PUBLIC_API_URL=http://localhost:7058
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here
-
Create a Stripe account at https://stripe.com
-
Get your API keys:
- Go to https://dashboard.stripe.com/test/apikeys
- Copy your Publishable key (starts with
pk_test_) - Copy your Secret key (starts with
sk_test_)
-
Set up webhook:
For Production:
- Go to https://dashboard.stripe.com/test/webhooks (test mode) or https://dashboard.stripe.com/webhooks (live mode)
- Click "Add endpoint"
- Enter your endpoint URL:
https://your-backend-url.com/payments/webhook - Select events:
payment_intent.succeeded,payment_intent.payment_failed - Click "Add endpoint"
- Click on the webhook you just created
- In the "Signing secret" section, click "Reveal" and copy the secret (starts with
whsec_)
For Local Development (using Stripe CLI):
- Install Stripe CLI: https://stripe.com/docs/stripe-cli
- Run:
stripe listen --forward-to localhost:7058/payments/webhook - The CLI will display a webhook signing secret (starts with
whsec_) - use this in your local.env - This allows you to test webhooks locally without deploying
-
Update environment variables:
- Add
STRIPE_SECRET_KEYto backend.env - Add
STRIPE_WEBHOOK_SECRETto backend.env(for webhooks) - Add
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYto frontend.env.local
- Add
-
For Docker setup:
- Update
docker-compose.ymlwith your Stripe keys, or - Create a
.envfile in the project root with:STRIPE_SECRET_KEY=sk_test_... STRIPE_WEBHOOK_SECRET=whsec_... NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
- Update
-
Test payments:
- Use test card:
4242 4242 4242 4242 - Any future expiry date
- Any 3-digit CVC
- See more test cards: https://stripe.com/docs/testing
- Use test card:
- Deploy on Render / Railway / Fly / DigitalOcean App Platform
- Set environment variables in your hosting platform
- Run migrations:
npx prisma migrate deploy
- Deploy on Vercel (recommended) or any Node.js hosting
- Set
NEXT_PUBLIC_API_URLto your backend URL - Build command:
npm run build - Start command:
npm run start
- Use managed PostgreSQL (Neon / Supabase / Render DB / DigitalOcean Managed DB)
- Update
DATABASE_URLin backend environment
- Add authentication (JWT + login page)
- Add Stripe payment integration
- Add order status update actions in admin
- Add product image upload (Cloudinary integration)
- Add SMS/email notifications
- Add order tracking for customers
- Add Temu order automation scripts
MIT
Built with ❤️ for Blejta