Guides

Getting Started

Create your first Lithair application in minutes:

cargo install lithair-cli
lithair new my-app
cd my-app && cargo run

Your server is now running at http://127.0.0.1:3007.

Adding a Data Model

Define a model with the declarative macro:

#[derive(DeclarativeModel)]
struct Article {
    #[db(indexed)]
    #[http(expose, validate = "non_empty")]
    title: String,

    #[http(expose)]
    content: String,

    #[lifecycle(audited, versioned = 3)]
    status: String,
}

This automatically generates CRUD endpoints, validation, and persistence.

Enabling Authentication

Add .with_auth() to your builder to enable session-based authentication with automatic login/logout endpoints.