Demo

ဖိုင်တွဲအပြင်အဆင်

Quan ERP Node template ၏ repo root၊ base runtime၊ plugin source layout နှင့် watch / install artifact တည်နေရာများကို ရှင်းလင်းစွာ ဖော်ပြပါသည်။

အနှစ်ချုပ်

အလွှာ သုံးခု ရှိပါသည် — plugins/ (source)၊ base/available-plugins/ (staged build)၊ နှင့် base/backend/installed-plugins/ (runtime တွင် အသက်ဝင်သော မိတ္တူ)။ quan-erp CLI က source မှ available သို့ ရေးသားပြီး၊ ERP UI က available မှ installed သို့ ရွှေ့ပါသည်။

  • quan-erp ကို အမြဲ repo root မှ run ရပါမည်
  • plugins/ folder အမည်နှင့် module.metadata.json ၏ name တူညီရပါမည်
  • Package အမည်များမှာ @quan-erp-plugins/<name>-backend|frontend ဖြစ်ရပါမည်
  • အခြား plugin တစ်ခု၏ src/ ကို တိုက်ရိုက် import မလုပ်ရပါ

1. Repository root

quan-erp-node-template (သို့မဟုတ် သင့် fork) ၏ အပေါ်ဆုံး layout မှာ အောက်ပါအတိုင်း ဖြစ်ပါသည်။

  • base/ — Docker Compose ဖြင့် လည်ပတ်သော platform core
  • plugins/ — လုပ်ငန်းသုံး module source; sample-es ကို နမူနာယူပါ
  • .agents/ — AI agent skill နှင့် rule များ
  • erp — quan-erp watch <name> ကို ဦးစားပေး အသုံးပြုပါ
SHworkspace
1my-quan-erp/ # repo root (run quan-erp here) 2├── erp # CLI binary — watch / build / pack / new 3├── .agents/ # Quan ERP skills & rules for AI agents 4├── .gitignore 5├── README.md 6├── base/ # runnable platform core (Docker) 7│ ├── docker-compose.yaml # db, redis, backend, frontend 8│ ├── available-plugins/ # built plugins waiting to install 9│ │ └── <name>/<version>/ 10│ │ ├── backend/ 11│ │ ├── frontend/ 12│ │ └── module.metadata.json 13│ ├── backend/ 14│ │ ├── Dockerfile 15│ │ ├── .env / .env.sample # local secrets (do not commit real values) 16│ │ ├── installed-plugins/ # active plugins served at runtime 17│ │ │ └── <name>/ 18│ │ │ ├── backend/ 19│ │ │ ├── frontend/ 20│ │ │ └── module.metadata.json 21│ │ └── logs/ # optional host-mounted logs 22│ ├── frontend/ # base UI core image / nginx 23│ └── data/ # optional local volumes (db, redis, uploads) 24└── plugins/ # YOUR source code lives here 25 ├── sample-es/ # reference plugin — copy patterns from here 26 └── <my-plugin>/ # one folder per plugin 27 ├── module.metadata.json # name MUST match folder name 28 ├── backend/ 29 └── frontend/

2. base/ — platform core

Base သည် ပေါ့ပါးသော runtime ဖြစ်ပါသည် — compose service များ၊ plugin folder များနှင့် host config တို့ ပါဝင်ပါသည်။ လုပ်ငန်းသုံး UI ကို base frontend မဟုတ်ဘဲ plugins တွင် ရေးသားရပါသည်။

  • docker-compose.yaml — db၊ redis၊ backend၊ frontend
  • available-plugins/<name>/<version>/ — quan-erp watch|build:prod output
  • backend/installed-plugins/<name>/ — installed=true ဖြစ်သော plugin များ
  • backend/.env — လျှို့ဝှက်ချက်များ (တကယ့် တန်ဖိုးများကို git မတင်ရပါ)
  • frontend/ — base core; plugin များက runtime တွင် UI ထည့်သွင်းပါသည်
  • data/ — ဒေသခံ volume များ (optional)

3. plugins/<name>/

