---
title: Deploy TrailBase with AI on Blossom
url: "/deploy/trailbase/"
canonical_url: https://blossom88.com/deploy/trailbase/
markdown_url: https://blossom88.com/deploy/trailbase.md
summary: Build a TrailBase Record API where each signed-in user can open their own
  notes.
categories:
- deployment
- database
- api
stack:
- Rust
- SQLite
---

# Deploy TrailBase with AI on Blossom

[TrailBase](https://www.trailbase.io/) gives your app a SQLite database,
sign-in, and a Record API. Use a private workshop note to try per-user
access.

## Ask Your Agent

> **Ask your AI agent:** Deploy TrailBase on Blossom. Help me set up a notes API where people can only read their own notes.
>
> Follow this guide: https://blossom88.com/deploy/trailbase/

[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/#blossom-byoc).

## How It Runs

| Part | Role | Where |
|---|---|---|
| TrailBase | Authenticate users and serve the Record API | One Persistent Service with Blossom Account access |
| Volume | Store SQLite, API configuration and signing keys | Mounted at /data |

## Deploy TrailBase

Run TrailBase on port 4000 with a Volume at `/data`. Enable Blossom
Account access while you set up the database and users.

<details class="optional-reading" markdown="1">
<summary>Notes for your agent</summary>

Build from the [Dockerfile](/deploy/recipes/trailbase/Dockerfile) with
the [startup script](/deploy/recipes/trailbase/launcher-runtime.sh),
[sample config](/deploy/recipes/trailbase/config.textproto), and
[SQLite migration](/deploy/recipes/trailbase/U1770000001__create_workshop_notes.sql)
in the build context. If you push the build to Blossom's Managed Registry,
select that image on the Environment so the web Service inherits it.
Set the web Service entrypoint to `tini` and command to
`-g -- /usr/local/bin/launcher-runtime.sh`. Startup prepares a writable
depot on the Volume,
loads the bundled sign-in UI, and runs TrailBase as its unprivileged
user. Keep existing SQLite data, settings, and signing keys on updates.
Use a TCP health check on port 4000, then check `/api/healthcheck` through
the gated HTTPS endpoint.

</details>

<details class="optional-reading" markdown="1">
<summary>Commands your agent runs</summary>

    blossom app_plan:preview --data trailbase-plan.yml
    blossom app:create --data trailbase-app.yml
    blossom environment:create --data trailbase-environment.yml
    blossom service:create --data trailbase-web.yml
    blossom environment:deploy --id environment-100 --follow

</details>

## Add a Private Note

Create two regular test users. Sign in as the first and write a note
through the `workshop_notes` API. Save its record ID and confirm the
second account cannot open it.

![See the Record API's owner-only rule.](/deploy/assets/images/trailbase/trailbase-owner-rules.webp)

> **Ask your AI agent:** Create a sample note as one test user. Check that the same note is visible to its owner and denied to the other test user.

> Follow this guide: https://blossom88.com/deploy/trailbase/



## Keep Its Access Rules Through an Update

Replace the Container on the existing Volume. Sign in with fresh
sessions and repeat both reads using the same record ID.

![Reopen the same private note as its owner.](/deploy/assets/images/trailbase/trailbase-owner-note-reopened.webp)


> **Ask your AI agent:** Replace the TrailBase Container. Sign in again as both test users and verify that the original note is still visible only to its owner.

> Follow this guide: https://blossom88.com/deploy/trailbase/



## What You Get

- A private TrailBase instance with its native admin dashboard
- A notes API that restricts each record to its owner
- The same note and access rules after a Container update

Tested on Blossom: A fresh owner sign-in reopened the same note after Container replacement. A second account remained unable to read it.
