Skip to main content
The adapter generator adds a named adapter object beneath an existing package’s src/adapters directory.

Command

The positional arguments are the target package followed by the adapter name.

Options

Generated files

For the example above, the generator:
  1. Verifies that packages/analytics/src/index.ts exists.
  2. Stops if packages/analytics/src/adapters/posthog.ts already exists.
  3. Creates packages/analytics/src/adapters/posthog.ts.
  4. Adds export * from './adapters/posthog'; to the package entry point when missing.
  5. Formats the generated files.
The initial implementation is equivalent to:
The scaffold does not implement a domain adapter contract. Replace it with the exact interface used by the target package, add initialization and cleanup behavior where required, and test provider failures before registering it.

Complete the adapter

  • Keep provider SDK imports inside the adapter module.
  • Match the package’s existing adapter interface and registration pattern.
  • Validate configuration before making provider calls.
  • Avoid embedding secrets or logging credentials.
  • Add tests for initialization, operations, cleanup, and error paths.
  • Run bun run verify.

Create a feature package

Generate a minimal domain package before adding package-specific adapters.