SHOWCASE - nself-org/nchat GitHub Wiki

ษณChat Feature Showcase

Version: 0.9.2 Purpose: Demonstrate the complete capabilities of ษณSelf CLI through a production-grade reference implementation Live Demos: See this in action at:


๐ŸŽฏ What This Showcases

1. Complete Backend Infrastructure (ษณSelf CLI)

One Command, Everything Running:

cd backend
nself start

What Starts Automatically:

  • โœ… PostgreSQL with 222 tables
  • โœ… Hasura GraphQL API
  • โœ… Nhost Authentication
  • โœ… MinIO S3 Storage
  • โœ… Redis Cache
  • โœ… MeiliSearch
  • โœ… MailPit (dev email)
  • โœ… Nginx with SSL
  • โœ… Admin Dashboard
  • โœ… WebSocket Server
  • โœ… Storage Service

Zero Configuration:

  • ๐Ÿ”’ Automatic SSL certificates (no browser warnings!)
  • ๐ŸŒ Works with *.local.nself.org domains (resolves to 127.0.0.1)
  • ๐Ÿ“Š All services pre-configured and talking to each other
  • ๐Ÿ” JWT auth configured
  • ๐Ÿ“ GraphQL schema generated
  • ๐Ÿ—„๏ธ Database migrations ready

2. Real-Time Features (GraphQL Subscriptions)

Live Demo Scenarios:

Scenario A: Typing Indicators

  1. Login as [email protected] in Browser 1
  2. Login as [email protected] in Browser 2
  3. Start typing in Browser 1 โ†’ See "User is typing..." in Browser 2
  4. Stop typing โ†’ Indicator disappears

Scenario B: Instant Message Delivery

  1. Open same channel in 2 browsers (different users)
  2. Send message in Browser 1 โ†’ Appears instantly in Browser 2
  3. No refresh needed, no polling, true push

Scenario C: Presence Tracking

  1. User comes online โ†’ Green dot appears
  2. User goes offline โ†’ Gray dot
  3. User idle for 5 minutes โ†’ Yellow dot

Technical Implementation:

  • Uses Hasura GraphQL subscriptions over WebSocket
  • Real-time database changes streamed to clients
  • Efficient: Only sends changed data
  • Scalable: Hasura handles connection management

3. Authentication Showcase

11 OAuth Providers Configured:

  • ๐Ÿ”ต Google
  • ๐Ÿ™ GitHub
  • ๐ŸชŸ Microsoft
  • ๐ŸŽ Apple
  • ๐Ÿ“˜ Facebook
  • ๐Ÿฆ Twitter/X
  • ๐Ÿ’ผ LinkedIn
  • ๐ŸŽฎ Discord
  • ๐Ÿ”’ ID.me (military verification)
  • ๐Ÿ“ฑ Twitch
  • ๐ŸŽจ Figma

Email/Password:

  • โœ… Secure bcrypt hashing
  • โœ… Email verification
  • โœ… Password reset flows
  • โœ… Rate limiting

Magic Links:

  • โœ… Passwordless login
  • โœ… Time-limited tokens
  • โœ… One-click authentication

Two-Factor Authentication:

  • โœ… TOTP (Google Authenticator, Authy)
  • โœ… Backup codes
  • โœ… Recovery options

Demo Accounts (Local/Staging Only):

Role hierarchy with descending access levels (1 = highest, 6 = no special role):

# Email Password Role Showcase
1 [email protected] password Owner Top level - Cannot be removed, all access
2 [email protected] password Admin High-level administration
3 [email protected] password Moderator Content moderation
4 [email protected] password Support User support with limited admin
5 [email protected] password Helper Community helper with limited mod
6 [email protected] password (no role) Regular user - No special permissions

4. Per-App RBAC (Monorepo Ready)

What This Means:

  • โœ… Same user can have different roles in different apps
  • โœ… Login once, access multiple apps (SSO)
  • โœ… Granular permissions per application

Example Monorepo Setup:

monorepo/
โ”œโ”€โ”€ backend/           # One shared ษณSelf backend
โ”œโ”€โ”€ nchat/            # This app
โ”œโ”€โ”€ ntv/              # Media streaming app
โ””โ”€โ”€ nfamily/          # Family organizer app

User Experience:

  1. User logs in to ษณChat โ†’ Admin role
  2. User visits ษณTV โ†’ Member role (different!)
  3. User visits ษณFamily โ†’ Owner role (different again!)
  4. No separate logins - SSO across all apps

Showcase Scenario:

# Login as [email protected]
curl -X POST https://auth.local.nself.org/v1/signin/email-password \
  -d '{"email":"[email protected]","password":"password"}'

# Check role in nchat
query {
  app_user_roles(where: {user_id: {_eq: "..."}}) {
    app_id
    role
  }
}

# Returns: [
#   { app_id: "nchat", role: "admin" },
#   { app_id: "ntv", role: "member" }
# ]

5. Feature Parity with Major Platforms

