Scaffold, build, and publish FastYoke extensions.
npm install -g @fastyoke/cliScaffolds a new extension project in ./<name>. Omit name to initialize the current directory.
fy init my-extension
cd my-extension
npm installBuilds the extension in watch mode. Rebuilds on file changes.
fy devOne-shot build to dist/bundle.mjs. Uses esbuild with the FastYoke-required
externals (react, react/jsx-runtime, react-dom, @fastyoke/sdk) so the
host app supplies them at runtime.
fy buildfy init supports two templates via --template <kind>:
extension(default) — a FastYoke extension built against@fastyoke/sdk, driven byfy dev/fy build/fy publish.nextjs— a standalone Next.js (App Router, TypeScript, Tailwind) consumer app pre-wired against a tenant's public form-submission and signed-URL PDF download endpoints. Driven bynpm run dev/npm run builddirectly;fylifecycle commands do not wrap it.
fy init my-app --template nextjs
cd my-app
cp .env.local.example .env.local # set FASTYOKE_TENANT_URL
npm install
npm run devVisit http://localhost:3000/forms/<token>, where <token> is the public
submission token your tenant admin published for the form. The route uses
the token (not the form's slug) — keep the token opaque.
Customize:
src/app/forms/[token]/page.tsx— server-side schema fetch.src/app/forms/[token]/FormView.tsx— schema-driven renderer.src/lib/form-actions.ts— submit server action.
The starter renderer covers text / email / textarea / checkbox /
signature field types. Extend FormView.tsx for the field types your
forms use.
Uploads manifest.json + dist/bundle.mjs to a running FastYoke instance.
--token is a tenant admin JWT — the CLI decodes its tenant_id claim to
populate the multipart request.
fy publish --tenant https://my-tenant.fastyoke.example.com --token "$FASTYOKE_TOKEN"| Flag | Required | Description |
|---|---|---|
--tenant <url> |
yes | Base URL of the FastYoke instance, e.g. https://app.fastyoke.example.com |
--token <jwt> |
yes | Tenant admin JWT. tenant_id is read from the token's claims. |
--manifest <path> |
no | Defaults to ./manifest.json |
--bundle <path> |
no | Defaults to ./dist/bundle.mjs |
Run fy build before publishing if you've made changes.
fy init produces this layout:
my-extension/
├── package.json # scripts + devDependencies only; host provides react at runtime
├── tsconfig.json
├── manifest.json # id, version, components, pages, required_scopes
├── src/
│ └── index.tsx # default export: { components?, pages? }
└── dist/ # generated by `fy build`
└── bundle.mjs
The bundle's default export is what the host's <ExtensionProvider>
imports and registers. See the examples/hello-fastyoke reference
extension in the FastYoke repo for a working example.