Keep your records beside the work that changes them.

Describe the records you keep and Swirls creates and runs the managed database for them. Screens, steps, and assistants all read the same rows, and no password goes in the file.

The system needs a shared meaning for its data.

Other tools can stay the official home for their own data. Your project decides how those facts become the records your screens and processes read, including a managed database Swirls runs for you when you would rather not run one.

Name the facts once. Use them across the system.

One file can describe the managed database, spell out an article's status and flags, and feed those same rows to the review queue and the process that updates them.

Example: The editorial desk stores an article's title, status, summary, and flags in a managed database that the review queue and the publish process both read and write.

Swirls owns the production work behind it.

Running the storage you described, holding the supported access limits, doing the work in the background, and keeping the history.

A managed database

Describe the records and Swirls creates the database for them.

Say how they relate

Spell out the connections the operation depends on.

Use them everywhere

The same records feed your screens, steps, and assistants.

editorial/desk
editorial-desk.swirls
database articles {
  label: "Editorial articles"
  schema: @prisma {
    enum ArticleStatus {
      SUBMITTED
      SCREENED
      PUBLISHED
    }

    model Article {
      id          Int           @id @default(autoincrement())
      title       String
      body        String
      authorEmail String
      status      ArticleStatus @default(SUBMITTED)
      summary     String?
      flags       String[]
      submittedAt DateTime      @default(now())
      publishedAt DateTime?

      @@map("articles")
    }
  }
}

node save_draft {
  type: database
  database: articles
  operation: insert
  run: @ts {
    const draft = context.nodes.root.output
    const { summary, flags } = context.nodes.screen.output
    const article = await context.db.articles.article.create({
      data: {
        title: draft.title,
        authorEmail: draft.author_email,
        status: "SCREENED",
        summary,
        flags,
      },
    })
    return { id: article.id }
  }
}
articles · managed Postgres
idtitlestatusflags
12Shipping the review queuein_review1
11Voice guidelines v3published0
10Partner announcement draftneeds_revision2

Covers

  1. Managed databases
  2. Business records
  3. Relationships
  4. Queries and views
  5. Files and durable state
Read the technical docs

You own

Which facts matter, what they mean, how they relate, and what the business should do when they change.

Describe the records the business depends on.

Name what you keep, how the pieces relate, and what should happen when something changes.