The Project

Mall & More is a complete single-vendor B2C e-commerce platform — from storefront to admin panel, product catalog to order tracking. Built for the European market: multi-language (Finnish, Swedish, English, Chinese), EUR pricing, and a single Docker container deployment.

Source code: github.com/hongyusu/site-ecommerce

Architecture

Browser  ->  Nginx (:80)  ->  Next.js (:3000)   # Frontend
                           ->  FastAPI (:8000)   # Backend API
                                   |
                              PostgreSQL (:5432)
                              Redis (:6379)

All services run in a single Docker container managed by supervisord. One docker run to deploy.

Tech Stack

LayerTechnology
FrontendNext.js 14 (App Router), TypeScript 5, Tailwind CSS 3.4
StateZustand (client), React Query (server), Axios
i18nnext-intl — FI/SV/EN/ZH with locale-prefixed routes
BackendFastAPI 0.109, Python 3.12, SQLAlchemy 2.0, Pydantic v2
AuthJWT (python-jose), bcrypt, role-based access
DatabasePostgreSQL 15, Redis 7
EmailResend API (falls back to console logging)
InfrastructureDocker, Nginx, supervisord, Docker Compose

Storefront

Homepage & Product Catalog

Homepage

The homepage features 39 products across 24 categories (8 top-level + 16 subcategories). Products can be searched with autocomplete, sorted by price/name/rating, and filtered by price range and stock availability.

Product browsing

Product Detail & Variants

Product Detail

Product pages show images, descriptions, specifications, pricing, stock status, and customer reviews. Seven products support variants — sizes, storage options, or colors — each with independent stock tracking.

Product Variants in Chinese

The full UI works in four languages. Here’s the same product page in Chinese, demonstrating the i18n system with locale-prefixed routing (/zh/products/...).

Shopping Cart & Checkout

Shopping Cart

The cart validates stock in real-time — if a product goes out of stock or the requested quantity exceeds inventory, the user is notified immediately. Coupon codes (WELCOME10, SUMMER20, FREESHIP, SAVE50) can be applied.

Checkout

Checkout is a multi-step flow: select or add a shipping address, review the order summary, and confirm. Order confirmation emails are sent via the Resend API.

Orders & Tracking

Order Detail

Customers can view order history with full details — items, quantities, prices, shipping address, and tracking information. Public order tracking is available by order number + email (no login required).

Reviews & Wishlist

Reviews in Chinese

The review system supports ratings and text reviews. The database is seeded with 142 reviews. Customers can also save products to their wishlist.

More Storefront Views

Storefront view

Product grid

Mobile responsive

User profile

Admin Panel

The admin interface provides complete control over the store.

Dashboard & Analytics

Admin Dashboard

The dashboard shows KPIs, revenue trends, top products, and order distribution at a glance.

Inventory Management

Admin Inventory

Admins can view all products with stock levels, adjust inventory (+/- quantities), update pricing, and toggle product visibility.

Order Management

Admin Orders

Order management shows all customer orders with status tracking. Admins can update order status (pending → processing → shipped → delivered) and add tracking numbers.

User & Coupon Management

Admin Users

User management allows viewing all registered customers, searching by name or email, and toggling account active status.

Admin view

Coupon management

More Admin Views

Admin analytics

Admin detail

Database

13 tables covering the complete e-commerce domain: users, products, product_images, product_variants, product_reviews, categories, carts, cart_items, orders, order_items, addresses, coupons, wishlist_items.

Migrations managed by Alembic. The seed script creates a complete demo store on first boot — 39 products, 24 categories, 29 variants, 142 reviews, 6 users, and 4 coupon codes.

API Design

40+ REST endpoints under /api/v1/, organized by domain:

ModuleEndpointsKey Routes
Auth7register, login, verify email, password reset
Products5list, autocomplete, CRUD, reviews
Cart5get, clear, add/update/remove items
Orders5create, list, detail, track, admin status
Inventory5list, stats, stock adjust, pricing, toggle
Coupons5CRUD, validate code
Addresses5CRUD
Variants3list, create, update
Admin3users, toggle active, analytics

Full interactive documentation at /docs (Swagger UI).

Key Technical Decisions

Next.js App Router over Pages Router. Server components reduced client-side JavaScript. Locale-prefixed routing (/fi/, /sv/, /en/, /zh/) was cleaner with the nested layout system.

Zustand + React Query instead of Redux. Zustand handles client state (auth, cart, wishlist) with minimal boilerplate. React Query manages server state with automatic caching and optimistic updates.

FastAPI over Express/Node. Python’s SQLAlchemy + Alembic + Pydantic ecosystem is more mature for data operations. FastAPI’s automatic OpenAPI docs eliminated manual API documentation.

Single Docker container. For a small B2C site, supervisord manages all five processes (Nginx, Next.js, FastAPI, PostgreSQL, Redis) in one container. One command to deploy.

Docker Compose for development. Multi-container setup with hot reload for both frontend and backend during development.

Deployment

# All-in-one (production/demo)
docker build -f Dockerfile.allinone -t ecommerce .
docker run -d -p 80:80 ecommerce

# With persistent data
docker run -d -p 80:80 \
  -v ecommerce-pgdata:/var/lib/postgresql/15/main \
  -v ecommerce-redis:/var/lib/redis \
  ecommerce

# Development (hot reload)
docker compose up --build

The entrypoint script automatically runs database migrations and seeds demo data on first boot. No .env configuration required for demo — all environment variables have sensible defaults.

What I’d Do Differently

Payment integration. No Stripe or payment processing yet — the biggest gap for production use.

Image CDN. Product images served from the same container. A CDN would improve performance.

Search. Currently SQL LIKE queries. Meilisearch or Elasticsearch would be better for a larger catalog.

Testing. Good coverage through manual testing and seed data, but automated integration tests would improve maintainability.

Technical Stack

  • Next.js 14 (App Router) — frontend with SSR
  • TypeScript 5 + Tailwind CSS 3.4 — UI
  • Zustand + React Query — state management
  • next-intl — internationalization (4 languages)
  • FastAPI 0.109 — REST API backend
  • SQLAlchemy 2.0 + Alembic — ORM and migrations
  • Pydantic v2 — request/response validation
  • PostgreSQL 15 — primary database
  • Redis 7 — caching
  • JWT + bcrypt — authentication
  • Resend — transactional email
  • Docker + supervisord — single-container deployment
  • Docker Compose — multi-container development
  • Nginx — reverse proxy