Messaging: โœ… Whatsapp/Telegram Level

  • โœ… Direct messages (1-on-1)
  • โœ… Group channels
  • โœ… Threads (nested conversations)
  • โœ… Message reactions
  • โœ… Pin important messages
  • โœ… Message search
  • โœ… Edit/delete messages
  • โœ… Message history
  • โœ… Unread indicators
  • โœ… @mentions

Collaboration: โœ… Slack/Discord Level

  • โœ… Public channels
  • โœ… Private channels
  • โœ… Channel descriptions
  • โœ… Channel topics
  • โœ… Channel permissions
  • โœ… User roles (owner, admin, mod, member, guest)
  • โœ… File uploads (S3 storage)
  • โœ… Image previews
  • โœ… Link previews
  • โœ… Code snippets

Moderation: โœ… Discord/Telegram Level

  • โœ… Delete messages
  • โœ… Ban users
  • โœ… Timeout users
  • โœ… Warn users
  • โœ… Audit logs
  • โœ… Report system
  • โœ… Auto-moderation (profanity filter)

Advanced: โœ… Enterprise Level

  • โœ… End-to-end encryption (Double Ratchet)
  • โœ… Voice & video calls (WebRTC)
  • โœ… Screen sharing
  • โœ… File sharing with S3
  • โœ… Full-text search (MeiliSearch)
  • โœ… Analytics dashboard
  • โœ… Webhooks
  • โœ… Bot framework
  • โœ… Custom integrations

6. Developer Experience (Dev โ†’ Staging โ†’ Prod)

Local Development:

Domain: chat.local.nself.org
Backend: Runs on Docker (nself start)
Frontend: localhost:3000 (pnpm dev)
Database: PostgreSQL local
Storage: MinIO local
Email: MailPit (all emails captured locally)

Staging (VPS):

Domain: chat.staging.nself.org
Backend: Same nself setup, ENV=staging
Frontend: Next.js on VPS
Database: PostgreSQL on VPS
Storage: MinIO or S3
Email: Real SMTP (SendGrid, AWS SES, etc.)
Protection: HTTP basic auth (team password)

Production (Vercel):

Domain: chat.nself.org
Backend: nself on dedicated server
Frontend: Vercel edge network
Database: PostgreSQL production
Storage: AWS S3 or CloudFlare R2
Email: Production SMTP
SSL: Let's Encrypt via nself
CDN: Vercel + CloudFlare

What Makes This Easy:

  • โœ… Same codebase for all environments
  • โœ… Environment-specific .env files (.env.dev, .env.staging, .env.prod)
  • โœ… One command deploys everything (nself deploy staging)
  • โœ… Automatic SSL in all environments
  • โœ… Zero-downtime deployments
  • โœ… Rollback support

7. White-Label Customization

Setup Wizard (12 Steps):

  1. Welcome
  2. Owner information
  3. Branding (name, logo, colors)
  4. Theme selection (27 presets)
  5. Landing page style
  6. Auth methods (which OAuth providers)
  7. Access permissions (open/invite/domain-restricted)
  8. Features toggle (enable/disable features)
  9. Integrations (Slack, GitHub, etc.)
  10. Legal (terms, privacy policy)
  11. SEO settings
  12. Review and launch

What Can Be Customized:

  • โœ… App name and tagline
  • โœ… Logo and favicon
  • โœ… Color scheme (27 presets + custom)
  • โœ… Light/dark mode
  • โœ… Custom CSS
  • โœ… Domain (your-domain.com)
  • โœ… Email templates
  • โœ… Legal documents
  • โœ… Social media links
  • โœ… Landing page style

Result: Completely branded product in 10 minutes

8. Multi-Platform Deployment

Platforms Supported:

  • โœ… Web (Next.js 15)
  • โœ… iOS (Capacitor)
  • โœ… Android (Capacitor)
  • โœ… Windows Desktop (Electron)
  • โœ… macOS Desktop (Electron)
  • โœ… Linux Desktop (Electron)

One Codebase, Six Platforms:

frontend/
โ”œโ”€โ”€ src/              # Shared code (99%)
โ”œโ”€โ”€ platforms/
โ”‚   โ”œโ”€โ”€ mobile/      # iOS/Android builds
โ”‚   โ””โ”€โ”€ desktop/     # Electron builds

Build Commands:

# Web
pnpm build

# Mobile
cd platforms/mobile
pnpm build:ios
pnpm build:android

# Desktop
cd platforms/desktop
pnpm build:mac
pnpm build:win
pnpm build:linux

๐Ÿงช Testing Scenarios for Demos

Quick Demo (5 minutes)

1. Clone and Start (2 min)

git clone https://github.com/nself-org/nchat.git
cd nself-nchat/backend
nself start
# In new terminal
cd frontend
pnpm install && pnpm dev

2. Login as Demo User (1 min)

3. Show Real-Time (2 min)

  • Open second browser as [email protected]
  • Start typing โ†’ See typing indicator
  • Send message โ†’ Appears instantly

