Files
lcbp3/specs/05-Engineering-Guidelines
admin 5eff8861e1
All checks were successful
Build and Deploy / deploy (push) Successful in 1m0s
refactor(specs): merge 08-infrastructure into canonical 04-06 dirs
- Append live QNAP configs to 04-01-docker-compose.md (Appendix A)
  - MariaDB+PMA, Redis+Elasticsearch, NPM, Gitea, n8n, App stack
- Append SSH setup + Secrets management to 04-06-security-operations.md
  - Appendix A: SSH key setup, config, hardening, port forwarding
  - Appendix B: .env structure, secret generation, rotation, GPG backup
- Append QNAP/Gitea CI/CD docs to 04-04-deployment-guide.md
  - Appendix A: Container Station deployment steps
  - Appendix B: Gitea Actions CI/CD pipeline setup
  - Appendix C: act_runner (ASUSTOR) installation
- Move Git_command.md -> 05-Engineering-Guidelines/05-05-git-cheatsheet.md
- Move docker-compose-app.yml, lcbp3-monitoring.yml, lcbp3-registry.yml,
  grafana/ -> 04-Infrastructure-OPS/
- Archive lcbp3-db.md -> 99-archives/
- Remove all legacy 08-infrastructure/* files from git
- Remove Google OAuth client_secret JSON from git index (security)
- Add .gitignore rules: *client_secret*.json, *service_account*.json,
  specs/08-infrastructure/
- Update 04-Infrastructure-OPS/README.md with new file index
2026-02-23 15:03:35 +07:00
..

🛠️ Implementation Specification

แนวทางการพัฬนาและมาตรฐานทางเทคนิคของระบบ LCBP3-DMS

เอกสารชุดนี้รวบรวมมาตรฐานการเขียนโปรแกรม แนวทางการพัฒนา และรายละเอียดการนำสถาปัตยกรรมไปใช้งานจริง ทั้งในส่วนของ Backend และ Frontend


📊 Document Status

Attribute Value
Version 1.7.0
Status Active
Last Updated 2025-12-18
Owner Nattanin Peancharoen
Classification Internal Technical Documentation

📚 Table of Contents


🎯 หลักการพัฒนาหลัก (Core Principles)

เพื่อให้ระบบมีความมั่นคง ยืดหยุ่น และดูแลรักษาง่าย การพัฒนาต้องยึดหลักการดังนี้:

  1. Type Safety Everywhere - ใช้ TypeScript อย่างเข้มงวด ห้ามใช้ any
  2. Modular Dependency - แยก Logic ตาม Module หลีกเลี่ยง Circular Dependency
  3. Idempotency - การสร้างหรือแก้ไขข้อมูลต้องรองรับการกดซ้ำได้ (Idempotency-Key)
  4. Security by Default - ตรวจสอบ Permission (RBAC) และ Validation ในทุก Endpoint
  5. Fail Fast & Log Everything - ดักจับ Error ตั้งแต่เนิ่นๆ และบันทึก Audit Logs ที่สำคัญ

📖 คู่มือการพัฒนา (Implementation Guides)

1. FullStack JS Guidelines

แนวทางการพัฒนาภาพรวมทั้งระบบ (v1.7.0)

  • โครงสร้างโปรเจกต์ (Monorepo-like focus)
  • Naming Conventions & Code Style
  • Secrets & Environment Management
  • Two-Phase File Storage Algorithm
  • Double-Lock Mechanism for Numbering

2. Backend Guidelines

แนวทางการพัฒนา NestJS Backend

  • Modular Architecture Detail
  • DTO Validation & Transformer
  • TypeORM Best Practices & Optimistic Locking
  • JWT Authentication & CASL Authorization
  • BullMQ for Background Jobs

3. Frontend Guidelines

แนวทางการพัฒนา Next.js Frontend

  • App Router Patterns
  • Shadcn/UI & Tailwind Styling
  • TanStack Query for Data Fetching
  • React Hook Form + Zod for Client Validation
  • API Client Interceptors (Auth & Idempotency)

4. Document Numbering System

รายละเอียดการนำระบบออกเลขที่เอกสารไปใช้งาน

  • Table Schema: Templates, Counters, Audit
  • Double-Lock Strategy (Redis Redlock + Database VersionColumn)
  • Reservation Flow (Phase 1: Reserve, Phase 2: Confirm)
  • API Specs for Numbering Management

🧪 Testing Strategy

รายละเอียดอยู่ในเอกสาร: Testing Strategy

  • Unit Testing: NestJS (Jest), React (Vitest)
  • Integration Testing: API Endpoints (Supertest)
  • E2E Testing: Playwright สำหรับ Critical Flows
  • Special Tests: Concurrency Tests สำหรับ Document Numbering

🛠️ Technology Stack Recap

Layer Primary Technology Secondary/Supporting
Backend NestJS (Node.js) TypeORM, BullMQ
Frontend Next.js 14+ Shadcn/UI, Tailwind
Database MariaDB 11.8 Redis 7 (Cache/Lock)
Search Elasticsearch -
Testing Jest, Vitest Playwright


LCBP3-DMS Implementation Specification v1.7.0

FullStackBackendFrontendTesting

Main READMEArchitectureRequirements