//Durable Objects

Serverless code with its own consistent state

Build and run chat services, multiplayer systems, and collaborative apps that keep users in sync worldwide, with no message brokers or state stores to manage.

Your Stack, Your Way
  • Next.js
  • Astro
  • React
  • Vue
  • Angular
  • Nuxt
  • Gatsby
  • Hugo
  • Preact
  • Remix
  • Qwik
  • Vite
  • VitePress
  • Docusaurus
  • Eleventy
  • Hexo
  • Jekyll
  • Hono
  • Node.js
  • AWS
  • Google Cloud
  • Azure
  • Cloudflare Workers
  • Terraform
  • GitHub
  • OpenAI
  • Anthropic
  • Groq
  • SQLite
  • Drizzle

Long-running serverless apps

Durable objects run for as long as the work takes. They can compute in the background and handle high volumes of requests concurrently.

Every user in sync, instantly

Each durable object works as a WebSocket server and client. Broadcast state to all connected clients in a few lines of code.

Scale to millions as you grow

Give each unit of work in your app its own lightweight, isolated durable object. Run millions of them, with no capacity to plan.

Durable state, no lost writes

Every durable object has an embedded SQLite database, so state survives restarts and failures. No write is confirmed until it's durable.

Background work on autopilot

Run code in the background, poll APIs periodically, or schedule future work with alarms. The platform wakes the durable object on time.

Ship faster with no rewrites

Use the Durable Objects API you already know. Existing classes run on Azion without a rewrite, so you write the logic, not the plumbing.

One coordinator for every unit of shared state

Every call to a durable object reaches its one active instance, wherever it runs across 100+ data centers. A conditional write in durable storage guarantees a single owner, even during network failures. You write the class. Azion handles placement, routing, and failover.

Users in different regions connected to durable objects running across Azion

Use cases

Stateful agent runtime

Give each agent its own durable object to keep conversation and task state, run steps in order, and resume after a pause.

Real-time chat with presence

Run one durable object per room to store messages, track who's online, and broadcast every update to connected users.

Authoritative game server

Keep each match's players, rules, and score in one durable object and push every move to all players as it happens.

Live document sync

Route all edits to a document through its durable object, so concurrent changes apply in order and everyone sees the same version.

Inventory and seat reservations

Manage each event, cart, or SKU in its own durable object, so the same seat or item is never sold or added twice.

Consistent shared counters

Count likes, votes, views, or quotas in a durable object, so every increment lands even when updates arrive all at once.

The shortest path to real-time, stateful apps

Requests from anywhere reach the same durable object, so one instance coordinates every client that shares its state. It handles fan-in and fan-out over WebSockets, and its embedded SQLite database keeps state, events, and history next to your code.

counter.ts
01import { DurableObject } from 'azion/durable-objects';
02
03export class Counter extends DurableObject {
04 // Events run one at a time: two increments never interleave.
05 async increment() {
06 const next = ((await this.ctx.storage.get('count')) ?? 0) + 1;
07 await this.ctx.storage.put('count', next);
08 return next;
09 }
10}
11
12export default {
13 async fetch(request, env) {
14 const name = new URL(request.url).searchParams.get('name');
15 if (!name) return new Response('Missing ?name', { status: 400 });
16
17 const total = await env.COUNTER.get(env.COUNTER.idFromName(name)).increment();
18 return Response.json({ name, total });
19 }
20};
Contabilizei
With Azion, Contabilizei improved request delivery at the Edge, reduced infrastructure costs, and gained fast access to support whenever needed.
Fabrício SantosDevSecOps Manager at Contabilizei

All the development primitives you need

Frequently Asked Questions

Build your next app today

Pick a template and deploy it in seconds, or talk to a specialist about your workload.

Function Starter KitHello World app powered by a function.
Deploy now
AI Inference Starter KitAI app with no origin dependency.
Deploy now
Next.js E-commerceNext.js storefronts to choose from.
Deploy now
LangGraph AI Agent BoilerplateAI agent with RAG, built with LangGraph.
Deploy now
React BoilerplateReact single-page application.
Deploy now
Next.js Static BoilerplateNext.js single-page application.
Deploy now
Astro BoilerplateBasic Astro project for content-driven sites.
Deploy now
Vue BoilerplateVue single-page application.
Deploy now
Angular BoilerplateAngular single-page application.
Deploy now
Nuxt ContentBlog or docs site with Nuxt Content.
Deploy now
Astro E-commerceAstro storefronts to choose from.
Deploy now
Neon Database Starter KitApp connected to Neon with Drizzle ORM.
Deploy now
Turso Starter KitApp connected to Turso with Drizzle ORM.
Deploy now
Upstash GeoLocationMessages by the user's location.
Deploy now
Qwik BoilerplateProject based on the Qwik framework.
Deploy now
Docusaurus TypeScript BoilerplateStatic Docusaurus project in TypeScript.
Deploy now