Talking Points:

  • "One command started 11 backend services"
  • "Automatic SSL with zero configuration"
  • "Real-time features work out of the box"
  • "Production-ready infrastructure"

Full Demo (30 minutes)

Part 1: Setup Speed (5 min)

  • Clone repository
  • Run nself start
  • Show Docker containers spinning up
  • Show all service URLs working
  • No configuration needed!

Part 2: Authentication (5 min)

  • Show 6 demo users with different roles
  • Login as owner โ†’ Full access
  • Login as user โ†’ Limited access
  • Show OAuth provider configuration
  • Demonstrate magic links

Part 3: Real-Time Features (5 min)

  • Two browsers side-by-side
  • Typing indicators
  • Instant message delivery
  • Presence updates
  • Reactions

Part 4: Permissions (5 min)

  • Login as regular user โ†’ Try to delete message โ†’ Denied
  • Login as moderator โ†’ Delete any message โ†’ Success
  • Login as admin โ†’ Delete channel โ†’ Success
  • Show per-app RBAC concept

Part 5: Developer Experience (5 min)

  • Show code structure
  • Explain environment flow (dev/staging/prod)
  • Show how easy deployment is
  • Demonstrate white-label customization

Part 6: Production Features (5 min)

  • Show test coverage (98%+)
  • Show build passing (0 errors)
  • Show monitoring (Grafana)
  • Show scalability options

๐Ÿ“Š Key Metrics to Highlight

Setup Time:

  • โฑ๏ธ 5 minutes from clone to running app
  • ๐Ÿ”ง 3 commands total
  • ๐Ÿ“ฆ 11 services started automatically

Feature Completeness:

  • โœ… 98% test coverage
  • โœ… 0 TypeScript errors
  • โœ… 222 database tables
  • โœ… Feature parity with Slack/Discord/Telegram

Production Ready:

  • ๐Ÿ”’ End-to-end encryption
  • ๐Ÿ“Š Monitoring built-in
  • ๐Ÿš€ Scalable architecture
  • ๐Ÿ’พ Automated backups

Developer Experience:

  • ๐ŸŽจ White-label in 10 minutes
  • ๐ŸŒ Deploy to 6 platforms
  • ๐Ÿ”„ Zero-downtime deploys
  • ๐Ÿ“ 100% documented

๐ŸŽค Demo Scripts

For Technical Audience

"Let me show you how fast you can get a production-grade chat app running with ษณSelf CLI."

Clone and start backend

"Notice: One command just started PostgreSQL, Hasura GraphQL, authentication, storage, search, and 6 other services. All pre-configured. Automatic SSL certificates. No YAML files to edit."

Start frontend

"Frontend connects to backend via GraphQL. Real-time subscriptions already working."

Show real-time features

"See the typing indicators? GraphQL subscriptions. Not polling. True push. Same technology Slack and Discord use."

Show authentication

"Six demo users with different permission levels. Owner, admin, moderator, regular member. Try to delete a message as a regular user? Denied. As a moderator? Works. That's row-level security enforced at the database level."

Show deployment options

"Same codebase deploys to web, iOS, Android, Windows, macOS, Linux. From local development to staging to production with environment-specific configs. One backend serves all platforms."

For Business Audience

"This is a complete Slack/Discord competitor that you can white-label and deploy yourself in under 10 minutes."

Show features

"Everything you expect: Direct messages, channels, file sharing, search, voice/video calls. Plus end-to-end encryption, which even Slack doesn't have."

Show customization

"Want it to look like your brand? Change the logo, colors, domain. Setup wizard walks you through it. Ten minutes total."

Show deployment options

"Deploy on your infrastructure - your VPS, your AWS account, or even your laptop. Or use Vercel for the frontend. Your data stays where you want it."

Show cost comparison

"Slack charges $7-12 per user per month. This? The software is free. You only pay for hosting - maybe $50-100/month total for unlimited users."


๐ŸŽ What They Get

When someone clones nself-chat, they get:

Immediate:

  • โœ… Working chat application
  • โœ… 6 demo users to test with
  • โœ… Real-time features
  • โœ… All 11 backend services
  • โœ… Automatic SSL

Customizable:

  • โœ… White-label setup wizard
  • โœ… 27 theme presets
  • โœ… Enable/disable features
  • โœ… Configure OAuth providers
  • โœ… Modify everything

Production:

  • โœ… End-to-end encryption
  • โœ… Voice/video calls
  • โœ… File storage (S3)
  • โœ… Full-text search
  • โœ… Monitoring
  • โœ… Backups

Deployment:

  • โœ… Web (Next.js)
  • โœ… iOS (Capacitor)
  • โœ… Android (Capacitor)
  • โœ… Desktop (Electron)
  • โœ… All from one codebase

Support:

  • โœ… Complete documentation
  • โœ… Code examples
  • โœ… Test suite (98% coverage)
  • โœ… GitHub community

๐Ÿ”— Links


Questions? Open an issue or join our Discord!