with one click
turbo-route
// Scaffold a new TurboAPI route with handler, model, and tests. Use when adding a new API endpoint, creating a new route, or scaffolding CRUD for a resource.
// Scaffold a new TurboAPI route with handler, model, and tests. Use when adding a new API endpoint, creating a new route, or scaffolding CRUD for a resource.
Run performance benchmarks for TurboAPI. Use when testing performance, checking for regressions, or comparing against FastAPI.
Build the TurboAPI Zig native backend. Use when the turbonet extension needs to be recompiled, after changing Zig source files, or when seeing "Native core not available".
Scaffold Zig-native database routes using pg.zig + TurboPG. Use when adding database-backed CRUD endpoints, custom SQL queries (pgvector, JSONB, full-text search, JOINs, CTEs), or standalone TurboPG usage.
Use TurboPG for standalone Postgres queries. Use when writing database code outside of TurboAPI routes, running migrations, seeding data, or building scripts that talk to Postgres.
Run TurboAPI tests. Use when running tests, checking for regressions, or verifying changes.
| name | turbo-route |
| description | Scaffold a new TurboAPI route with handler, model, and tests. Use when adding a new API endpoint, creating a new route, or scaffolding CRUD for a resource. |
| argument-hint | <resource-name> [GET|POST|PUT|DELETE] |
Create a new route for the TurboAPI application based on the resource name and HTTP method.
$ARGUMENTS[0] as the resource name (e.g., users, items, orders)$ARGUMENTS[1] if provided, otherwise scaffold all CRUD methods (GET, POST, PUT, DELETE)python/turboapi/zig_integration.py to understand the current route registration patternFor each route, generate code following this pattern:
from turboapi import TurboAPI
from dhi import BaseModel, Field
app = TurboAPI()
class {Resource}(BaseModel):
# fields based on resource name
name: str = Field(min_length=1, max_length=100)
@app.get("/{resource_plural}")
def list_{resource_plural}():
return {"{resource_plural}": []}
@app.get("/{resource_plural}/{{{resource}_id}}")
def get_{resource}({resource}_id: int):
return {"{resource}_id": {resource}_id}
@app.post("/{resource_plural}")
def create_{resource}({resource}: {Resource}):
return {"{resource}": {resource}.model_dump(), "created": True}
@app.delete("/{resource_plural}/{{{resource}_id}}")
def delete_{resource}({resource}_id: int):
return {"deleted": True}
Create tests/test_{resource_plural}.py with TestClient-based tests for each endpoint. Include both success and error cases.
When creating routes, note which Zig dispatch path they'll use:
simple_sync_noargs (fastest, cached)simple_sync (vectorcall)model_sync (Zig-native validation)Depends() or middleware → enhanced (full Python)