Skip to content
AntFabric Corev1.0.0local

Plugin anatomy

plugins/sales/
plugin.yaml # the manifest: everything core needs to know (see Architecture → Plugins)
package.json # @antfabric-plugin/sales: deps on @antfabric/* and contracts packages only
README.md # what it does, which core services it uses, how to try it
CHANGELOG.md # every version: what changed, what an upgrade asks of the administrator
docs/ # its own guide (index.md, images/), shipped with the packed plugin
contracts/ # @antfabric-contracts/sales: types other plugins and its screens import
src/index.ts
server/ # Nest module, controllers, services, repositories, notification resolvers
workers/ # Temporal: workflows.ts (deterministic) and activities.ts (I/O)
db/
migrations/ # SQL, append-only, own journal
schema.ts # Drizzle view of its tables
config/ # schema.json + defaults.json: settings an administrator changes
events/ # JSON schemas of its live events
notifications/ # templates (inbox, push, email subject and body) and variable schemas
shared/ # code every screen shares: API client, formatting, hooks — no UI
web/ # user-app screens (also the desktop app's, unless desktop/ exists)
desktop/ # optional: desktop-only screens
mobile/ # phone screens (React Native)
admin/ # App Admin screens
demo.sql # demo data for pnpm demo:seed
docker-compose.override.yml # optional: local services it needs (add only; docs/backend/local-services.md)
tsconfig.json tsconfig.mobile.json vitest.config.ts
  • The contracts package is the only thing others may import. Keep it to types, constants and event names. Change it additively within a major version.
  • Put logic in shared/, keep screens thin. Sales’s live-update hook, CSV parser and formatting are written once and used by the web and phone screens.
  • Server code follows controller → service → repository. The repository is the only place with queries; the service holds the rules, including who may see what.
  • Workflows are deterministic. workers/workflows.ts imports only @antfabric/sdk-workflow and activity types; database, notifications and events belong in activities.ts.
  • Everything the plugin does is declared in plugin.yaml. An undeclared event, notification, workflow, permission or contract is refused.