Atlas Forms
Action Repositories
An action repository is a domain-scoped npm package that groups related action handlers together. Rather than one giant package with all your actions, organise them by domain — CRM actions, Finance actions, HR actions — each as its own installable package.
Recommended Package Structure
@myorg/atlas-crm-actions/
├── src/
│ ├── handlers/
│ │ ├── linkAccount.ts // Handler for crm:link-account
│ │ ├── syncContacts.ts // Handler for crm:sync-contacts
│ │ └── createOpportunity.ts // Handler for crm:create-opportunity
│ ├── types.ts // Shared types for this library
│ └── index.ts // Exports and register() function
├── package.json
└── tsconfig.json
index.ts Pattern
// src/index.ts
import { registerFormAction } from '@atlas-forms/control-registry-js';
import { linkAccountHandler } from './handlers/linkAccount';
import { syncContactsHandler } from './handlers/syncContacts';
import { createOpportunityHandler } from './handlers/createOpportunity';
// Convenient registration function
export function registerCrmActions(): void {
registerFormAction('crm:link-account', linkAccountHandler);
registerFormAction('crm:sync-contacts', syncContactsHandler);
registerFormAction('crm:create-opportunity', createOpportunityHandler);
}
// Also export handlers individually for testing
export { linkAccountHandler, syncContactsHandler, createOpportunityHandler };
package.json Requirements
{
"name": "@myorg/atlas-crm-actions",
"version": "1.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"peerDependencies": {
"@atlas-forms/types-js": "^1.0.0",
"@atlas-forms/control-registry-js": "^1.0.0"
},
"devDependencies": {
"@atlas-forms/types-js": "^1.0.0",
"@atlas-forms/control-registry-js": "^1.0.0",
"typescript": "^5.0.0",
"vitest": "^1.0.0"
}
}
peerDependencies, Not dependencies
Always declare
@atlas-forms/* packages as peerDependencies. If they are in dependencies, npm installs a separate copy and your handlers will register against a different registry instance than the app — causing lookups to fail.
Domain Grouping Strategy
| Package | Actions | Domain |
|---|---|---|
@myorg/atlas-crm-actions | link-account, sync-contacts, create-opportunity | CRM system integration |
@myorg/atlas-finance-actions | post-invoice, approve-payment, generate-po | Finance workflow triggers |
@myorg/atlas-hr-actions | create-employee, offboard-employee, approve-leave | HR system actions |
@myorg/atlas-notification-actions | send-slack, send-email, send-sms | Multi-channel notifications |