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__ActiveKeyIdandDotwire__Encryption__Keys__<id>: a 32-byte base64 key fromopenssl rand -base64 32.Auth__IssuerandAuth__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\nfor each line break in a.envfile, or real newlines in a composeenvironmentvalue. OrAuth__JwksUrl, overhttps.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/hostfor Node.js 22 or later, orDotwire.Hostfor .NET. It holds the RSA private key, which never leaves the backend. - A
memberrole 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/clientor@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/WebhookSecreton 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_intervalserver option at its default. For durability, set it toalways.
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.