Your first schema

A longer walkthrough: define a schema, populate it, query it, and export it.

What we're building

A small bestiary for a turn-based RPG. We'll define an Enemy schema, add a few records, and query them three ways.

Step 1: Create the schema

In your workspace, click SchemasNew schema.

  • Name: Enemy
  • Slug: enemy (auto-generated from the name)

Hit save. The schema exists, but it has no fields yet.

Step 2: Add fields

Click into the new schema. Add fields one at a time:

  • name — text, required.
  • hp — number, integer, min 1, required.
  • attack — number, integer, min 0.
  • sprite — file, accept image/*.
  • rarity — select, options: common, uncommon, rare, mythic.
  • loot — array of reference to a future Item schema (you can add this later).

The right-pane preview shows you what the generated form will look like as you go.

Step 3: Save and create a record

Hit save on the schema. Now click RecordsNew instance of Enemy.

The form is generated from the schema. Fill in:

  • Name: Goblin
  • HP: 20
  • Attack: 3
  • Sprite: upload goblin.png
  • Rarity: common

Save. The record is now stored.

Step 4: Query the record via API

Get an API token from /settings/tokensCreate token. Then:

curl https://jaina.dev/api/v1/projects/my-game/schemas/enemy/records \
  -H "Authorization: Bearer jn_live_..."

Returns:

{
  "items": [
    {
      "id": "rec_01HXYZ...",
      "schema_id": "...",
      "data": {
        "name": "Goblin",
        "hp": 20,
        "attack": 3,
        "sprite": "https://jaina.dev/files/...goblin.png",
        "rarity": "common"
      },
      "created_at": "2026-05-13T12:00:00Z"
    }
  ],
  "page": 1,
  "total": 1
}

Step 5: Generate typed models

jaina codegen my-game --lang typescript --output ./types/

You now have ./types/enemy.ts:

export interface Enemy {
  id: string;
  name: string;
  hp: number;
  attack: number;
  sprite: string;
  rarity: 'common' | 'uncommon' | 'rare' | 'mythic';
}

Step 6: Export the package

jaina export my-game --format zip --output ./build/

You get ./build/my-game.zip containing model.json and assets/. Drop into your Unity StreamingAssets/ folder or Next.js public/. Ship.

Where to go next