Files
2026-06-06 10:40:48 +08:00
..
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00
2026-06-06 10:40:48 +08:00

ShopApp — Fullstack Project

一款支持商品浏览、购物车、在线支付和物流追踪的电商应用。

Architecture

apps/
├── web/        # Next.js 15 + TypeScript + Tailwind CSS
└── api/        # Fastify 5 + TypeScript + SQLite (sql.js)

packages/
├── shared-types/   # @shared/types — shared TypeScript interfaces
└── shared-config/  # @shared/config — shared configuration

Quick Start

# Install all dependencies (root + workspaces)
npm install

# Start both frontend and backend in dev mode
npm run dev

# Or start individually
npm run dev:web    # http://localhost:3000
npm run dev:api    # http://localhost:3001

Build

# Build everything
npm run build

# Or individually
npm run build:web
npm run build:api

Testing

# Run API tests
npm test

API Endpoints

Auth

  • POST /api/auth/register
  • POST /api/auth/login
  • GET /api/auth/me

Resources

users

  • GET /api/users — List
  • GET /api/users/:id — Get
  • POST /api/users — Create
  • PUT /api/users/:id — Update
  • DELETE /api/users/:id — Delete

products

  • GET /api/products — List
  • GET /api/products/:id — Get
  • POST /api/products — Create
  • PUT /api/products/:id — Update
  • DELETE /api/products/:id — Delete

orders

  • GET /api/orders — List
  • GET /api/orders/:id — Get
  • POST /api/orders — Create
  • PUT /api/orders/:id — Update
  • DELETE /api/orders/:id — Delete

stocktaking

  • GET /api/stocktaking — List
  • GET /api/stocktaking/:id — Get
  • POST /api/stocktaking — Create
  • PUT /api/stocktaking/:id — Update
  • DELETE /api/stocktaking/:id — Delete

suppliers

  • GET /api/suppliers — List
  • GET /api/suppliers/:id — Get
  • POST /api/suppliers — Create
  • PUT /api/suppliers/:id — Update
  • DELETE /api/suppliers/:id — Delete

stock_alerts

  • GET /api/stock_alerts — List
  • GET /api/stock_alerts/:id — Get
  • POST /api/stock_alerts — Create
  • PUT /api/stock_alerts/:id — Update
  • DELETE /api/stock_alerts/:id — Delete

System

  • GET /api/health — Health check

Environment Variables

See .env.example for all available configuration.