Plugin တစ်ခုသည် metadata + backend package + frontend package တို့ဖြင့် ဖွဲ့စည်းထားပါသည်။

  • module.metadata.json သည် backend/ နှင့် frontend/ ဘေးတွင် ရှိပါသည်
  • Domain ကုဒ်ကို feature folder များအဖြစ် ခွဲထားသင့်ပါသည်
  • quan-erp pack:prod ပြီးနောက် output/ ပေါ်နိုင်ပါသည် (gitignore လုပ်နိုင်ပါသည်)
SHplugin
1plugins/<my-plugin>/ 2├── module.metadata.json # identity + deps + version contract 3├── backend/ 4│ ├── package.json # @quan-erp-plugins/<name>-backend 5│ ├── tsconfig.json 6│ ├── nest-cli / build config # as shipped by the template 7│ └── src/ 8│ ├── index.ts # IPlugin default export → getRootModule() 9│ ├── export.ts # optional: publish for other plugins 10│ ├── <feature>/ # one folder per domain (recommended) 11│ │ ├── *.controller.ts 12│ │ ├── *.service.ts 13│ │ └── dto/ 14│ └── schema/ # TypeORM entities (plugin tables) 15│ └── *.entity.ts 16└── frontend/ 17 ├── package.json # @quan-erp-plugins/<name>-frontend 18 ├── vite.config.ts 19 ├── tsconfig.json 20 ├── index.html 21 └── src/ 22 ├── index.tsx # PluginModule.register(AppRegistry) 23 ├── export.ts # public API for PluginAPI consumers 24 ├── api/<domain>/ # React Query + axios calls 25 ├── page/<feature>/ # screens / dialogs 26 ├── components/ # plugin-local UI pieces 27 ├── hooks/ # plugin-local hooks (optional) 28 ├── store/ # plugin-local Zustand (optional) 29 ├── locales/ # translation dictionaries (optional) 30 └── lib/ 31 ├── axios.ts # setAxiosClient / getAxiosClient 32 └── metadata.ts # typed module.metadata.json

4. module.metadata.json

