These settings describe implemented configuration sources. Example defaults are local-development defaults. Their presence is not production-readiness evidence. Standard Laravel database/runtime options follow Laravel's own configuration; chat-specific options are listed below.
Laravel package#
Standalone native operators can configure an existing private MySQL host using the external database procedure. Its private approval file belongs only on the server; it is not an SDK/widget option. Host Composer integrations continue to use their own Laravel database and identity configuration; no additional host login system is required by these helpers.
Publish service-chat-config to override config/service-chat.php.
| Key | Type / default | Required | Secret / location | Behavior |
|---|---|---|---|---|
service-chat.route_prefix | string, api/chat | Yes | No, server | REST path prefix |
service-chat.middleware | string array, ['api','auth'] | Yes | No, server | Host authentication and API protection |
service-chat.adapter | class string, null | Yes | No, server | Must implement HostAdapter; missing adapter throws a configuration error |
service-chat.attachments.disk | string disk name, FILESYSTEM_DISK env (fallback local) | No | No, server | Storage disk for attachment bytes. Must be private; a disk with visibility => public is refused with 500. |
service-chat.attachments.max_kilobytes | integer, 8192 | No | No, server | Per-file ceiling; enforced by validation and re-checked on confirm |
service-chat.attachments.max_per_message | integer, 5 | No | No, server | Attachments per message and per staged composer set |
service-chat.attachments.mimetypes | string list, jpeg/png/webp/pdf | No | No, server | Authoritative content allowlist; images render inline, other kinds download |
service-chat.attachments.url_ttl_minutes | integer, 60 | No | No, server | Lifetime of the signed download URL |
service-chat.attachments.upload_mode | auto, proxy or presigned; default auto | No | No, server | auto presigns direct-to-storage on remote disks and proxies on local disks |
service-chat.attachments.download_mode | auto, route or disk; default auto | No | No, server | auto uses the disk's URL for remote disks and the signed route for local disks |
service-chat.attachments.presign_ttl_minutes | integer, 15 | No | No, server | Lifetime of a presigned upload URL / confirm ticket |
service-chat.attachments.middleware | string array, ['api','signed'] | Yes | No, server | Serving route protection; keep signed, never add auth |
The standalone application supplies account bearer middleware and its database identity adapter. Demo login remains local/testing only. An embedding host can replace this middleware/adapter with its own trusted identity integration. Changing the route prefix requires configuring the SDK's broadcast-auth URL.
Attachments on S3#
Attachment storage follows the host's filesystem configuration, so a host whose FILESYSTEM_DISK is already s3 needs no chat-specific storage setting. The package only talks to Laravel's Storage facade and does not require the AWS SDK; the host's s3 disk must have league/flysystem-aws-s3-v3 installed, exactly as any other Laravel S3 disk does.
To use a different disk, or to be explicit:
SERVICE_CHAT_ATTACHMENT_DISK=s3Checklist for direct-to-S3 uploads (upload_mode=auto on an S3 disk, or presigned):
- The bucket is private (no public read policy, no public ACLs).
- The bucket has CORS allowing
PUTfrom each frontend origin, with thecontent-typeheader andETagexposure as needed. - A lifecycle rule expires objects under the
service-chat/prefix; the backend does not ship a purge job for staged or abandoned uploads. - The IAM principal can
PutObject/GetObject/HeadObject/DeleteObjectonly under the chat prefix.
Without the CORS rule uploads still work: the SDK falls back to posting the file through the API, which validates it server-side. Downloads use presigned GET URLs for S3, so <img>/download links keep working without bucket CORS.
download_mode=route forces every download back through the package (useful when the bucket cannot be reached by browsers directly); download_mode=disk forces the storage URL even on a local disk. Presigned GET URLs carry only ResponseContentDisposition, not the package's nosniff/CSP headers.
The corresponding environment variables (all optional, all server-side, none secret — they are storage settings, not credentials):
| Variable | Maps to | Default |
|---|---|---|
SERVICE_CHAT_ATTACHMENT_DISK | attachments.disk | FILESYSTEM_DISK, else local |
SERVICE_CHAT_ATTACHMENT_MAX_KB | attachments.max_kilobytes | 8192 |
SERVICE_CHAT_ATTACHMENT_MAX_PER_MESSAGE | attachments.max_per_message | 5 |
SERVICE_CHAT_ATTACHMENT_URL_TTL | attachments.url_ttl_minutes | 60 |
SERVICE_CHAT_ATTACHMENT_UPLOAD_MODE | attachments.upload_mode | auto |
SERVICE_CHAT_ATTACHMENT_DOWNLOAD_MODE | attachments.download_mode | auto |
SERVICE_CHAT_ATTACHMENT_PRESIGN_TTL | attachments.presign_ttl_minutes | 15 |
S3 credentials themselves are the host's normal Laravel AWS_* variables and stay server-side. Never expose them to a browser; browsers receive only per-file presigned URLs.
Example API / Reverb environment#
| Variable | Type / fallback | Required | Secret | Location / responsibility |
|---|---|---|---|---|
APP_ENV | string | Yes | No | Server; demo authentication only in local/testing |
APP_KEY | Laravel app key | Yes | Yes | Server only; generate locally |
CHAT_AUTH_TOKEN_LIFETIME_MINUTES | integer, 480 | No | No | Normal account bearer-token lifetime in minutes, server only |
CHAT_AUTH_REMEMBER_LIFETIME_MINUTES | integer, 43200 | No | No | Remembered account token lifetime in minutes, server only |
CHAT_AUTH_SOCKET_PRUNE_SECONDS | integer, 5 | No | No | Reverb access-revocation check interval, server only |
BROADCAST_CONNECTION | string | Yes for realtime | No | Server; must be reverb for live events |
CHAT_ALLOWED_ORIGINS | comma-separated full origins; localhost:3000, 127.0.0.1:3000, localhost:5173, localhost:5174 over HTTP | Yes for cross-origin | No | API CORS; include each actual LAN frontend origin |
REVERB_SERVER_HOST | string, 0.0.0.0 | No | No | Reverb listening interface |
REVERB_SERVER_PORT | integer, 8085 | No | No | Reverb listening port |
REVERB_APP_ID | string | Yes | No | Server broadcasting app ID |
REVERB_APP_KEY | string | Yes | No | Public key; same value in browser config |
REVERB_APP_SECRET | string | Yes | Yes | Server only; never an npm/public option |
REVERB_HOST | string, 127.0.0.1 | Yes | No | Server-to-Reverb destination |
REVERB_PORT | integer, 8085 | No | No | Server-to-Reverb port |
REVERB_SCHEME | http/https, http | No | No | Server-to-Reverb transport |
REVERB_ALLOWED_ORIGINS | comma-separated hostnames, localhost,127.0.0.1 | Yes for LAN/browser | No | Reverb browser origins; include LAN hostname/IP |
Restart processes or clear/rebuild cached configuration after server changes. Listening host 0.0.0.0 is not a browser destination. Server destination 127.0.0.1 can remain valid when Reverb shares the server, while remote browsers need the reachable LAN/public hostname.
Shared JavaScript SDK#
new ChatClient(options) takes these options:
| Option | Type | Default / required | Secret / runtime |
|---|---|---|---|
apiBaseUrl | string | Required; full /api/chat root | No; browser/server HTTP client |
authEndpoint | string | Optional; derived /api/broadcasting/auth convention | No; private-channel authorization location |
token | string or callback returning string/Promise | Required | Sensitive user credential; memory only in demos |
reverb | object | Optional; omitted means HTTP without realtime | Public connection settings |
reverb.key | string | Required when Reverb configured | Public app key |
reverb.host | string | Required when Reverb configured | Reachable browser hostname |
reverb.port | number | Required when Reverb configured | Browser port |
reverb.scheme | http or https | Required when Reverb configured | Selects ws/wss transport |
fetch | fetch-compatible function | globalThis.fetch | Optional custom HTTP transport |
Constructing/importing the client does not start a connection. subscribe requires a browser. Own and clean up the client using disconnect().
Next.js public environment options and defaults are documented once in the example README. Vue and widget options are documented in their Vue and HTML integration guides. Public environment changes need a rebuild in compiled applications.
CHAT_DEV_ALLOWED_ORIGINS is a server-only Next.js development option (string, empty default, not secret). It contains comma-separated hostname/IP entries without scheme or port. The example always allows 127.0.0.1; Next allows localhost. The LAN launcher supplies the selected LAN address. This is separate from API CORS and Reverb origin configuration and does not grant chat access.
Next website review build#
| Variable | Type / default | Required | Secret / location | Behavior |
|---|---|---|---|---|
CHAT_NEXT_PREVIEW | string, unset | No | No; build/start process only | Exact 1 selects .next-preview; compact selects .next-compact-preview; other values use normal .next. Set identically for build and start. Not a browser SDK option. |
See local preview setup. Stop the preview before replacing its own build output. Standard release and LAN startup commands retain their existing default.