Zebric Quickstart (5 minutes)
This quick start gets you up and running with a Zebric web application on your local machine.
Prerequisites
Section titled “Prerequisites”You’ll need a recent (20.x or above) version of Node.js.
Install Zebric
Section titled “Install Zebric”npm install -g @zebric/cliCreate a Blueprint
Section titled “Create a Blueprint”Create a new file named blueprint.toml:
version = "0.1.0"
[project]name = "My Blog"version = "1.0.0"description = "A simple blog"
[project.runtime]min_version = "0.1.0"
# Define a Post entity with three fields[entity.Post]fields = [ { name = "id", type = "ULID", primary_key = true }, { name = "title", type = "Text", required = true }, { name = "body", type = "LongText", required = true }, { name = "published", type = "Boolean", default = false }, { name = "createdAt", type = "DateTime", default = "now" }]
# Home page — list all posts[page."/"]title = "All Posts"auth = "none"layout = "list"
[page."/".query.posts]entity = "Post"orderBy = { createdAt = "desc" }
# Create-post form[page."/posts/new"]title = "New Post"auth = "none"layout = "form"
[page."/posts/new".form]entity = "Post"method = "create"
[[page."/posts/new".form.fields]]name = "title"type = "text"label = "Title"required = true
[[page."/posts/new".form.fields]]name = "body"type = "textarea"label = "Body"rows = 10required = true
[page."/posts/new".form.onSuccess]redirect = "/"message = "Post created!"
# Post detail page[page."/posts/:id"]title = "Post Detail"auth = "none"layout = "detail"
[page."/posts/:id".query.post]entity = "Post"where = { id = "$params.id" }Start the Dev Server
Section titled “Start the Dev Server”zebric dev --blueprint blueprint.toml --seedOpen http://localhost:3000 in your browser. You’ll see:
- A list page at
/showing all posts - A form at
/posts/newto create a post - A detail page at
/posts/:idfor each post
What Just Happened?
Section titled “What Just Happened?”Zebric read your TOML blueprint and:
- Created a SQLite database with a
Posttable matching your entity definition - Generated routes for each page (
/,/posts/new,/posts/:id) - Rendered server-side HTML using the layout type you specified (list, form, detail)
- Wired up CRUD operations so the form creates records and the list queries them
No code was generated. The runtime interprets the blueprint directly.
Next Steps
Section titled “Next Steps”- Add authentication with
[auth]andproviders = ["email"] - Define access control on entities with
[entity.Post.access] - Add workflows to automate status transitions
- Explore the example blueprints for more patterns