CLI၊ discovery နှင့် UI install အတွက် အသုံးပြုသော identity ဖိုင် ဖြစ်ပါသည်။

  • name — plugins/<name>/ နှင့် တူညီရပါမည်
  • pluginVersion — available-plugins အောက်ရှိ ဗားရှင်း folder အမည်
  • requiredBasedVersion — base / @quan-erp/* နှင့် ကိုက်ညီရပါမည်
  • moduleEntryObject — backend root @Module class အမည်
  • pluginDependencies — အရင် load ရမည့် အခြား plugin များ
JSONmodule.metadata.json
1{ 2 "name": "sample-es", 3 "type": "", 4 "pluginVersion": "1.0.0", 5 "description": "Sample plugin", 6 "moduleEntryObject": "Module", 7 "requiredBasedVersion": "1.0.0", 8 "pluginDependencies": {} 9}

5. Backend layout

IPlugin ကို default-export လုပ်သော TypeScript package ဖြစ်ပါသည်။ Controller၊ service၊ DTO နှင့် entity များတွင် plugin namespace ထည့်သွင်းသင့်ပါသည်။

  • index.ts — host က import လုပ်သော entry (build ပြီးနောက် module.js)
  • schema/ — TypeORM entity များ; table အမည်ကို plugin ဖြင့် namespace လုပ်ပါ
  • dto/ — validation နှင့် transport အမျိုးအစားများ
  • export.ts — optional cross-plugin ထုတ်ပြန်မှု မျက်နှာပြင်
  • အခြား plugin ၏ backend/src ကို မထိရပါ
SHbackend
1plugins/<name>/backend/src/ 2├── index.ts 3# default-export class implements IPlugin 4# getRootModule() → @Module class 5# getMetadata() → module.metadata.json 6├── export.ts 7# optional — symbols other plugins may consume after publish 8├── <feature>/ # e.g. employee/, leave/, payroll/ 9│ ├── <feature>.controller.ts # @Controller + routes 10│ ├── <feature>.service.ts # @Service business logic 11│ ├── dto/ 12│ │ ├── create-*.dto.ts 13│ │ └── query-*.dto.ts 14│ └── <feature>.module bits # providers registered on root @Module 15└── schema/ 16 ├── <feature>.entity.ts # @Entity — namespace table names 17 └── index.ts # re-export entities for @Module({ entities })

6. Frontend layout

Vite React app ဖြစ်ပါသည်။ Core သည် src/index.tsx ကိုသာ load လုပ်ပြီး register(AppRegistry) ကို ခေါ်ပါသည်။

  • index.tsx — menu၊ route၊ dashboard၊ setting၊ report၊ PluginAPI.expose စသည်
  • api/ — HTTP နှင့် React Query
  • page/ — route အဆင့် မျက်နှာပြင်များ
  • lib/axios.ts — host client တံတား
  • lib/metadata.ts — metadata ကို typed အဖြစ် ဖတ်ရှုခြင်း
  • export.ts — အခြား plugin သုံးနိုင်သော တည်ငြိမ်သော API သာ ထုတ်ပြန်ပါ
SHfrontend
1plugins/<name>/frontend/src/ 2├── index.tsx 3# default-export PluginModule 4# register(AppRegistry): wire axios, menus, routes, dashboards, … 5├── export.ts 6# stable public surface for PluginAPI.expose / consumers 7├── api/ 8│ └── <domain>/ 9│ ├── <domain>.api.ts # axios + React Query hooks 10│ └── types.ts # request/response types 11├── page/ 12│ └── <feature>/ 13│ ├── <feature>.page.tsx # route screen 14│ ├── <feature>-form.tsx 15│ └── columns.tsx # table defs (optional) 16├── components/ # shared inside this plugin only 17├── hooks/ 18├── store/ 19├── locales/ 20│ ├── en.json 21│ └── mm.json 22└── lib/ 23 ├── axios.ts # host client bridge 24 └── metadata.ts # name / version / dependencies

7. Build နှင့် install လမ်းကြောင်းများ

Source၊ available နှင့် installed တို့သည် ကွဲပြားသော directory များ ဖြစ်ပါသည်။ Install ပြီးနောက် UI ဗလာဖြစ်ပါက plugins/ သာမက installed-plugins နှင့် module ဇယားကိုပါ စစ်ဆေးရပါမည်။

  • quan-erp watch|build:prod → available-plugins/<name>/<version>/
  • ERP UI Install → installed-plugins/<name>/
  • Install ပြီးသား ဖြစ်ပါက ဖွံ့ဖြိုးရေးအတွင်း watch က installed မိတ္တူကိုလည်း refresh လုပ်ပါသည်
  • quan-erp pack:prod → zip (ပုံသေ output/ သို့မဟုတ် သတ်မှတ်ထားသော path)
SHartifacts
1# Source (edit here) 2plugins/<name>/{backend,frontend,module.metadata.json} 3 4# After quan-erp watch|build:prod → staged for install 5base/available-plugins/<name>/<version>/ 6├── backend/ # compiled backend dist 7├── frontend/ # Vite build output 8└── module.metadata.json 9 10# After ERP UI Install → active at runtime 11base/backend/installed-plugins/<name>/ 12├── backend/ 13├── frontend/ 14└── module.metadata.json

8. စည်းကမ်းများ

  • အခြား plugin ၏ src/ ကို တိုက်ရိုက် import မလုပ်ရပါ
  • DB ဇယား၊ route၊ menu နှင့် registry id များကို plugin အမည်ဖြင့် namespace လုပ်ရပါမည်
  • API ကို src/api တွင် ထားရှိပါ — page component ထဲတွင် မရေးရပါ
  • available / installed ကို လက်ဖြင့် မပြင်ရပါ — quan-erp CLI နှင့် UI install ကို အသုံးပြုပါ
  • backend / frontend ၏ @quan-erp/* ဗားရှင်းများကို base image များနှင့် တူအောင် ထားရှိရပါမည်
  • မသေချာပါက sample-es ကို နမူနာအဖြစ် လိုက်နာပါ