One-liner:
White‑label multi‑tenant chat hub that connects LINE & Discord messages into a unified Phoenix LiveView chatroom, with Slack‑style subdomain branding.
Primary Goal:
Allow companies to apply for an account, invite team members, connect LINE and Discord channels, and sync messages in real time.
-
Multi‑tenant Company Accounts
- Slack‑style subdomain:
company.relay.chat - Branding: logo, primary color, accent color
- Slack‑style subdomain:
-
Auth & Roles
- Pow authentication
- Roles: Owner, Admin, Member
- RBAC via Bodyguard
-
SNS Connectors
- LINE Bot: shared bot model, QR invite, webhook integration
- Discord Bot: shared bot, OAuth2 invite link, channel selection, gateway listener
-
LiveView Chatroom
- Real-time message display & input
- Connector‑aware message styling (LINE green, Discord purple, internal = company theme)
- File/image upload (optional for MVP)
-
Isolation & Security
company_idscoping for all queries- Per‑role permissions for actions
- Backend: Elixir 1.18.x, Phoenix LiveView 1.1.3
- Database: PostgreSQL
- Auth: Pow 1.0.39
- RBAC: Bodyguard 2.4.3
- Deployment: Fly.io with Managed Postgres
- Integrations:
- LINE Messaging API (Webhook + Push API)
- Discord API (Gateway + REST)
Flow: [LINE User] → LINE Webhook → Relay → LiveView Chatroom [Discord User] → Discord Gateway Event → Relay → LiveView Chatroom [Relay Chatroom] → Send Message → LINE Push API & Discord Channel POST Tenant Isolation:
*.relay.chatwildcard DNS → Tenant loader plug →@current_company- All queries filtered by
company_id
- id (PK)
- name
- subdomain
- logo_url
- primary_color
- accent_color
- inserted_at, updated_at
- id (PK)
- password_hash (Pow)
- role (enum: owner, admin, member)
- company_id (FK)
- inserted_at, updated_at
- id (PK)
- company_id (FK)
- type (enum: line, discord)
- config (JSONB: tokens, webhook tokens, channel IDs)
- inserted_at, updated_at
- id (PK)
- company_id (FK)
- sns_source (enum: line, discord, internal)
- sender_name
- sender_role
- content
- attachments (JSONB)
- inserted_at
| Role | Permissions |
|---|---|
| Owner | All actions, billing, delete company |
| Admin | Manage SNS connectors, invite/remove members, moderate messages |
| Member | Send/receive messages only |
Layout:
- Left Sidebar: Logo, company name, connectors list, channels list, settings link
- Center: Chat area with message list & input bar
- Right Panel: Optional (member list, SNS info)
Branding:
- Theme colors & logo pulled from
@current_company - Connector‑aware message bubbles
- Pow auth with roles
- Companies table + subdomain routing + Tenant Loader Plug
- Bodyguard RBAC skeleton
- Branding controls
- SNS connections list
- Shared bot QR invite
- Webhook handler → messages table
- Push API for outbound
- OAuth2 invite link
- Channel selection UI
- Gateway listener
- Real‑time message display
- Input bar → relay to connectors
- Styling per connector
- Enforce
company_idscoping - Role checks in LiveView & controllers
- Slack/Teams/WhatsApp connectors
- AI assistant for message summarization
- Advanced file sharing & search
- Per‑company billing with Stripe