Skip to content
Empire Builder KitDocumentation
v1 Documentation

Find your next step.

Search the complete documentation, including code examples.

    Full-text search↑ ↓ navigate Enter open
    Browse documentation
    DocsGuides

    Add a Function, Service or Job

    A Slice’s web app and handlers cover most products. When a feature needs a different way of running, add a workload inside the same Slice.

    On this page
    1. Choose the kind
    2. Generate it
    3. Who may call a Function

    Choose the kind

    KindRuns asUse it for
    FunctionOne Lambda function behind a named routeA single operation, such as a form submission or a webhook.
    ServiceA continuous processWork that must stay running.
    JobA process that starts, finishes and exitsBatch work and one-off tasks.

    Generate it

    bash
    pnpm nx g @empire-builder-kit/nx:function invoice --slice=billing --feature=operations
    pnpm nx g @empire-builder-kit/nx:service worker --slice=billing --feature=operations
    pnpm nx g @empire-builder-kit/nx:job reconcile --slice=billing --feature=events

    Each generator takes the workload’s name, the Slice that owns it and a feature name used in its logs.

    Who may call a Function

    A Function is either signed-in, which requires a Cognito access token, or anonymous. Change the setting with the function-access generator; it takes effect on the next deploy.

    bash
    pnpm nx g @empire-builder-kit/nx:function-access invoice --slice=billing --authentication=anonymous