Kanya Ratanak Sros
Chat Rage

Chat Rage

Chat Rage is a cloud-based live chat platform built with Elixir and Phoenix, distributed as an Elixir Release for production-ready deployment with WebSocket support.

1. Core Characteristics

  • Application Name: ChatApi (v0.1.0)
  • Release Name: dk168
  • Project Type: Real-time Communication Platform
  • Server Role: Backend API server with WebSocket support for live messaging
  • Environment: Production-ready deployment

2. Folder Structure

Chat Rage/
├── bin/
│   └── dk168                          # Main Elixir Release Executable
├── erts-13.2.2.5/                     # Erlang Runtime System
│   └── bin/                           # BEAM VM & tools
│       ├── beam.smp (Parallel VM)
│       ├── erl, erlc (Compiler)
│       ├── epmd (Node Discovery)
│       ├── run_erl, to_erl (Console)
│       └── [13 executable tools]
├── lib/                               # Compiled Libraries & Dependencies
│   ├── chat_api-0.1.0/                # Main Application (Compiled)
│   │   └── ebin/
│   │       ├── Elixir.ChatApi.* (Core Modules)
│   │       ├── Elixir.ChatApiWeb.* (Web Controllers & Views)
│   │       └── [13 sample compiled beams]
│   ├── [55+ Dependency Libraries]
│   │   ├── appsignal_phoenix-2.0.7    # APM Monitoring
│   │   ├── phoenix                    # Web Framework
│   │   ├── postgrex-0.15.5            # PostgreSQL Driver
│   │   ├── redix-0.10.7               # Redis Client
│   │   ├── phoenix_pubsub_redis       # Pub/Sub Messaging
│   │   ├── joken-2.3.0                # JWT Tokens
│   │   ├── cowboy-2.8.0               # HTTP Server
│   │   ├── ex_aws_s3-2.0.2            # AWS S3 Storage
│   │   ├── ex_aws_ses-2.1.1           # AWS SES Email
│   │   ├── oban-2.1.0                 # Job Queue
│   │   ├── sentry-8.0.0               # Error Tracking
│   │   └── [40+ additional libraries]
│   └── elixir-1.17.3/ & runtime libraries
├── tmp/                               # Runtime Temporary Directory
│   ├── log/
│   │   └── erlang.log.1               # Erlang System Logs
│   └── pipe/                          # Named Pipes / IPC
├── .env.prod.livechat                 # Production Environment Config
├── createdb.sh                        # Database Initialization Script
├── migrate.sh                         # Database Migration Runner
├── seed.sh                            # Database Seeding Script
└── rollback.sh                        # Migration Rollback Script

3. System Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        CLIENT LAYER                             │
│   (Web Browser / Mobile / Widget / Third-party Integration)     │
└────────────────────────────────────┬────────────────────────────┘
                                     │
                        ┌────────────┴────────────┐
                        │   HTTPS / WebSocket     │
                        └────────────┬────────────┘
                                     │
┌────────────────────────────────────▼──────────────────────────────┐
│                 ELIXIR / PHOENIX WEB SERVER                       │
│                      (dk168 Application)                          │
├───────────────────────────────────────────────────────────────────┤
│  • HTTP/WebSocket (Port 4012)  [Cowboy 2.8.0]                     │
│  • Request Routing & Controllers                                  │
│  • Session Management [Pow 1.0.20]                                │
│  • Authentication & Authorization                                 │
│  • Real-time Features (LiveView)                                  │
│  • Pub/Sub via Redis [phoenix_pubsub_redis 3.0.0]                 │
└────────┬─────────────────────┬──────────────────┬─────────────────┘
         │                     │                  │
    ┌────▼────┐          ┌─────▼──────┐    ┌─────▼──────┐
    │         │          │            │    │            │
┌───▼──┐   ┌──▼───┐   ┌──▼──────┐  ┌─▼────▼──┐ ┌──────▼─┐
│      │   │      │   │         │  │         │ │        │
│  DB  │   │Redis │   │ AWS S3  │  │ AWS SES │ │ Sentry │
│  PG  │   │PubSub│   │ Storage │  │ / Email │ │ / APM  │
│      │   │      │   │ Service │  │ Service │ │        │
└──────┘   └──────┘   └─────────┘  └─────────┘ └────────┘
   │
   └─ PostgreSQL Connection
      (DATABASE_URL: livechat_kanyaars_prod)

