Installation
anarchon comes as the anarchon package on npm (Node.js 20 or newer) and as the Anarchon packages on NuGet (.NET 10). Pick your language; the tab you pick holds for every page.
Install anarchon and the driver for your store. Drivers are optional peer dependencies, so you only install the one you use.
Works with Redis 5 or newer and with Valkey. redis (node-redis) is only needed if anarchon opens the
connection for you. You can pass a client your app already has instead: ioredis, iovalkey,
node-redis or Valkey GLIDE.
PostgreSQL 9.5 or newer. You can pass your own pg Pool or Client, or a postgres.js
instance, instead of a connection string.
Nothing else is needed on Node 22.13 or newer, which has node:sqlite built in. Node 22.5 to
22.12 need the --experimental-sqlite flag. On Node 20 add better-sqlite3@12: version 13
needs Node 22. For a libSQL server or Turso add @libsql/client.
SQLite 3.35 or newer.
RabbitMQ 3.9 or newer.
JetStream must be enabled on the server; the lease strategy needs nats-server 2.10 or newer.
npm install and yarn add work the same way.
Each store is a package of its own, which brings in Anarchon (the core) and the store’s driver.
Redis 5 or newer, or Valkey, on StackExchange.Redis. You can pass an IConnectionMultiplexer your app already has.
PostgreSQL 9.5 or newer, on Npgsql. You can pass your app’s NpgsqlDataSource instead of a connection string.
SQL Server 2016 or newer, or Azure SQL, on Microsoft.Data.SqlClient. .NET only: the Node.js package has no SQL Server backend.
Microsoft.Data.Sqlite brings SQLite with it (3.24 or newer is needed). libSQL and Turso are Node.js only.
RabbitMQ 3.9 or newer, on RabbitMQ.Client 7.
JetStream must be enabled on the server; NatsStrategy.Lease needs nats-server 2.10 or newer.
With a host (ASP.NET Core, a worker service), AddAnarchon() and UseRedis(), UsePostgres(),
UseSqlServer(), UseSqlite(), UseRabbitMQ() or UseNats() come with these packages: see
ASP.NET Core.
Which store should I pick?
Section titled “Which store should I pick?”Use the one your service already has. If you have a choice:
| You have | Use | Why |
|---|---|---|
| Redis or Valkey | The default, lease strategy |
The full feature set, and the least latency |
| PostgreSQL, no Redis | PostgresBackend |
The full feature set, with no new infrastructure |
| One machine, several processes | SqliteBackend on a file |
No server at all |
| Only NATS | NatsBackend with its lease strategy (strategy: 'lease', NatsStrategy.Lease) |
The full feature set, on a JetStream key-value bucket |
| Only RabbitMQ | RabbitMQBackend |
One winner per run, but no backups, overlap protection or catch-up |
Backends overview compares them in detail.
TypeScript
Section titled “TypeScript”Node.js only: anarchon is written in TypeScript and ships its own types. There is nothing extra to install.
It also works from plain JavaScript, with require or import:
Check that it works
Section titled “Check that it works”It uses a SQLite file, so it needs no server.
Save this as check.mjs and run node check.mjs (Node 22.13 or newer).
In a console project with Anarchon.Sqlite, put this in Program.cs and run dotnet run.
You should see a line every two seconds, then the process exits.
Quick start builds a small scheduler and runs it as three instances.