Back to Home
Featured Case Study

Laptop Shop - E-commerce REST API and Storefront

A decoupled e-commerce platform: a REST API serving a Next.js storefront and admin dashboard, covering catalog search, cart, idempotent checkout, bank-transfer payments, flash sales, reviews and after-sales.

Role
Fullstack Developer (Backend-focused, Individual Project)
Clear timeframe
June 2025 - Present

Project Overview

A decoupled e-commerce platform: a REST API serving a Next.js storefront and admin dashboard, covering catalog search, cart, idempotent checkout, bank-transfer payments, flash sales, reviews and after-sales.

Tech Stack

Frontend
Next.jsReactTanStack Query
Backend
Node.jsExpress 5TypeScriptZodJWT
Database
Prisma ORMMySQL 8Redis
Infrastructure
BullMQDocker ComposeGitHub Actions
Testing & Tools
JestSupertestVitest

Key Responsibilities & Implementations

  • Architecture: Organized the API into 20+ feature modules with a routes → controller → service → Prisma flow, Zod request validation, DTO mappers and a unified error format. Generated the OpenAPI document and Swagger UI from the Zod schemas; the web client's types are generated from it.
  • Authentication: Short-lived JWT access token plus opaque refresh token in HttpOnly cookies. Refresh tokens are stored hashed and rotated, and reuse of a revoked token revokes the whole token family. Added role-based access (Admin/User), origin checks and Redis-backed rate limiting on login and register.
  • Orders and inventory: Checkout requires an Idempotency-Key, prices items on the server, and locks product rows with conditional stock updates inside one Prisma transaction to prevent overselling. Cancelling an order restores stock.
  • Flash sales: Claimed per-promotion quota and per-user limits atomically with conditional updates, and released them when an order is cancelled.
  • Async processing: Implemented a transactional outbox: a dispatcher publishes events to BullMQ queues, consumed by separate payment, notification, after-sales and price-alert workers that run as Docker Compose services.
  • Payments and storage: Integrated SePay bank-transfer payments behind a provider interface with reconciliation. Stored review and after-sales images in S3-compatible storage, with scripts to reconcile orphaned files.
  • Quality and delivery: Unit tests with Jest and Supertest (Prisma mocked), ESLint/Prettier with Husky hooks, GitHub Actions CI (lint, typecheck, test, build, Docker build), health and readiness endpoints, and structured logging with Pino and Sentry.
  • Frontend: Built the Next.js storefront and admin UI: Server Components for catalog pages, TanStack Query for cart, checkout and account flows.