Examples

Complete .dvk files you can copy and run with fleetdvk generate.

Blog API

A blog backend with users, posts, and comments. Posts belong to users, comments belong to posts. Public reads, authenticated writes.

project "blog-api"
database "supabase"
framework "express"
auth "jwt"

model User {
  id        uuid       @primary
  email     string     @unique
  name      string
  avatar    string
  created   datetime   @default(now)
}

model Post {
  id        uuid       @primary
  title     string
  slug      string     @unique
  content   text
  authorId  uuid
  published boolean
  created   datetime   @default(now)
}

model Comment {
  id        uuid       @primary
  body      text
  postId    uuid
  authorId  uuid
  created   datetime   @default(now)
}

route "/users" {
  GET    "/"      -> list(User)
  GET    "/:id"   -> get(User)
  POST   "/"      -> create(User)   @admin
  DELETE "/:id"   -> delete(User)   @admin
}

route "/posts" {
  GET    "/"      -> list(Post)
  GET    "/:id"   -> get(Post)
  POST   "/"      -> create(Post)   @auth
  PUT    "/:id"   -> update(Post)   @auth
  DELETE "/:id"   -> delete(Post)   @admin
}

route "/comments" {
  GET    "/"      -> list(Comment)
  POST   "/"      -> create(Comment)  @auth
  DELETE "/:id"   -> delete(Comment)  @auth
}

E-commerce API

Products, categories, and orders. Admin-only product management, authenticated order placement.

project "store-api"
database "supabase"
framework "fastify"
auth "jwt"

model Category {
  id        uuid       @primary
  name      string     @unique
  slug      string     @unique
}

model Product {
  id          uuid       @primary
  name        string
  description text
  price       decimal
  categoryId  uuid
  inStock     boolean
  created     datetime   @default(now)
}

model Order {
  id          uuid       @primary
  userId      uuid
  status      enum       [pending, confirmed, shipped, delivered]
  total       decimal
  created     datetime   @default(now)
}

route "/categories" {
  GET    "/"      -> list(Category)
  GET    "/:id"   -> get(Category)
  POST   "/"      -> create(Category)  @admin
  DELETE "/:id"   -> delete(Category)  @admin
}

route "/products" {
  GET    "/"      -> list(Product)
  GET    "/:id"   -> get(Product)
  POST   "/"      -> create(Product)   @admin
  PUT    "/:id"   -> update(Product)   @admin
  DELETE "/:id"   -> delete(Product)   @admin
}

route "/orders" {
  GET    "/"      -> list(Order)       @auth
  GET    "/:id"   -> get(Order)        @auth
  POST   "/"      -> create(Order)     @auth
}

Minimal API

The smallest possible .dvk file. A single model with CRUD routes, using Hono for minimum overhead.

project "notes"
database "supabase"
framework "hono"
auth "none"

model Note {
  id      uuid       @primary
  title   string
  body    text
  created datetime   @default(now)
}

route "/notes" {
  GET    "/"      -> list(Note)
  POST   "/"      -> create(Note)
  GET    "/:id"   -> get(Note)
  PUT    "/:id"   -> update(Note)
  DELETE "/:id"   -> delete(Note)
}

AI-generated specs

The .dvk format was designed for AI workflows. You can prompt any LLM to generate a valid spec file:

Prompt:
"Write a FleetDVK .dvk file for a task management API
with users, projects, and tasks. Tasks belong to projects,
projects belong to users. Use Supabase and JWT auth."

The LLM will produce a valid .dvk file because:
- The syntax is small enough to fit in a system prompt
- The constrained format prevents hallucination
- 10 lines of DSL replaces 200+ lines of TypeScript

Copy the LLM output into a .dvk file and run fleetdvk generate. The parser will catch any syntax errors with line numbers.