---
title: Deploy Convex with AI on Blossom
url: "/deploy/convex/"
canonical_url: https://blossom88.com/deploy/convex/
markdown_url: https://blossom88.com/deploy/convex.md
summary: Deploy a self-hosted Convex backend with AI on Blossom. Write TypeScript
  functions, subscribe to live records, and keep your data on a Persistent Volume.
categories:
- deployment
- backend
stack:
- Rust
- TypeScript
- Next.js
- SQLite
---

# Deploy Convex with AI on Blossom

[Convex](https://convex.dev/) gives an app a database and TypeScript backend
functions. Subscribe to a query and the client receives updates when its
data changes.

## Ask Your Agent

> **Ask your AI agent:** Deploy Convex on Blossom and help me build a small app that updates live.
>
> Follow this guide: https://blossom88.com/deploy/convex/

[Install the Blossom CLI and skill](https://docs.blossom88.com/learn/getting-started/install/) on your agent's machine and [choose a Location in your cloud account](https://docs.blossom88.com/learn/getting-started/choose-your-cloud/#connect-your-provider).

## Your Convex Setup

| Part | Purpose |
|---|---|
| Persistent backend | Serves queries and WebSocket subscriptions; stores SQLite and local files on its Volume |
| Dashboard | Runs on regular App Capacity with Blossom Account access and native Convex admin sign-in |

The [self-hosted distribution](https://docs.convex.dev/self-hosting) is
[source available under FSL](https://github.com/convex/convex-backend/blob/3d585751a2de8c9066dc3fc5ac18340c1ef48810/LICENSE.md).
Use it for your own app or internal work within the license's terms. The license
restricts competing commercial offerings.

![The Convex dashboard shows the tasks table for a sample app.](/deploy/assets/images/convex/tasks.webp)

<details class="optional-reading" markdown="1">
<summary>Deployment setup and commands</summary>

Have your agent choose compatible official Convex backend and dashboard images
and pin their image indexes. Use a prebuilt-image Environment and two Services.
Start with the backend. Select a CPU and memory allocation for your workload.

    blossom profile:show
    blossom app:create --data app.yml
    blossom environment:create --data environment.yml
    blossom service:create --data backend.yml
    blossom env_var:push --environment environment-100 --file .env.production
    blossom environment:deploy --id environment-100 --follow

Give the backend port `3210`, a native HTTP health check at `/version`, and
one [Persistent Volume](/docs/apps/persistent-services/) at
`/convex/data`. Set `CONVEX_CLOUD_ORIGIN` to its HTTPS Service URL. The
startup command can read `BLOSSOM_SERVICE_URL` and then execute
`./run_backend.sh`. Keep the instance name and secret stable across releases.

Use Blossom Account access for the Environment, with `/api/*` as the public
path exception so Convex clients can connect and subscribe. The dashboard's
UI stays behind the Blossom gate.
Your Convex functions must enforce your app's authentication and authorization
for private data and writes. Add the dashboard on port `6791` using the
official dashboard image. Set `NEXT_PUBLIC_DEPLOYMENT_URL` to the backend's
HTTPS URL before deploying the dashboard. Enter your native admin key on the
private dashboard. Keep it out of browser bundles and public environment variables.

    blossom service:show --id service-100
    blossom service:create --data dashboard.yml
    blossom env_var:push --environment environment-100 --file .env.production
    blossom environment:deploy --id environment-100 --follow

Use the backend image's `generate_admin_key.sh` to generate a native admin
key and save it privately. Set `CONVEX_SELF_HOSTED_URL` and
`CONVEX_SELF_HOSTED_ADMIN_KEY` in your Convex project's private environment,
then use the [Convex CLI](https://docs.convex.dev/self-hosting) to push functions.

    npx convex deploy

The SQLite backend uses one active writer, and may interrupt requests when that
Container is replaced. Convex HTTP actions use a separate listener on
`3211`. Configure a separate route and origin if your app needs HTTP actions.

</details>

## What You Get

- An HTTPS backend for your TypeScript queries and mutations
- A separate dashboard for inspecting functions and data
- SQLite records that survive Container replacement
