OpenThink Cloud
Think ServicePreview

Serverless routes, schedules and table triggers for each space

Write a service like Hono, deploy it per space at its own URL, and keep business rules on the server where pages cannot bypass them.

Why Think Service?

Think Service is the server-side logic of an app built on a space. Each space has one service with routes at /api/svc/<space>/…, plus cron schedules and handlers that run when a table changes.

HTML pages, mobile apps, bots, outside systems and AI call the same API. The service runs as the space's service account, and store.asViewer() switches to the caller when a route acts on their behalf.

Benefits

Rules that hold

app.owns("Tasks") makes a table writable only through your routes.

Safe deploys

Every deploy is an immutable version. Try a preview on real data, promote it, or roll back without rebuilding.

Nothing to install

The think module is built in: store, viewer, secrets, Functions and fetch.

Features

Routes

get, post, put, patch, delete with params and wildcards, middleware, HTTPError and onError.

Access per route

space (members and thk_ keys), user (anyone signed in) or public (webhooks, public forms).

Schedules

app.cron with five-field cron and a time zone, as often as every five minutes.

Table triggers

app.onChange runs after rows are added, updated or deleted, whoever wrote them.

Data access

store.get, list, insert, update, delete, sql and query on the space's tables, by name.

Versions and logs

Preview at <space>@<version>, promote, roll back. Logs keep the last 500 calls.

Pricing

Think Service is part of every OpenThink plan, not billed on its own. On Free it runs within the limits below; on Team it draws from the monthly usage credit, and your admin sets the spending cap.

See OpenThink Cloud pricing

Limits

Per call10 s CPU, 30 s wait, 50 subrequests
Rate300 calls per minute per space
SizeBody 1 MB, response 2 MB, code 200,000 characters
Per service100 routes, 10 schedules, 20 table handlers
History50 versions, 500 logged calls

Getting started

  1. 01

    Write the service

    Export a Service from the think module, with routes, schedules or table triggers.

  2. 02

    Deploy a preview

    Use the build tool over MCP with preview: true, and call a route on the preview.

  3. 03

    Promote and call

    Promote the version, then call it with a PAT or a thk_ key, or with think.call from a page.

// Kanban
import { Service, HTTPError } from "think"

const app = new Service()
app.owns("Tasks")

app.post("/tasks/:id/complete", async (c) => {
  const { viewer, store } = c.var.think
  const task = await store.get("Tasks", c.req.param("id"))
  if (task?.Assignee !== viewer.email) throw new HTTPError(403, "not the assignee")
  await store.update("Tasks", task._id, { Status: "Done" })
  return c.json({ ok: true })
})

export default app

Frequently asked questions

Where does it run?

On Cloudflare Workers, as an isolated worker loaded for your space.

Can I use npm packages?

Not yet. The think module is built in; fetch reaches outside APIs, up to 50 times per call.

Does a preview use real data?

Yes, like Cloud Run or Workers previews. Schedules and table triggers of a preview do not run.

How do outside systems call it?

With Authorization: Bearer and a PAT or a thk_ key of the space. CORS is open for every origin, without cookies.