# The URL the site will be built for base_url = "https://loco.rs" title = "Loco" description = "Loco is a productivity-first web and service framework in Rust" # Whether to automatically compile all Sass files in the sass directory compile_sass = true # Whether to generate a feed file for the site generate_feeds = true # When set to "true", the generated HTML files are minified. minify_html = false # The taxonomies to be rendered for the site and their configuration. taxonomies = [ { name = "authors" }, # Basic definition: no feed or pagination ] # Whether to build a search index to be used later on by a JavaScript library build_search_index = true [markdown] # Whether to do syntax highlighting # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola highlight_theme = "css" highlight_code = true highlight_themes_css = [ { theme = "OneHalfDark", filename = "syntax-theme-dark.css" }, { theme = "OneHalfLight", filename = "syntax-theme-light.css" }, ] [extra] # Put all your custom variables here # Menu items [[extra.menu.main]] name = "Docs" section = "docs" url = "/docs/getting-started/tour/" weight = 10 [[extra.menu.main]] name = "Blog" section = "blog" url = "/blog/" weight = 20 [[extra.menu.main]] name = "Casts" section = "casts" url = "/casts/" [[extra.menu.social]] name = "Twitter" pre = '' url = "https://twitter.com/jondot" weight = 10 [[extra.menu.social]] name = "GitHub" pre = '' url = "https://github.com/loco-rs/loco" post = "v0.1.0" weight = 20 [[extra.homepage.features]] name = "Models" description = 'Model your business with rich entities and avoid writing SQL, backed by SeaORM. Build relations, validation and custom logic on your entities for the best maintainability.' example = '''```rust impl Model { pub async fn find_by_email(db: &DatabaseConnection, email: &str) -> ModelResult { Users::find() .filter(eq(Column::Email, email)) .one(db).await? .ok_or_else(|| ModelError::EntityNotFound) } pub async fn create_report(&self, ctx: &AppContext) -> Result<()> { ReportWorker::perform_later( &ctx, ReportArgs{ user_id: self.id } ).await?; } } ``` ''' [[extra.homepage.features]] name = "Controllers" description = 'Handle Web requests parameters, body, validation, and render a response that is content-aware. We use Axum for the best performance, simplicity and extensibility.' example = '''```rust pub async fn get_one( respond_to: RespondTo, Path(id): Path, State(ctx): State, ) -> Result { let item = Notes::find_by_id(id).one(&ctx.db).await?; match respond_to { RespondTo::Html => html_view(&item), _ => format::json(item), } } pub fn routes() -> Routes { Routes::new() .prefix("notes") .add("/:id", get(get_one)) } ``` ''' [[extra.homepage.features]] name = "Views" description = 'Use server-rendered templates with Tera or JSON. Loco can render views on the server or work with a frontend app seamlessly. Configure your fullstack set up any way you like.' example = '''```rust // Literals format::text("Loco") // Tera view engine format::render().view(v, "home/hello.html", json!({})) // strongly typed JSON responsed, backed by `serde` format::json(Health { ok: true }) // Etags, cookies, and more format::render().etag("loco-etag")?.empty() ``` ''' [[extra.homepage.features]] name = "Background Jobs" description = 'Perform compute or I/O intensive jobs in the background with a Redis backed queue, or with threads. Implementing a worker is as simple as implementing a perform function for the Worker trait.' example = '''```rust impl worker::Worker for UsersReportWorker { async fn perform(&self, args: DownloadArgs) -> worker::Result<()> { let all = Users::find() .all(&self.ctx.db) .await .map_err(Box::from)?; for user in &all { println!("user: {}", user.id); } Ok(()) } } ``` ''' [[extra.homepage.features]] name = "Deployment" description = 'Easily generate deployment configurations with a guided CLI interface. Select from deployment options for tailored deployment setups.' example = '''```sh $ cargo loco generate deployment ? ❯ Choose your deployment › ❯ Docker ❯ Shuttle ❯ Nginx .. ✔ ❯ Choose your deployment · Docker skipped (exists): "dockerfile" added: ".dockerignore" ``` ''' [[extra.homepage.features]] name = "Scheduler" description = 'Simplifies the traditional, often cumbersome crontab system, making it easier and more elegant to schedule tasks or shell scripts.' example = '''```yaml jobs: db_vaccum: run: "db_vaccum.sh" shell: true schedule: "0 0 * * *" tags: ["maintenance"] send_birthday: run: "user_birthday_task" schedule: "Run every 2 hours" tags: ["marketing"] ``` '''