DEV Community

Alex Spinov
Alex Spinov

Posted on

Darklang Has a Free API: Write Backend Code That Deploys Instantly With Zero Infrastructure

Darklang is a language and platform where your backend code deploys the instant you write it. No servers, no containers, no CI/CD — write a function and it's live immediately.

Why Darklang Matters

The deployment pipeline (write code, commit, CI/CD, container build, deploy, wait) takes minutes to hours. Darklang eliminates ALL of it. Type a function, it's live. Change a line, it's updated.

What you get for free:

  • Instant deployment: code is live as you type
  • Built-in datastore (no database setup)
  • Built-in background workers
  • Built-in scheduled jobs
  • Trace-driven development (see real requests as you code)
  • No infrastructure to manage — ever
  • Feature flags built into the language

How It Works

Traditional:
Code → Git → CI → Docker Build → Push → Deploy → Wait → Live
(5-30 minutes)

Darklang:
Code → Live
(0 seconds)
Enter fullscreen mode Exit fullscreen mode

HTTP Handlers

// GET /api/users/:id — live instantly
let user = DB::get Users params.id
match user with
| Just u -> Http::respond 200 u
| Nothing -> Http::respond 404 { error: "User not found" }

// POST /api/users — also live instantly
let body = request.body
let user = {
  id: DB::generateID()
  name: body.name
  email: body.email
  createdAt: Date::now()
}
DB::set Users user.id user
Http::respond 201 user
Enter fullscreen mode Exit fullscreen mode

Built-in Datastore

// No database setup, no migrations, no connection strings
// Just use it:
DB::set Users "user-123" {
  name: "Alice"
  email: "alice@example.com"
  role: "admin"
}

let user = DB::get Users "user-123"
let allAdmins = DB::queryWith Users \u -> u.role == "admin"
let count = DB::count Users
DB::delete Users "user-123"
Enter fullscreen mode Exit fullscreen mode

Background Workers

// Define a worker — it processes jobs from a queue
worker: processOrder
let order = event
let result = {
  // Process payment
  let payment = HttpClient::post "https://payments.api/charge" {
    amount: order.total
    currency: "USD"
  }

  // Update order status
  DB::set Orders order.id {
    ...order
    status: "paid"
    paymentId: payment.body.id
  }

  // Send confirmation
  HttpClient::post "https://email.api/send" {
    to: order.email
    subject: "Order Confirmed"
    body: "Your order #" ++ order.id ++ " is confirmed!"
  }
}
result
Enter fullscreen mode Exit fullscreen mode

Scheduled Jobs (Cron)

// Runs every hour — no crontab, no scheduler config
cron: cleanupExpired (every 1h)
let expired = DB::queryWith Sessions \s ->
  Date::lessThan s.expiresAt (Date::now())

List::forEach expired \session ->
  DB::delete Sessions session.id

{ cleaned: List::length expired }
Enter fullscreen mode Exit fullscreen mode

Trace-Driven Development

Darklang captures real HTTP requests and shows them in the editor. You write code WHILE seeing actual data flow through it.

1. Deploy empty handler
2. Send a real request to it
3. See the request data in the editor
4. Write code using the actual data
5. Code handles that exact request — immediately
Enter fullscreen mode Exit fullscreen mode

Feature Flags

// Built into the language — no external service
let response = match Flag::get "new-pricing" with
| true -> calculateNewPricing order
| false -> calculateOldPricing order

Http::respond 200 response
Enter fullscreen mode Exit fullscreen mode

External API Calls

// Make HTTP calls to any external API
let weather = HttpClient::get "https://api.weather.com/current" {
  headers: { "API-Key": Secrets::get "WEATHER_KEY" }
  query: { city: "London" }
}

let parsed = {
  temp: weather.body.main.temp
  description: weather.body.weather[0].description
  humidity: weather.body.main.humidity
}

Http::respond 200 parsed
Enter fullscreen mode Exit fullscreen mode

Useful Links


Building instant backend services? Check out my developer tools on Apify for ready-made web scrapers, or email spinov001@gmail.com for custom solutions.

Top comments (0)