Backend integration (any language)
Cariosan is plain REST. Wire it from Node, Python, PHP, Ruby, Java, .NET, Bash — anything with an HTTP client.
Cariosan ships official SDKs for Go (cariosan-go) and TypeScript (@cariosan/client), but you don't have to use them. The wire surface is plain REST + WebSocket. Any backend that can speak HTTP can integrate.
This page shows you the minimum integration in five popular backends so you can copy and adapt.
What your backend needs to do
In the typical Cariosan setup, your backend has exactly one job: issue a short-lived user JWT to your frontend, signed with your workspace's api_secret. The frontend talks directly to Cariosan after that.
Each request your backend makes to Cariosan:
The response:
Hand that token to your frontend. That's it.
Keep api_secret on the server
The sk_* secret must never reach a browser. Storing it in env vars on your server is the standard pattern. If it leaks, rotate it.
Examples
The flow in every backend is the same: upsert the user → issue JWT → return to frontend. Only the syntax changes.
Node.js (Express + built-in fetch)
Python (Flask + requests)
PHP (Laravel)
Ruby (Rails)
Bash (curl, for quick CI / scripting)
When to use an official SDK
The official SDKs (cariosan-go, @cariosan/client) give you typed responses, automatic retries, and convenience methods for non-JWT operations (uploading attachments, building channel queries). If your backend is already in Go or TypeScript, the SDK is the easier path.
For everything else, raw HTTP is fully supported and never going to go away. The REST surface is documented in the API reference.
Optional: webhooks
If you want to react to events (a new message arrived, a channel was created, a user joined), point Cariosan at a URL on your backend and verify the X-Cariosan-Signature header. See Webhooks guide.
This is also language-agnostic: the signature is HMAC-SHA256 of the raw body using your api_secret as the key.
Optional: server-side operations
Anything you can do via the SDK, you can do via raw HTTP:
- Create channels:
POST /v1/channels - Add/remove members:
POST /v1/channels/{id}/members - Send system messages:
POST /v1/messageswithsystem: true - Generate presigned attachment URLs:
POST /v1/attachments/presign
Browse the full surface in the API reference.
Minimum-viable backend without any framework
If you don't have a backend yet and don't want to spin up Express / Flask / Rails just for this, use a serverless function:
- Vercel / Netlify functions — single
.jsor.tsfile, deploys withgit push. - Cloudflare Workers — same shape, runs at the edge.
- AWS Lambda + API Gateway — slightly more setup but free tier is generous.
The Node example above is a complete Vercel function with no edits needed (just rename to api/cariosan-token.js).
Next steps
- API keys — what each credential type is, how to rotate
- Webhooks guide — receive events from Cariosan
- WebSocket protocol — what the frontend SDK actually wraps
- API reference — full REST surface
Was this page helpful?