Skip to content

Type-safe language for building APIs fast. Auth, CRUD, and deployment built-in, written in rust & llvm

Notifications You must be signed in to change notification settings

nynrathod/doolang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

516 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Doo - Ship Production APIs in Minutes, Not Days

Rust LLVM Native

⚠️ Alpha Software: Doo is in active development. Expect bugs and breaking changes. Not recommended for critical production use yet.

Doo is a statically-typed, compiled programming language built in Rust + LLVM, designed for building production APIs quickly and safely. It uses automatic memory management via reference counting.

Stop wrestling with boilerplate. Write type-safe APIs and deploy with one command.

// main.doo - Your entire API
import std::Http::Server;
import std::Database;

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

struct Todo {
    id: Int @primary @auto,
    title: Str @min(3),
    done: Bool @default(false),
}

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

    // Authentication via JWT
    app.auth("/signup", "/login", User, db);

    // Full CRUD
    // GET, POST, GET/:id, PUT/:id, DELETE/:id
    app.crud("/todos", Todo, db);

    app.start();
}

Run it:

doo run  # Compiles to native + starts server

Why Doo?

Traditional Stack Doo
500+ lines of boilerplate 20 lines of code
3 config files Zero config
Manual validation Auto-validated decorators
Separate deployment setup One command deploy
Type mismatches at runtime Compile-time safety

πŸ”§ Installation

Windows (PowerShell)

irm https://raw.githubusercontent.com/nynrathod/doolang/main/install.ps1 | iex

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/nynrathod/doolang/main/install.sh | bash

Verify Installation

doo --help

🎯 Quick Start

Starter Template

doo init --template starter starter-api
cd starter-api
doo run

Blog Template

doo init --template blog blog-api  # Blog posts + comments API
cd blog-api
doo run

Visit http://localhost:3000 - your API is live.


πŸ“– Real-World Example

Complete task management API with auth, CRUD, and custom queries:

import std::Http::Server;
import std::Database;

enum Status { Todo, InProgress, Done }
enum Priority { Low, Medium, High }

struct User {
    id: Int @primary @auto,
    email: Str @email @unique,
    password: Str @hash @min(8),
}

struct Task {
    id: Int @primary @auto,
    title: Str @min(1) @max(200),
    status: Status @default(Status::Todo),
    priority: Priority @default(Priority::Medium),
    userId: Int @foreign(User),
}

fn GetUrgent() -> [Task] ! DatabaseError {
    let db = Database::get()?;
    let result: [Task] = db.rawWithParams(
        "SELECT * FROM tasks WHERE priority = $1 AND status != $2",
        [Priority::High, Status::Done]
    )?;
    Ok result;
}

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

    app.auth("/signup", "/login", User, db);
    app.crud("/tasks", Task, db);
    app.get("/tasks/urgent", GetUrgent);

    app.start();
}

That's it. 30 lines for a production-ready API with:

  • βœ“ User authentication with JWT
  • βœ“ Password hashing
  • βœ“ Struct validation
  • βœ“ Full CRUD operations
  • βœ“ Custom business logic
  • βœ“ Auto error propagation
  • βœ“ Auto migrate table on startup

🌐 Language Essentials

Variables & Types

let name = "Alice";         // Type inferred
let age: Int = 25;          // Explicit
let mut count = 0;          // Mutable
Type Example
Int 42
Float 3.14
Str "hello"
Bool true
[T] [1, 2, 3]
{K: V} {"a": 1}

Structs & Validation

struct User {
    id: Int @primary @auto,
    email: Str @email @unique,
    password: Str @hash @min(8) @max(20),
    age: Int @min(18),
}

// Automatically create table on startup
struct AuditLog @table {
    id: Int @primary @auto,
    action: Str
}

Error Handling

fn divide(a: Int, b: Int) -> Int ! Str {
    if b == 0 { Err "division by zero"; }
    Ok a / b;
}

let result = divide(10, 2)?;  // Auto-propagate errors

HTTP Routes

fn GetUser(id: Int) -> User ! DatabaseError {
    let db = Database::get()?;
    Ok db.query("SELECT * FROM users WHERE id = $1", id)?;
}

app.get("/users/:id", GetUser);

Full language guide: See examples/ folder for complete tutorials


πŸ“¦ Examples

More examples: examples/


πŸ’¬ Community & Support

  • GitHub Discussions: Ask questions, share projects
  • Issues: Bug reports and feature requests
  • Contributing: We welcome PRs! See CONTRIBUTING.md

What's Next

We're focused on adoption first. Next features will be driven by real developer needs:

  • More cloud providers + zero-config hosting
  • Multi-database support (MySQL, SQLite etc)
  • WebSocket, concurrency, async and many more

Want to influence the roadmap? Open a discussion β†’


πŸ“œ License

This project is licensed under the MIT License


πŸ™ Acknowledgments

  • LLVM Project: For the powerful backend infrastructure
  • Rust Community: For inspiration and excellent tooling

Ready to ship faster? doo init starter ← Start here

Want to contribute? See CONTRIBUTING.md
For testing and development: See TEST.md

About

Type-safe language for building APIs fast. Auth, CRUD, and deployment built-in, written in rust & llvm

Topics

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published