Generate a Rust (actix-web) CRUD API from your schema
Define your table’s columns and d-bye generates an actix-web CRUD REST API in Rust — with typed structs, input validation, and foreign-key integrity. And not just the API: from the same spec it generates the React front end and PostgreSQL DDL, consistent across the stack and exported as a ZIP you own.
What is actix-web CRUD generation?
actix-web is a fast Rust web framework. A CRUD API is the set of REST endpoints that Create, Read, Update, and Delete rows in a table — and since every table ends up with roughly the same shape, it’s a great fit for generating from a schema.
d-bye treats the design spec as the single source of truth: define tables, columns, constraints, and foreign keys, and it generates actix-web handlers and typed structs in Rust. The AI drafts the spec, not raw code, then passes type checks and a compile check — so it never ships Rust that doesn’t compile.
For a language-agnostic take, see generate a CRUD API (Rust/Node); to start from the DB schema, see the table definition template and how-to.
What the generated actix API includes
Per table, at least these are generated together.
- GET / (list)
- List handler with pagination and sorting.
- GET /{id} (one)
- Fetch a single row by primary key.
- POST / (create)
- serde deserialization plus validation on create.
- PUT/PATCH /{id} (update)
- Full or partial update.
- DELETE /{id} (delete)
- Delete (switchable to soft-delete if needed).
- Typed structs / FK integrity
- Rust structs per table; type, required, and foreign-key checks.
Start by defining the schema (copy-paste template)
Below is a products table example. Copy it, adapt it to your table, and build the same in d-bye visually — that definition generates an actix-web CRUD like the code below.
| Logical name | Physical name | Type | PK | NOT NULL | Description | |--------------|---------------|------|:--:|:--------:|-------------| | ID | id | uuid | x | x | Primary key | | Name | name | varchar(120) | | x | Required | | SKU | sku | varchar(40) | | x | Unique | | Price | price | numeric(10,2) | | x | >= 0 | | Supplier | supplier_id | uuid (FK) | | x | References suppliers |
How to generate an actix-web CRUD API
- Define the table and its columns (type, NOT NULL, default, FK).
- Set the back-end stack to Rust (actix-web).
- Generate the CRUD API from the spec.
- Check endpoint behavior via preview / the generated code.
- Generate the code and export as a ZIP.
- Deploy with cargo on your own infrastructure and extend by hand.
With d-bye: the definition becomes a working actix-web CRUD
Build the products definition above visually and part of the CRUD is generated as roughly this Rust code (actix-web + sqlx excerpt).
// products.rs — generated by d-bye (actix-web + sqlx, excerpt)
#[get("/products")]
async fn list(db: web::Data<PgPool>) -> Result<HttpResponse, ApiError> {
let rows = sqlx::query_as::<_, Product>(
"SELECT * FROM products ORDER BY created_at DESC",
)
.fetch_all(db.get_ref())
.await?;
Ok(HttpResponse::Ok().json(rows))
}
#[post("/products")]
async fn create(
db: web::Data<PgPool>,
body: web::Json<ProductInput>,
) -> Result<HttpResponse, ApiError> {
let p = body.into_inner();
let row = sqlx::query_as::<_, Product>(
"INSERT INTO products (name, sku, price, supplier_id) \
VALUES ($1, $2, $3, $4) RETURNING *",
)
.bind(&p.name).bind(&p.sku).bind(p.price).bind(p.supplier_id)
.fetch_one(db.get_ref())
.await?;
Ok(HttpResponse::Created().json(row))
}- ✓Not just the API — also the React front end’s CRUD screens and PostgreSQL DDL.
- ✓All derived from one spec, so API, UI, and DB agree across the stack.
- ✓Every generation passes type checks and a compile check, so it never ships Rust that doesn’t compile.
- ✓Export everything as a ZIP and run it on your own infrastructure — no lock-in.
FAQ
- Can I generate an actix-web CRUD from a PostgreSQL schema?
- Yes. Define tables and columns (types, constraints, foreign keys), and it generates actix-web CRUD handlers and typed structs in Rust. The same spec also generates the front end and PostgreSQL DDL.
- Can I switch to Node.js instead?
- Yes. The back end switches between Rust (actix-web) and Node.js (Express). See generate a CRUD API for the language-agnostic overview. Both are generated from the same spec, so consistency is preserved.
- Can I edit the code by hand afterward?
- The output is plain Rust, exported as a ZIP. You can read, modify, add tests, and deploy it with cargo anywhere. To change the design, edit the spec and regenerate.
- Will the AI-generated Rust actually compile?
- d-bye has the AI draft a spec rather than raw code, then runs type checks and a compile check as a gate. See the Learn guide “an AI code generator that actually works” for how it works.
Next step
- →Try a template’s API and screens as a working preview in the free Sandbox
- →Start from working templates: inventory, attendance, approvals, contacts
- →Full download requires Personal or higher (design and preview are free, no credit card)