মূল কনটেন্টে যান
১৪ দিনের ফ্রি ট্রায়াল, কার্ড লাগবে না৯টি ভাষা১৭৬টি ব্যবসার ধরন · ৫০টি অ্যাপ
BN· USD
লাইভ ডেমো চালিয়ে দেখুনফ্রি ট্রায়াল শুরু করুন

এই পেজটি এখনো বাংলা ভাষায় পাওয়া যায় না, তাই ইংরেজিতে দেখানো হচ্ছে।

Plugin package layout and lifecycle

The folder a plugin lives in, what each file does, and what happens on preview, install, enable/disable and uninstall.

  • about 8 min
modules/<id>/
modules/<id>/
  module.json              manifest — validated with zod; id must equal the folder name
  src/index.ts             server entry: export function register() { return definePlugin({ ... }) }
  src/*.ts                 pure logic (testable without a database) + server helpers
  app/admin/**/page.tsx    admin pages  → /admin/<id>/<path>
  app/admin/**/actions.ts  "use server" actions used by those pages
  app/api/**/route.ts      API routes   → /api/plugins/<id>/<path>
  schema.prisma            optional ADDITIVE Prisma fragment (new models / enums only)
  messages/<locale>.json   optional UI strings (en.json required when module.json → messages is set)
  check.ts                 self-test (npm run plugin:check <id>) — pure functions, no DB
  README.md, CHANGELOG.md  shown on the plugin page

<id> matches ^[a-z][a-z0-9-]{1,40}$. Import app code with the @/… alias like core code. Never edit generated files (src/lib/plugins/*.generated.ts, src/app/admin/(plugins)/<id>/**, src/app/api/plugins/<id>/**) — they are rewritten on every install, uninstall and toggle.

Lifecycle

StepWhat happens
PreviewManifest validated, minAppVersion, conflicts (routes, permission groups, sidebar links, schema names), integrity (archive sha256, checksum), step list. Nothing is written.
Install / updateOne job: preflight → snapshot → back up previous folder → copy files → (schema → prisma db push → prisma generate) → regenerate barrels and route wrappers → seed permissions, settings defaults, version row → typecheck → staged build → swap-restart. Any failure rolls back.
Enable / disableA database flag read at runtime: pages show a notice, API answers 404, hooks / filters / widgets / jobs are skipped. No rebuild.
UninstallDisable → backup zip → remove folder → delete permissions and registration → rebuild. “Drop data” also deletes the plugin's Setting rows and its tables.
Keep register() free of side effects: it is imported at build time and on first use. Plugin code runs in-process with the app — review a plugin before installing it.
Selling a plugin in the marketplace? The zip also needs marketplace.json, may not ship a schema fragment or public /api/plugins/… routes, and stays within 300 files, 256 KB per file and 4 MB unpacked (text only, lines ≤ 1,500 characters). Reference: docs/DEVELOPERS/PLUGIN-SDK.md and examples/marketplace/plugin-booking-pulse/.

Written from: docs/PLUGIN-DEVELOPER-GUIDE.md, docs/PLUGINS.md, src/lib/plugins/installer.ts, src/lib/plugins/generate.ts, docs/DEVELOPERS/PLUGIN-SDK.md, examples/marketplace/plugin-booking-pulse/module.json, src/lib/marketplace/plugin-scan.ts