Hexser Workspace
From the founders: Hi all, thank you for checking out Hexser.
We are the authors of N Lang,, and we strongly believe that Rust's and N Lang's robust type systems and meaningful designs are the future of software engineering. We wrote this library to allow people to create incredible applications in Rust quickly while also giving them best-in-class generative code support and good design.
"Good Design is Good Business" - Thomas J. Watson Jr., the former CEO of IBM.
Hexser allows you to build incredibly small and incredibly large Rust apps that fit perfectly into the Squillo ecosystem but also for professional teams. We are proud to Open-Sourcing this library under MIT or Apache and can't wait to see how you use it.
Enjoy!
Build real-world, hexagonal Rust apps without the ceremony. Hexser is a pragmatic, zero‑boilerplate take on Hexagonal Architecture with a clear Domain–Ports–Adapters flow, fast iteration, automatically graphed inference, and copy‑pasteable examples.
Crates
Main crates (jump in):
Documentation:
- hexser crate README: ./hexser/README.md
- hexser_potions crate README: ./hexser_potions/README.md
- hexser_macros crate README: ./hexser_macros/README.md
Why Hexser?
Why teams choose Hexser:
- Zero boilerplate: write traits for your Ports and small impls for Adapters — that’s it.
- Query‑first repositories: lightweight domain filter/sort types keep adapters simple and testable.
- First‑class use‑cases: model application logic as Directives (clear, explicit, testable).
- Fast feedback: in‑memory adapters and ready‑to‑paste Potions get you shipping quickly.
- Opt‑in macros: reduce repetition without hiding control flow; nothing “magic” at runtime.
Quick start
Quick start with hexser:
[dependencies]
hexser = { path = "./hexser", version = "0.7", features = ["macros"] }
Upgrading from 0.6? Read hexser/MIGRATING_0.6_TO_0.7.md: the
single writer's Actor, closed vocabularies and refusals, proved edges, findings(), and the
deprecations. Its examples are compiled as doctests.
use hexser::prelude::*;
// Domain entity
struct User { id: String }
impl HexEntity for User { type Id = String; }
// Repository port (query-oriented)
// Define lightweight filter/sort types in your domain
#[derive(Debug, Clone)]
enum UserFilter { ByEmail(String), ById(String), All }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum UserSortKey { Email }
trait UserRepository: QueryRepository<User> {}
// Usage (adapter decides how to match filters)
// let found = <YourRepo as QueryRepository<User>>::find_one(&repo, &UserFilter::ByEmail("[email protected]".into()))?;
Claude Code plugin
Using hexser with Claude Code? Install the official plugin — it teaches Claude the current hexser API and adds commands for scaffolding, review, visualization, and migration:
/plugin marketplace add squillo/hexser
/plugin install hexser@hexser
It ships an auto-activating hexser skill (it fires whenever you edit Rust that uses hexser) plus slash commands: /hexser:new, /hexser:add-adapter, /hexser:add-usecase, /hexser:review, /hexser:graph, /hexser:migrate, and /hexser:mcp-setup (wires hexser's MCP server so Claude can read your architecture graph live). See plugins/hexser/README.md.
CloudEvents v1.0 Support
Hexser includes built-in support for CloudEvents v1.0 specification, enabling standards-compliant, transport-agnostic domain event publishing and consumption:
- Standards-compliant: Full CloudEvents v1.0 specification compliance
- Transport-agnostic: Works with HTTP, Kafka, AMQP, and other transports
- Hexagonal design: Clear separation between domain events, ports, and adapters
- Zero dependencies: Native implementation without external CloudEvents crate
- CQRS integration: Seamless integration with Directives (write) and Queries (read)
use hexser::prelude::*;
use hexser::ports::events::{CloudEventsEnvelope, EventPublisher};
// Define domain event
struct UserCreated {
user_id: String,
email: String,
}
impl DomainEvent for UserCreated {
fn event_type(&self) -> &str { "com.example.user.created" }
fn aggregate_id(&self) -> String { self.user_id.clone() }
}
// Wrap in CloudEvents envelope
let event = UserCreated {
user_id: String::from("user-123"),
email: String::from("[email protected]"),
};