Skip to main content

Blueprint Examples

Common blueprint patterns and complete examples.

Simple Todo App

{
"version": 1,
"defaults": {
"owned": true,
"timestamps": true
},
"entities": {
"Task": {
"label": "Task",
"plural": "tasks",
"fields": {
"title": {
"type": "string",
"required": true
},
"completed": {
"type": "boolean",
"default": false
},
"dueDate": {
"type": "isoDate",
"optional": true
}
},
"filters": ["completed", "dueDate"]
}
}
}

Blog Platform

{
"version": 1,
"defaults": {
"owned": true,
"timestamps": true
},
"entities": {
"Post": {
"label": "Blog Post",
"plural": "posts",
"extends": "ContentBase",
"versioning": "simple",
"fields": {
"authorId": {
"type": "objectId",
"ref": "User",
"required": true
},
"categoryId": {
"type": "objectId",
"ref": "Category",
"optional": true
},
"body": {
"type": "string",
"required": true
},
"excerpt": {
"type": "string",
"optional": true
},
"featuredImage": {
"type": "url",
"optional": true
},
"publishedAt": {
"type": "isoDate",
"optional": true
}
},
"filters": ["authorId", "categoryId", "status", "publishedAt"],
"indexes": [
{ "fields": ["authorId", "status"] },
{ "fields": ["slug"], "options": { "unique": true } }
]
},
"Category": {
"label": "Category",
"plural": "categories",
"ownership": "system",
"fields": {
"name": {
"type": "string",
"required": true
},
"slug": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"optional": true
}
},
"indexes": [
{ "fields": ["slug"], "options": { "unique": true } }
]
},
"Comment": {
"label": "Comment",
"plural": "comments",
"versioning": "simple",
"fields": {
"postId": {
"type": "objectId",
"ref": "Post",
"required": true
},
"authorId": {
"type": "objectId",
"ref": "User",
"required": true
},
"body": {
"type": "string",
"required": true
},
"approved": {
"type": "boolean",
"default": false,
"trackChanges": true
}
},
"filters": ["postId", "authorId", "approved"],
"indexes": [
{ "fields": ["postId", "createdAt"] }
]
}
}
}

E-commerce System

{
"version": 1,
"defaults": {
"owned": true,
"timestamps": true
},
"entities": {
"Product": {
"label": "Product",
"plural": "products",
"ownership": "system",
"fields": {
"name": {
"type": "string",
"required": true,
"search": true
},
"sku": {
"type": "string",
"required": true
},
"description": {
"type": "string",
"optional": true,
"search": true
},
"price": {
"type": "float",
"required": true
},
"stock": {
"type": "int",
"default": 0
},
"category": {
"type": "enum",
"values": ["electronics", "clothing", "food", "other"],
"default": "other"
},
"images": {
"type": "string[]",
"default": []
},
"isActive": {
"type": "boolean",
"default": true
}
},
"filters": ["category", "isActive", "price"],
"indexes": [
{ "fields": ["sku"], "options": { "unique": true } },
{ "fields": ["category", "isActive"] }
]
},
"Order": {
"label": "Order",
"plural": "orders",
"versioning": "simple",
"fields": {
"customerEmail": {
"type": "string",
"required": true
},
"items": {
"type": "array",
"items": {
"type": "object",
"shape": {
"productId": {
"type": "objectId",
"ref": "Product"
},
"quantity": {
"type": "int"
},
"price": {
"type": "float"
}
}
},
"default": []
},
"total": {
"type": "float",
"required": true
},
"status": {
"type": "enum",
"values": ["pending", "processing", "shipped", "delivered", "cancelled"],
"default": "pending",
"trackChanges": true
},
"shippingAddress": {
"type": "object",
"required": true
},
"paymentMethod": {
"type": "enum",
"values": ["credit_card", "paypal", "bank_transfer"],
"required": true
}
},
"filters": ["status", "customerEmail", "createdAt"],
"indexes": [
{ "fields": ["ownerId", "status"] },
{ "fields": ["customerEmail", "createdAt"] }
]
}
}
}

Project Management

{
"version": 1,
"defaults": {
"owned": true,
"timestamps": true,
"adminRole": "ADMIN"
},
"entities": {
"Project": {
"label": "Project",
"plural": "projects",
"versioning": "simple",
"fields": {
"name": {
"type": "string",
"required": true,
"search": true
},
"description": {
"type": "string",
"optional": true
},
"status": {
"type": "enum",
"values": ["planning", "active", "on_hold", "completed", "archived"],
"default": "planning"
},
"startDate": {
"type": "isoDate",
"optional": true
},
"endDate": {
"type": "isoDate",
"optional": true
},
"memberIds": {
"type": "objectId[]",
"ref": "User",
"default": []
}
},
"filters": ["status", "ownerId"],
"indexes": [
{ "fields": ["ownerId", "status"] }
]
},
"Task": {
"label": "Task",
"plural": "tasks",
"fields": {
"projectId": {
"type": "objectId",
"ref": "Project",
"required": true
},
"title": {
"type": "string",
"required": true,
"search": true
},
"description": {
"type": "string",
"optional": true
},
"assigneeId": {
"type": "objectId",
"ref": "User",
"optional": true
},
"status": {
"type": "enum",
"values": ["todo", "in_progress", "review", "done"],
"default": "todo"
},
"priority": {
"type": "enum",
"values": ["low", "medium", "high", "urgent"],
"default": "medium"
},
"dueDate": {
"type": "isoDate",
"optional": true
},
"estimatedHours": {
"type": "float",
"optional": true
},
"tags": {
"type": "string[]",
"default": []
}
},
"filters": ["projectId", "assigneeId", "status", "priority", "dueDate"],
"indexes": [
{ "fields": ["projectId", "status"] },
{ "fields": ["assigneeId", "status"] }
]
},
"TimeEntry": {
"label": "Time Entry",
"plural": "time_entries",
"fields": {
"taskId": {
"type": "objectId",
"ref": "Task",
"required": true
},
"userId": {
"type": "objectId",
"ref": "User",
"required": true
},
"hours": {
"type": "float",
"required": true
},
"description": {
"type": "string",
"optional": true
},
"date": {
"type": "isoDate",
"required": true
}
},
"filters": ["taskId", "userId", "date"],
"indexes": [
{ "fields": ["taskId", "date"] },
{ "fields": ["userId", "date"] }
]
}
}
}

User-Generated Content Platform

{
"version": 1,
"defaults": {
"owned": true,
"timestamps": true
},
"entities": {
"User": {
"extends": "User",
"fields": {
"bio": {
"type": "string",
"optional": true
},
"avatarUrl": {
"type": "url",
"optional": true
},
"followerCount": {
"type": "int",
"default": 0
},
"followingCount": {
"type": "int",
"default": 0
}
}
},
"Idea": {
"label": "Idea",
"plural": "ideas",
"extends": "ContentBase",
"versioning": "full",
"fields": {
"description": {
"type": "string",
"required": true,
"search": true
},
"category": {
"type": "enum",
"values": ["tech", "design", "business", "social", "other"],
"required": true
},
"upvotes": {
"type": "int",
"default": 0
},
"reviewStatus": {
"type": "enum",
"values": ["pending", "approved", "rejected"],
"default": "pending",
"trackChanges": true
},
"reviewerId": {
"type": "objectId",
"ref": "User",
"optional": true
},
"reviewedAt": {
"type": "isoDate",
"optional": true
},
"reviewNotes": {
"type": "string",
"optional": true
}
},
"filters": ["category", "reviewStatus", "ownerId"],
"indexes": [
{ "fields": ["reviewStatus", "createdAt"] },
{ "fields": ["ownerId", "reviewStatus"] }
]
},
"Comment": {
"label": "Comment",
"plural": "comments",
"fields": {
"ideaId": {
"type": "objectId",
"ref": "Idea",
"required": true
},
"parentId": {
"type": "objectId",
"ref": "Comment",
"optional": true
},
"body": {
"type": "string",
"required": true
},
"upvotes": {
"type": "int",
"default": 0
}
},
"filters": ["ideaId", "parentId", "ownerId"],
"indexes": [
{ "fields": ["ideaId", "createdAt"] },
{ "fields": ["parentId", "createdAt"] }
]
}
}
}

Working Example Presets

Radish CLI includes complete working examples with seed data that you can use as starting points:

Library Management System

A complete library system with authors, books, members, and loans. Includes seed data with sample records.

# Generate from preset
radish-cli create datalayer ./library-app --schema src/templates/schema.library.json

# Seed the database
radish-cli seed ./library-app

# Launch admin console
radish-cli console ./library-app

Demonstrates: Entity references, date fields, array fields, proper indexes

Todo Application

Task management system with projects and tasks, including status tracking and priority levels.

# Generate from preset
radish-cli create datalayer ./todo-app --schema src/templates/schema.todo.json

# Seed the database
radish-cli seed ./todo-app

# Launch admin console
radish-cli console ./todo-app

Demonstrates: Enum fields, multi-value filters, tagging system

Entity Extension Patterns

Educational example showing all base entity extension patterns available in Radish CLI.

Covers:

  • Pattern 1: ContentBase (default) - BlogPost with full content fields
  • Pattern 2: EntityBase (minimal) - Comment without content fields
  • Pattern 3: SystemEntityBase - SystemLog with no owner
  • Pattern 4: Entity-to-Entity Extension - PrivateComment extends Comment
  • Pattern 5: Builtin Entity Extension - Custom User fields
  • Pattern 6: Explicit ContentBase - Article with versioning

Next Steps