Example

Bosatsu Service Fixtures and Notes API Verification

One working service, Notes, with its verified API and generated frontend, plus smaller source fixtures that each show one pure or IO pattern. The fixtures are not deployed servers.

Code & run Run and repair the Notes handler

Start with the Notes app, or open the browser verification tools to run the same checks on editable source.

Notes API: owner-scoped routes and generated frontend

Every Notes row is keyed by the signed-in user. The checks prove that from the compiled program, and catch a leaky copy that reads another user's row.

Owner-scoped access check

api_verify with instances: 1 gives the full Notes verdict.

Open `notes-api.bosatsu`

Read the generated `api_verify` request and verdict

Leaky Notes fixture and violated access verdict

db_read(..., "other-user") is a typed-IR violation, not a naming heuristic.

Open `notes-api-leaky.bosatsu`

Generated notes app

Add a note as alice, switch to bob, and see an empty list.

Open the generated app

Source fixture inventory and implemented scope

Pure path-to-label function

package Demo/Service/ApiGateway
def route: String -> String =
  path ->
    if path == "/health" then "health-handler"
    else if path == "/metrics" then "metrics-handler"
    else "not-found"

Open `api-gateway.bosatsu`

Read, unchanged write, and order creation

package Demo/Service/Inventory
def purchase(db: Db, item_id: String, quantity: Int) -> IO[Order]:
  item <- db_read(inventory_table(db), item_id).flat_map()
  _ <- db_write(inventory_table(db), item_id, item).flat_map()
  db_create(orders_table(db), Order("pending", item_id, quantity))

Open `inventory.bosatsu` · `inventory-service.bosatsu`

Also: a string pipeline and a job-name formatter, each a few pure functions.

Dynamo transport parsing and mapping

A pure fixture that parses Dynamo-shaped values into typed records through a handler registry and filters. Read the complete source and its 10 top-level test values.

Wire layer: DynamoValue (DynString, DynNumber, DynMap, ...)
↓ parse_User / parse_Post
Transport layer: User[String], Post[String]
↓ map_User / map_Post (with to_int)
Application layer: UserPlain, PostPlain
↓ process_item + find_handler
Handler layer: EntityHandler dispatch + FilterConfig
struct FeedEntry[num](
  post: Post[num],
  featured_author: User[num],
  ranking_score: num
)
struct FeedSnapshot[num](
  workspace_id: String,
  generated_at: String,
  entries: List[FeedEntry[num]],
  total_score: num
)
# Converting the entire tree from String to Int requires
# exactly one function call:
mapped = map_FeedSnapshot(snapshot, safe_int)

Run the Notes verifier or inspect a source fixture

Run api_verify on the Notes source, or ask the Explorer what a fixture's binding depends on.

Run the API tools · Read a generated verdict example

Ask your agent about anything here; it has the detail.

Where this fits

What this is about: Safety and Permissions