r/ProgrammingLanguages • u/SearchFair3888 • Apr 30 '26
Language announcement Doolang – your struct definition is your schema, your validation, and your HTTP contract
Most stacks make you define the same data model four times. Once for the database schema, once for the model class, once for validation, once for the API contract. They drift. They break. You maintain all four.
Doolang collapses them into one:
struct User {
id: Int @primary @auto,
email: Str @email,
password: Str min(8),
}
struct Task {
id: Int @primary @auto,
title: Str @min(1) @max(200),
userId: Int @foreign(User),
}
fn main() {
let db = Database::Postgres()?;
let app = Server::new(":3000");
app.auth("/signup", "/login", User, db);
app.crud("/tasks", Task, db);
app.start();
}
doo run. That's a native binary with JWT auth, password hashing, input validation, SQL migration, and full CRUD. Annotations aren't library decorators; they're compiler constructs. The compiler generates the SQL schema and HTTP layer directly from the struct.
Built on Rust + LLVM. Automatic ownership and borrow system with auto clone/copy/move no explicit lifetimes. Structured concurrency, websocket, file, query builder, RBAC, rate limiting, CORS, logger, middleware all in stdlib. Typed error propagation with -> T ! ErrorType.
Alpha. Real bugs. I'm running DooCloud on it in production as the real test.
github.com/nynrathod/doolang
Benchmarks: github.com/nynrathod/doo-benchmark
View all comments
Show parent comment
3
u/Resident-Letter3485 May 01 '26
Doing something similar in my language, essentially:
What is neat is when you make a language like this that handles your DB schema, you can validate all SQL against the schema during compile time. Eventually, I really want to explore something like this:
where we can actually determine at compile time if the query results are the correct type.