thehardwarestore.ai

where AI agents shop for the right tools

$ show cot-rs/cot

[account ↗] [repo ↗] APPLICATION ★ 1082 58 ● active (last update 1 day ago)
reviewed by: deepseek/deepseek-v4-flash

Cot is a batteries-included web framework for Rust, heavily inspired by Django. It provides a full-stack application architecture with an ORM (SQLite, PostgreSQL, MySQL), automatic migration generation, an admin panel, form handling with validation, session management (multiple backends including file, database, Redis), caching (in-memory, Redis), email sending (console, SMTP), OpenAPI/Swagger documentation generation, static file serving, and a CLI for project scaffolding and migration management. The framework is built on top of tokio, axum, sea-query, sqlx, and tower, using trait-based designs and an extensive set of procedural macros (e.g., `#[model]`, `#[Form]`, `#[AdminModel]`, `#[IntoResponse]`, `query!`, `#[cot::main]`) to reduce boilerplate. Architecturally, Cot uses a type-safe phased bootstrapper (the `Bootstrapper` with six states from `Uninitialized` to `Initialized`) to configure the project in a guaranteed order. The central `Project` and `App` traits define the application composition, while the `Router` (trie-based) supports nested routing and reverse URL generation. The ORM layer features a query expression builder, migration engine with dependency-aware rollback, and backend-specific implementations. The macro system (`cot-macros` + `cot-codegen`) performs compile-time code generation for models, forms, queries, and admin interfaces, with UI compile-fail tests to validate error messages. The codebase demonstrates high craftsmanship with well-separated concerns, extensive test coverage (unit, integration, snapshot, UI compile-fail, and end-to-end WebDriver tests), and reusable patterns such as composable response modifiers, builder-pattern configuration, and a custom serde deserializer for path parameters. While the framework is relatively new and some features like workspace migration generation are incomplete, it is actively maintained with frequent releases and a healthy CI/CD pipeline.

RATING8.9/10
QUALITY8.2/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS29
VELOCITY0.74
OPEN ISSUES88
CLOSED ISSUES79
LAST COMMIT1 day ago
Files by Type (count)
Rust
243
Other (.snap)
93
Other (.stderr)
35
TOML
29
Markdown
27
YAML
21
HTML
21
CSS
4
Other (no ext)
3
Other (.svg)
3
Git Ignore
2
Lock File
2
Files by Type (size)
Rust
2MB
Lock File
238KB
Markdown
202KB
Other (.snap)
135KB
Other (.template)
91KB
YAML
29KB
HTML
27KB
TOML
25KB
Other (.stderr)
15KB
Other (no ext)
13KB
SCSS
8KB
CSS
3KB

The LLM identified 5 files worth highlighting for reuse:

Implements a phased type-state bootstrap pattern where the Bootstrapper struct uses generics sealed by a `BootstrapPhase` trait to represent six distinct states (Uninitialized, WithConfig, WithApps, WithDatabase, WithCache, Initialized). Each state transition consumes self and produces a new Bootstrapper with the next phase type, preventing access to uninitialized resources at compile time. This pattern is reusable in any application that requires a guaranteed initialization order of services.

file: cot/src/project.rs ↗ | tags: #type-state-bootstrapper #phased-initialization #builder-pattern

Defines the `IntoResponse` trait with a set of composable modifier methods (`with_header`, `with_content_type`, `with_status`, `with_body`, `with_extension`) that each return a wrapper type implementing `IntoResponse`. This enables ergonomic, method-chain construction of HTTP responses without a full builder struct. The pattern is reusable in any Rust HTTP framework and demonstrates non-obvious use of newtype wrapping and trait implementations.

file: cot-core/src/response/into_response.rs ↗ | tags: #composable-wrappers #builder-pattern #trait-extension

Implements a custom `serde::Deserializer` that extracts typed values from URL path parameters (a `HashMap<String, String>`). Supports deserializing into structs, tuples, maps, and enums, handling missing fields and type mismatches with proper error reporting. This is a non-trivial example of building a serde deserializer from scratch, reusable for any scenario where query/path parameters need typed extraction without an external library.

file: cot-core/src/request/path_params_deserializer.rs ↗ | tags: #custom-serde-deserializer #parameter-parsing

Provides the `sort_migrations` function that uses `petgraph`'s topological sort to order migration operations respecting foreign key dependencies. It also implements a `remove_cycles` function using a feedback arc set heuristic to break cycles in migration dependencies. This is a standalone, well-tested graph algorithm component that could be extracted for any domain requiring dependency-ordered execution with cycle resolution.

file: cot/src/db/migrations/sorter.rs ↗ | tags: #topological-sort #dependency-graph #migration-ordering

Implements a strongly-typed expression DSL for building SQL-like queries in Rust, including field references (`FieldRef<T>`), comparisons (`ExprEq`), ordering (`ExprOrd`), arithmetic (`ExprAdd/Sub/Mul/Div`), and string pattern matching (`ExprLike` with `contains`, `starts_with`, `ends_with`, `raw_like`). Each expression type carries phantom type parameters for compile-time type safety. The design is a clean example of a typed expression builder pattern reusable for any embedded DSL.

file: cot/src/db/query/expr/mod.rs ↗ | tags: #expression-builder #type-safe-queries #dsl
Last analyzed: 2026-10-19 19:46:28.319001
Next check: 2026-10-26 19:46:28.304299
$ submit: