Radiant Builder API
The Radiant Builder API powers the visual builder and CLI, allowing you to programmatically manage projects, scaffold collections, define access rules, and deploy your backend. All endpoints are protected via a Bearer Token (JWT_SECRET).
POST/projectsScaffold a Project
/projectsDescription
Scaffolds a new Radiant project in a temporary workspace, installs dependencies, and prepares it for configuration.
| Field | Type | Description |
|---|---|---|
| name * | string | Name of the project. |
{
"name": "my-ecommerce-backend"
}{
"projectId": "8b51a84f-...",
"apiKey": "rk_8b51a8...",
"targetDir": "/temps/8b5...",
"status": "scaffolded",
"message": "Project my-ecommerce-backend successfully scaffolded with SQLite database."
}{
"error": "Error scaffolding project..."
}POST/projects/:projectId/buildBuild Project
/projects/:projectId/buildDescription
Triggers `bun run build` inside the specified project directory to compile the Radiant backend into a distributable runtime.
{
"status": "built",
"stdout": "...",
"stderr": "",
"sdkUrl": "/projects/123-abc/sdk"
}{
"error": "Project not found"
}POST/projects/:projectId/deployDeploy Project Locally
/projects/:projectId/deployDescription
Spawns the built project locally on an available port.
{
"status": "deployed",
"url": "http://localhost:9200",
"port": 9200,
"sdkUrl": "/projects/123-abc/sdk"
}{
"error": "Deploy failed",
"details": "..."
}GET/projects/:projectId/sdkDownload Client SDK
/projects/:projectId/sdkDescription
Downloads the auto-generated zero-dependency TypeScript Client SDK for the project.
// Downloadable TypeScript Source File
import { ... } from "radiant";
...{
"error": "Project not found or SDK not generated"
}GET/projects/:projectId/collectionsList Collections
/projects/:projectId/collectionsDescription
Returns the JSON schema AST of all collections currently compiled in the project.
[
{
"name": "users",
"fields": { ... }
}
]POST/projects/:projectId/collectionsCreate Collection
/projects/:projectId/collectionsDescription
Generates a new `.radiant` DSL file for a collection, saves it to the project, and automatically runs the compiler to re-generate the schema AST.
| Field | Type | Description |
|---|---|---|
| slug * | string | Collection slug (e.g. users). |
| fields * | array | Array of field definitions. |
| auth | boolean | Enable auth on collection. |
{
"slug": "posts",
"fields": [
{ "name": "title", "type": "string" },
{ "name": "content", "type": "text", "optional": true }
]
}{
"collection": "posts",
"status": "compiled",
"dsl": "\ncollection posts {..."
}{
"error": "Collection already exists"
}PUT/projects/:projectId/collections/:slugUpdate Collection
/projects/:projectId/collections/:slugDescription
Updates an existing collection DSL and recompiles the schema.
| Field | Type | Description |
|---|---|---|
| fields * | array | Array of field definitions. |
| auth | boolean | Enable auth on collection. |
{
"fields": [
{ "name": "title", "type": "string" }
]
}{
"collection": "posts",
"status": "compiled",
"dsl": "..."
}DELETE/projects/:projectId/collections/:slugDelete Collection
/projects/:projectId/collections/:slugDescription
Deletes a collection and recompiles the project.
{
"collection": "posts",
"status": "compiled",
"removed": true
}POST/projects/:projectId/accessCreate Access Rules
/projects/:projectId/accessDescription
Sets access control rules for a given collection and adds them to the project.
| Field | Type | Description |
|---|---|---|
| collection * | string | Target collection. |
| rules * | object | Map of operations to access logic strings. |
{
"collection": "users",
"rules": {
"read": "true",
"create": "false"
}
}{
"collection": "users",
"status": "saved",
"code": "..."
}PUT/projects/:projectId/access/:collectionUpdate Access Rules
/projects/:projectId/access/:collectionDescription
Updates the access control rules for a specific collection.
| Field | Type | Description |
|---|---|---|
| rules * | object | Map of operations to access logic strings. |
{
"rules": {
"read": "ctx.user !== null"
}
}{
"collection": "users",
"status": "saved",
"code": "..."
}DELETE/projects/:projectId/access/:collectionDelete Access Rules
/projects/:projectId/access/:collectionDescription
Removes access control rules for a collection.
{
"collection": "users",
"status": "removed"
}POST/projects/:projectId/hooksCreate Hook
/projects/:projectId/hooksDescription
Registers a global application hook (e.g. beforeRequest).
| Field | Type | Description |
|---|---|---|
| slug * | string | Name of the hook file. |
| code * | string | TypeScript source code for the hook. |
{
"slug": "log-hook",
"code": "app.plugins.push({ beforeRequest: (ctx) => console.log('req') });"
}{
"slug": "log-hook",
"status": "saved",
"code": "..."
}PUT/projects/:projectId/hooks/:slugUpdate Hook
/projects/:projectId/hooks/:slugDescription
Updates the TypeScript code of an existing hook.
| Field | Type | Description |
|---|---|---|
| code * | string | TypeScript source code for the hook. |
{
"code": "app.plugins.push({ beforeRequest: (ctx) => console.log('updated') });"
}{
"slug": "log-hook",
"status": "saved",
"code": "..."
}DELETE/projects/:projectId/hooks/:slugDelete Hook
/projects/:projectId/hooks/:slugDescription
Removes a hook from the project.
{
"slug": "log-hook",
"status": "removed"
}PUT/projects/:projectId/configUpdate Config
/projects/:projectId/configDescription
Updates the project's config.radiant file.
| Field | Type | Description |
|---|---|---|
| data * | object | Configuration options. |
{
"apiPrefix": "/api/v2"
}{
"status": "compiled",
"dsl": "config {\n apiPrefix: \"/api/v2\";\n}\n"
}POST/projects/:projectId/db-syncDatabase Sync
/projects/:projectId/db-syncDescription
Runs the `db:sync` CLI command on the project to synchronize the schema with the underlying database.
{
"status": "synced",
"stdout": "...",
"stderr": ""
}