Real-time messaging for any nSelf-powered app. Channels, direct messages, threads, reactions, and file attachments — all stored in your Postgres database with full history.
nself-chat is the core plugin in the ɳChat bundle. Set your license key with nself license set nself_pro_... before installing.
nself license set nself_pro_...
nself plugin install chat
nself build
nself startnself-chat provides a complete messaging backend: channels (public, private, and direct), threads, message reactions, read receipts, and file attachments up to 100 MB via nself-storage integration. Messages are stored in Postgres and indexed in MeiliSearch when the search plugin is active.
The plugin ships a GraphQL schema extension so you can query and mutate messages directly through Hasura alongside your other app data. Presence tracking (online/away/offline) is handled automatically when the realtime plugin is also installed.
Moderation hooks let you pipe every message through the nself-moderation plugin before delivery, or call your own webhook for custom filtering. Retention policies let you auto-delete messages after a configurable window.
| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Postgres connection string (auto-set by nself) |
CHAT_MAX_MESSAGE_BYTES | No | Maximum message size in bytes. Default: 65536 (64 KB) |
CHAT_MAX_ATTACHMENT_MB | No | Maximum file attachment size in MB. Default: 100 |
CHAT_RETENTION_DAYS | No | Auto-delete messages older than N days. Default: 0 (keep forever) |
CHAT_MODERATION_WEBHOOK | No | Webhook URL called before message delivery for custom filtering |
| Endpoint | Method | Description |
|---|---|---|
/chat/channels | GET / POST | List channels or create a new channel |
/chat/channels/:id/messages | GET / POST | Fetch message history or send a message |
/chat/messages/:id/react | POST | Add or remove a reaction |
/chat/messages/:id/thread | GET / POST | Read or reply to a thread |
/chat/upload | POST | Upload an attachment (multipart/form-data) |
/health | GET | Plugin health check |
| Table | Purpose |
|---|---|
np_chat_channels | Channels and DM threads with membership and settings |
np_chat_messages | All messages with sender, body, attachments, and edit history |
np_chat_reactions | Per-message emoji reactions |
np_chat_members | Channel membership, roles, and last-read pointers |
np_chat_attachments | File attachment metadata (stored in MinIO via nself-storage) |
| Event | Payload |
|---|---|
chat.message.created | Full message object including channel, sender, and body |
chat.message.deleted | Message ID and channel ID |
chat.channel.created | Channel metadata and initial membership list |
chat.member.joined | User ID and channel ID |
nself-chat is the foundation of the ɳChat bundle. Install it alongside nself-livekit for video calls, nself-recording for call recording, nself-moderation for AI content filtering, nself-bots for automated bots, and nself-realtime for presence and live typing indicators.
| Feature | nself-chat | Stream Chat | Sendbird |
|---|---|---|---|
| Data ownership | Your Postgres, your server | Stream's servers | Sendbird's servers |
| Monthly cost (10K MAU) | $0.99 (bundle) | ~$399 | ~$399 |
| GDPR / data residency | Full control | Region-locked tiers | Region-locked tiers |
| Message history | Unlimited (disk-bound) | Up to 5 years | Plan-dependent |
Messages not delivering: Check that nself-realtime is installed and running on port 3109. Chat delivery depends on the realtime pub/sub layer for push to connected clients.
Attachments failing: Verify nself-storage (MinIO) is enabled in your nself config. Check CHAT_MAX_ATTACHMENT_MB against your MinIO bucket policy.
Search not returning messages: The chat plugin indexes into MeiliSearch automatically when the search plugin is active. Run nself plugin status search to verify.
Port: 3401 | Bundle: ɳChat ($0.99/mo) or ɳSelf+ ($3.99/mo) | Last Updated: May 2026 | Plugin Version 1.0.13