Take your Rust web development to the next level

Cot is a powerful, type-safe, and fully featured Rust framework, delivering top-notch security and blazing speed. Cot empowers you to build production-ready web apps in record time — without compromising on performance or reliability.

Less crate hunting, more building

A taste of what everyday Cot code looks like — type-safe, declarative, and free of ceremony.

Type-safe ORM queries

Define a model once, then query it with the query! macro — fields and types are checked at compile time, not at runtime.

#[model]
struct Customer {
    #[model(primary_key)]
    id: Auto<i64>,
    #[model(unique)]
    email: Email,
    is_verified: bool,
}

let customer = query!(Customer, $email == email)
    .get(&db)
    .await?;

Forms that validate themselves

#[derive(Form)] turns a struct into a fully validated HTML form, complete with types like Email and Password that guarantee well-formed data.

#[derive(Debug, Form)]
struct SignupForm {
    #[form(opts(max_length = 100))]
    username: String,
    email: Email,
    password: Password,
}

async fn signup(
    RequestForm(form): RequestForm<SignupForm>,
) -> cot::Result<Response> {
    let form = form.unwrap();
    // username, email, and password are already validated
    DatabaseUser::create_user(&db, &form.username, &form.password).await?;
    Ok(reverse_redirect!(urls, "index")?)
}

An admin panel for (almost) free

Add AdminModel to any model and register it — Cot generates a full CRUD admin interface, no extra code required.

#[derive(Debug, Clone, Form, AdminModel)]
#[model]
struct TodoItem {
    #[model(primary_key)]
    id: Auto<i32>,
    title: String,
}

impl App for TodoApp {
    fn admin_model_managers(&self) -> Vec<Box<dyn AdminModelManager>> {
        vec![Box::new(DefaultAdminModelManager::<TodoItem>::new())]
    }
}

JSON APIs with OpenAPI built in

Derive JsonSchema on your request and response types, and Cot generates an interactive Swagger UI automatically — no separate spec to maintain.

#[derive(Deserialize, schemars::JsonSchema)]
struct AddRequest { a: i32, b: i32 }

#[derive(Serialize, schemars::JsonSchema)]
struct AddResponse { result: i32 }

async fn add(Json(req): Json<AddRequest>) -> Json<AddResponse> {
    Json(AddResponse { result: req.a + req.b })
}

// Swagger UI is generated automatically from the types above
Route::with_api_handler_and_name("/add/", api_post(add), "add");

Features

Batteries-included

Cot delivers solutions to common web development challenges — so you can focus on bringing your ideas to life, instead of hunting down crates.

Easy to use API

Cot's API is designed to be easy to use and intuitive. Sensible defaults make it for easy rapid development, while the API is still empowering you when needed.

ORM integration

Cot's integrated ORM provides a Rust-native database experience. Rust types guide your data model, while the ORM handles conversions and auto-generates migrations.

Admin panel

Built-in admin panel is here for effortless data management. Adding new models is simple, making it perfect for rapid prototyping.

Security

Security should be the default, not an afterthought. Cot safeguards your app against modern threats, so you can focus on building, not bolting on security.

Performance

Enjoy machine-code speed with interpreted convenience — experience full-featured development without sacrificing performance.

Documentation

The documentation is a first-class citizen in Cot, making it always easy to find what you're looking for.

Type safety

Cot harnesses Rust's type system to catch errors early. From ORM to the templates, every component benefits from strong typing to prevent bugs.

JSON & OpenAPI

Cot comes with first-class JSON handling right out of the box. Simply derive JSON traits to parse data or return responses, and automatically generate Swagger UI.

Ready to Get Started?

Try Cot today and see how easy it is to build web apps in Rust.

$ cargo install cot-cli && cot new
Read the Guide