etcd3 is a high-quality, production-ready client for the Protocol Buffer-based etcd v3 API. It includes:
- load balancing
- fault handling and reconnections
- transactions
- software transactional memory
- high-level query builders
- lease management
- fair distributed mutexes
- watchers
- user and role mocking management
- elections
and is type-safe for TypeScript consumers.
Install via:
npm install --save etcd3
Start building!
import { Etcd3 } from 'etcd3';
const client = new Etcd3();
(async () => {
await client.put('foo').value('bar');
const fooValue = await client.get('foo').string();
console.log('foo was:', fooValue);
const allFValues = await client.getAll().prefix('f').keys();
console.log('all our keys starting with "f":', allFValues);
await client.delete().all();
})();Browse the TypeDoc API reference.
Our test cases are also readable.
$ npm install
$ cd src/test/containers/3.2 && docker compose up # in a separate shell
$ npm test
$ docker compose downRunning tests for this module requires Node.js 24 or later and an etcd3 server locally. The tests try to use the default port initially, and you can configure this by setting the ETCD_ADDR environment variable, like export ETCD_ADDR=localhost:12345.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.