Key architecture components:

  • Cowboy Server handles HTTP and WebSocket connections.
  • Phoenix Framework provides MVC structure and real-time engine.
  • Ecto / PostgreSQL provides persistence and query abstraction.
  • Redis supports session storage, Pub/Sub, and caching.
  • AWS Services handle file storage and email delivery.
  • Oban executes background job processing.
  • Joken / JWT enables token-based authentication.
  • AppSignal provides APM and performance monitoring.

4. Tech Stack Summary

  • Backend: Elixir 1.17.3 + Phoenix
  • Database: PostgreSQL 12+ (Ecto ORM)
  • Caching / Messaging: Redis
  • Server: Cowboy (WebSocket support)
  • Auth: JWT + Pow
  • Storage: AWS S3
  • Email: AWS SES + Customer.io
  • Jobs: Oban
  • Monitoring: Sentry + AppSignal
  • Cloud: AWS ecosystem
  • Integrations: GitHub, Slack, Expo

5. Tech Stack Detail

A. Core Runtime & VM

ComponentVersionPurpose
Erlang13.2.2.5Virtual machine (BEAM)
Elixir1.17.3Functional programming language
OTP26.xDistributed system support

B. Web Framework & HTTP

TechnologyVersionPurpose
PhoenixLatestWeb framework and real-time features
Cowboy2.8.0HTTP and WebSocket server
Plug1.11.1Middleware pipeline
Plug Cowboy2.4.1Phoenix adapter

C. Database & Persistence

TechnologyVersionPurpose
PostgreSQL (Postgrex)0.15.5Primary database
Ecto4.1.0ORM and query builder
DB Connection2.2.2Connection pooling (Pool: 10)
Migration ManagerBuilt-inSchema versioning

D. Real-Time & Messaging

TechnologyVersionPurpose
Phoenix PubSub Redis3.0.0Distributed messaging
Redix0.10.7Redis client
RedisExternalSession and broker

E. Authentication & Authorization

TechnologyVersionPurpose
Pow1.0.20Authentication system
Joken2.3.0JWT handling
Jose1.11.1Cryptography
SSL Verify Fun1.1.6SSL validation

F. Cloud & External Services

TechnologyVersionPurpose
AWS SDK (Ex AWS)2.1.6AWS integration
AWS S32.0.2File storage
AWS SES2.1.1Email service
Tesla1.4.0HTTP client
HTTPoison1.8.0Alternative HTTP client

G. Background Processing

TechnologyVersionPurpose
Oban2.1.0Job queue
Telemetry0.5.0Metrics
Telemetry Poller0.5.1Monitoring

H. Monitoring & Error Tracking

TechnologyVersionPurpose
Sentry8.0.0Error tracking
AppSignal Phoenix2.0.7APM
AppSignal Plug2.0.8Request tracking

I. Data Formats & Parsing

TechnologyVersionPurpose
Jason1.4.4JSON
Floki0.30.0HTML parsing
Sweet XML0.7.1XML parsing
MIME1.5.0Content types

J. Utilities & Helpers

TechnologyVersionPurpose
Gettext0.18.0Internationalization
Decimal1.9.0Precision math
EEx1.17.3Template engine
Paginator1.0.4Pagination
Scrivener2.7.0Pagination
Mail0.2.2Email builder
Decorator1.4.0Pattern support

K. Third-Party Integrations

TechnologyVersionPurpose
Expo Server SDK0.2.0Push notifications
Customer.io0.2.2Customer engagement
GitHub APIBuilt-inIssue tracking
Slack APIBuilt-inNotifications

L. Compilation & Tooling

ComponentVersionPurpose
Elixir Compiler8.2.6.3Compilation
Syntax Tools3.0.1AST
EEx1.17.3Templates

M. Runtime Support Libraries

TechnologyVersionPurpose
SSL/TLS10.9.1.3Secure communication
Public Key1.13.3.2Cryptography
SASL4.2Monitoring
Runtime Tools1.19Debugging
Timezone Data1.0.5Timezones

N. Infrastructure

ComponentValuePurpose
Release Node Namedk168_livechatNode ID
Distribution TypesnameShort-name distribution
Port4012HTTP/WebSocket
DB Pool Size10Connections
EnvironmentProductionlivechat.kanyaars.cloud