Skip to content

Tech Stack

ทุก library ที่ใช้ในระบบ พร้อม version (อ้างอิงจาก package.json จริง) และเหตุผลที่เลือก

Backend — apps/api

LibraryVersionบทบาท / เหตุผลที่เลือก
Node.js>= 20.0.0 (engines)LTS, native fetch, top-level await, ES2022
NestJS^11.0.0Opinionated framework — DI + decorators + module system → maintainable เมื่อโตเกิน 20+ modules. Alternative: Express ตรง ๆ แต่ขาด structure
@nestjs/platform-express^11.0.0Express adapter (อนุรักษ์นิยมกว่า Fastify, ecosystem กว้างกว่า)
@nestjs/config^4.0.0Env var loader + Joi validation schema
@nestjs/jwt^11.0.0JWT signing/verification — wrap jsonwebtoken
@nestjs/passport + passport-jwt^11.0.0 / ^4.0.1Strategy pattern สำหรับ Bearer token
@nestjs/swagger^11.0.0Auto-generate OpenAPI 3 จาก decorators — เปิดเฉพาะ non-prod
@nestjs/event-emitter^3.0.0In-process event bus (สำหรับ webhook trigger, audit, …)
Prisma^6.0.0Type-safe ORM, migration tool, ใช้กับ PostgreSQL pooled + direct URL ได้สะอาด. Alternative: TypeORM (decorator-based แต่ type ไม่แข็งเท่า), Drizzle (ใหม่กว่า, ecosystem เล็กกว่า)
@prisma/client^6.0.0Generated client
bcrypt^6.0.0Password hashing (SALT_ROUNDS=12)
class-validator^0.14.1DTO validation via decorators (@IsString(), @IsUUID(), …)
class-transformer^0.5.1DTO ↔ plain object transformation
joi^18.2.1Validation schema สำหรับ env vars เท่านั้น (Nest ConfigModule integration)
exceljs^4.4.0Generate .xlsx reports
pdfkit^0.15.0Generate PDF labels / receipts
multer^2.1.1File upload (multipart/form-data)
@aws-sdk/client-s3 + s3-request-presigner^3.1054.0S3-compatible client สำหรับ Cloudflare R2 (presigned URLs)
uuid^11.0.0UUID v4 generation (idempotency keys, request IDs)
rxjs^7.8.1Required by NestJS (interceptors)
reflect-metadata^0.2.2Required by NestJS DI

Frontend — apps/web + apps/admin

ทั้งสอง app ใช้ stack เหมือนกันทุก library (ตั้งใจให้เรียนรู้ง่ายสำหรับทีม dev)

LibraryVersionบทบาท / เหตุผลที่เลือก
React^19.0.0UI library — chosen สำหรับ ecosystem + team familiarity. Concurrent features (Suspense, Transitions) ใช้ได้
react-dom^19.0.0DOM renderer
Vite^6.0.0Build tool — instant HMR, esbuild dep prebundle, native ESM. Alternative: Next.js (เกินจำเป็นเพราะไม่ต้อง SSR), CRA (deprecated)
react-router-dom^7.0.0Client-side routing — data router แต่ใช้แบบ traditional <Routes>
@tanstack/react-query^5.60.0Server state management — cache invalidation, refetching, optimistic update. Alternative: SWR (เล็กกว่า) / Redux Toolkit Query (overkill)
axios^1.7.0HTTP client — interceptor pattern เหมาะกับ JWT inject + 401 redirect
tailwindcss^3.4.0Utility CSS — pair กับ Sarabun font (Thai-friendly). Alternative: CSS Modules / styled-components
autoprefixer + postcss^10.4.0 / ^8.4.0PostCSS pipeline
i18next + react-i18next^24.0.0 / ^15.0.0Runtime i18n — รองรับการสลับภาษาไทย ↔ อังกฤษโดยไม่ reload
lucide-react^0.460.0Icon set (tree-shakable SVG)
react-hot-toast^2.6.0Toast notifications (wrapper ใน lib/toast.ts)
TypeScript^5.7.0Type safety

ทำไมไม่ใช้ form library?

form ในระบบส่วนใหญ่เป็น CRUD modal — ใช้ useState ตรง ๆ พอแล้ว ไม่ต้อง React Hook Form / Formik. ผลลัพธ์: bundle เล็กลง, learning curve ต่ำ

Docs — apps/docs

LibraryVersionบทบาท
VitePress^1.5.0Static-site generator สำหรับ markdown — Vite + Vue under-the-hood, build เร็ว, search ในตัว

Infra / DevOps

ToolVersionบทบาท
pnpm>= 9.0.0 (engines)Workspace + package manager — disk-efficient (hard links), strict, fast
pnpm-workspace.yamlกำหนด apps/* + packages/* เป็น workspaces
Cloudflare PagesHosting frontend (3 projects: wms-dev, wms-admin, wms-docs)
Render.comFree tierHosting backend NestJS (Singapore, auto-sleep หลัง 15 นาที)
SupabaseManaged PostgreSQL 16 + PgBouncer (pooled)
Cloudflare R2S3-compatible object storage (no egress fees)
GitHubSource control (private repo, push to master triggers Render redeploy)
Docker Compose3.9Local-only stack (postgres + redis + api) สำหรับ dev ที่ไม่อยากใช้ Supabase

Testing & Dev Tooling

LibraryVersionบทบาท
Jest^29.7.0Unit/e2e test runner (backend)
ts-jest^29.2.0TS preset
@nestjs/testing^11.0.0TestingModule สำหรับ DI ใน tests
ts-node^10.9.0รัน Prisma seed + scripts ตรง ๆ
ESLint(via @nestjs/cli)Linting

เวอร์ชั่นโดยรวม

  • TypeScript ใช้ ^5.7.0 ทุก app
  • ทุก React app ใช้ type: "module" (ESM)
  • API ใช้ CommonJS เพื่อ compatibility กับ NestJS CLI

เผยแพร่ภายใต้ Digital Outsourcing