Skip to content

Full-stack blocks

Database, server functions, cron, and CLI in one folder.

db.php

Define schema, get CRUD endpoints

db.php
<?php
return [
  'storage'    => 'sqlite',
  'userScoped' => true,
  'capability' => [
    'create' => true,
    'read'   => true,
    'update' => true,
    'delete' => true,
  ],
  'fields' => [
    'text' => ['type' => 'string', 'required' => true],
    'done' => ['type' => 'boolean', 'default' => false],
  ],
];

rpc.php

Custom server functions

rpc.php
<?php
use Blockstudio\Db;

return [
  'toggle' => function (array $params): array {
    $db   = Db::get('my-theme/todo');
    $id   = (int) ($params['id'] ?? 0);
    $todo = $db->get_record($id);
    if ($todo) {
      $db->update($id, ['done' => !$todo['done']]);
    }
    return ['success' => (bool) $todo];
  },
  'clear_done' => function (): array {
    $db = Db::get('my-theme/todo');
    foreach ($db->list(['done' => true], 500) as $todo) {
      $db->delete((int) $todo['id']);
    }
    return ['cleared' => true];
  },
];

Every capability is a file

Each file adds one capability. No configuration and no registration code.

Application block

blockstudio/

└── my-app/

├── block.json Block definition

├── index.php Template + Interactivity API

├── style.css Scoped styles

├── script-inline.js Client logic

├── db.php Data model + CRUD

├── rpc.php Server functions

├── cron.php Scheduled tasks

└── db/default.sqlite

Database

Define schemas, get CRUD endpoints.

RPC

Server functions callable from the frontend.

Client data layer

Read, cache, and write records from the browser.

Forms and app screens

Forms rendered from the schema, and bundled UI to build on.

Infrastructure

Cron, CLI, setup code, and portability.

Plus

The official extension kit

Premium site templates, AI system instructions, and a private Discord community. One-time purchase, lifetime updates.

  • 500+ site templates
  • AI system instructions
  • Lifetime updates
  • Private Discord community