Remix.run Logo
Show HN: Doo – Generate auth and CRUD APIs from struct definitions(github.com)
3 points by nynrathod a day ago | 1 comments

Built Doo because I was tired of writing 200 lines of auth boilerplate for every API.

Example (complete API):

import std::Http::Server;

import std::Database;

struct User {

     id: Int @primary @auto,
     email: Str @email @unique,
     password: Str @hash,
}

fn main() {

     let db = Database::postgres()?;
     let app = Server::new(":3000");

     app.auth("/signup", "/login", User, db);
     app.crud("/todos", Todo, db);  // Todo = any struct you define
    
     app.start();
 }
Result:

- POST /signup with email validation + password hashing (automatic from @email, @hash)

- POST /login with JWT

- Full CRUD endpoints for GET, POST, GET/:id, PUT/:id, DELETE/:id

- Compiles to native binary

Status: Alpha v0.3.0. Auth, CRUD, validation, and Postgres working. Actively fixing bugs.

https://github.com/nynrathod/doolang

What would you need to see before using this in production?

nynrathod a day ago | parent [-]

Author here. Happy to answer questions!

What I'd love feedback on:

1. Is the @decorator syntax clear or confusing?

2. Would you use this for a real project?

3. What's the #1 missing feature?

Repo: https://github.com/nynrathod/doolang

Examples: https://github.com/nynrathod/doolang/tree/main/examples