Docs menu

Get started with your agent

Using Claude Code, Cursor, or another coding agent? This page covers everything it needs to add dotwire to your app. Copy the prompt below into your agent, or point it at this page.

What your agent needs

A running dotwire. dotwire needs PostgreSQL with TimescaleDB and NATS with JetStream. For local work, docker compose up -d in the dotwire repository starts all three. See the Quickstart.

Configuration on dotwire's side:

  • Dotwire__Encryption__ActiveKeyId and Dotwire__Encryption__Keys__<id>: a 32-byte base64 key from openssl rand -base64 32.
  • Auth__Issuer and Auth__Audience, matching what your host puts in its tokens.
  • Auth__Keys__<kid>: your host's RSA public key of at least 2048 bits, in PEM form: one double-quoted line with \n for each line break in a .env file, or real newlines in a compose environment value. Or Auth__JwksUrl, over https.
  • Cors__AllowedOrigins__0: your app's origin, if the browser and dotwire are on different origins.

Code on your host's side:

  • One host SDK on the backend: @dotwire/host for Node.js 22 or later, or Dotwire.Host for .NET. It holds the RSA private key, which never leaves the backend.
  • A member role and room membership for each user, granted through the host SDK. A token alone doesn't grant access to a room.
  • An authenticated token endpoint that returns { "token": "..." } for the user in the current session.
  • A browser client, @dotwire/client or @dotwire/react, pointed at dotwire and at that token endpoint.

Rules it must follow:

  • Room ids are UUIDs. A room exists once it has members, and there is no create step.
  • Token lifetime (exp - iat) is 60 minutes at most. Shorter is better.
  • Take the user id from the host session, never from the request body.
  • dotwire stores user ids only. Names and avatars come from your own user directory.
  • Keep the client's default transport: 'websockets'.
  • If you use webhook call-outs, set the same webhookSecret / WebhookSecret on dotwire and in the host SDK.

Tuning with your agent

The defaults suit most deployments, so the prompt tells your agent to change nothing until it knows your scenario. It reads your compose files, .env and connection strings first, then asks you:

  • How many concurrent REST clients do you expect, and what is the peak in messages per second?
  • Is this one node or several, and is the database on another network?
  • How quickly must a removed member lose access? This decides whether the auth cache is acceptable.
  • Do you need a retention window, or other compliance settings?
  • Do you use webhooks, SSE or hub sends?
  • Do you prefer throughput or durability? For throughput, keep the NATS sync_interval server option at its default. For durability, set it to always.

It then picks the row of the scenario table that matches your traffic and applies it, with no benchmarking on your side. It says which values are measured and which are guesses. It must not turn on Dotwire:AuthCacheSeconds or relax a security setting without your explicit yes.

The prompt

Copy the prompt, paste it into your agent, and fill in your stack on the first line:

To route sends through your own checks first, have your agent read Moderation webhooks as well. If something fails, Troubleshooting maps each error and log line to its cause.

Star the repo

Enjoying dotwire? Star pasztor-mark/dotwire on GitHub. It helps other people find the project and tells us it's worth building on. Found a bug or a gap in these docs? Open an issue.