> ## Documentation Index
> Fetch the complete documentation index at: https://archie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploying Custom Functions

> Ship your custom functions to your app.

Functions deploy as part of your project. This page covers the deploy flow — staging, production, rollbacks.

## Deploy from the IDE

After saving a function in the in-project IDE, click **Deploy**. Archie:

1. Lints and type-checks the handler
2. Bundles dependencies
3. Pushes to the target environment
4. Routes traffic atomically (zero-downtime)

## Deploy from local development

If you authored locally:

1. Push to your linked GitHub branch
2. Open a PR (or merge to main, depending on your workflow)
3. The Archie deploy workflow runs and deploys functions for the targeted environment

For CI integration, see your stack's CI/CD examples. {/* VERIFY: confirm whether Archie ships official CI samples */}

## Environments and promotion

Functions deploy per-environment:

* **Preview** — auto-deploys on every save
* **Staging** — manual deploy or PR-based
* **Production** — manual deploy with optional approval gates

Promote a function from staging to production once verified.

## Rollback

Each deploy creates a versioned record. Roll back from the function's deploy history. {/* VERIFY: confirm rollback retention and granularity */}

## FAQ

<AccordionGroup>
  <Accordion title="Can I deploy a single function without redeploying the whole app?">
    Yes — function deploys are independent of frontend and backend deploys.
  </Accordion>

  <Accordion title="What if my function depends on env vars that are not set in production?">
    The deploy fails. Configure env vars before deploying.
  </Accordion>

  <Accordion title="How do I deploy a queue-triggered function?">
    Same flow. The queue subscription is created or updated as part of the deploy.
  </Accordion>
</AccordionGroup>
