r/ProgrammingLanguages • • 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

24 Upvotes

42 comments sorted by

View all comments

Show parent comment

1

u/Inconstant_Moo 🧿 Pipefish May 01 '26

Well this is definitely The Way. I've been working on an essay where I explain why this is basically the only sensible way to do SQL integration. Have you ever seen the JVA ORM? It's the dumbest thing I've ever seen.

1

u/SearchFair3888 May 01 '26

Yes, but I'm not expert yet in such design still learning. It seems design sql in language is huge part not just a typical language design.