Full Stack Go Web Application with Live Streaming & AI
π Quick Start β’ β¨ Features β’ ποΈ Architecture β’ π Structure β’ π οΈ Tech Stack β’ π API β’ π§ Setup β’ π³ Deploy
|
π³ Docker (Recommended) docker compose up |
πΉ Go Native go run . |
π§ Development Setup
git clone https://github.com/mattmajestic/majesticcoding.com.git
cd majesticcoding.com && go mod tidy && go run .β‘οΈ Open: http://localhost:8080
|
π₯ Live Streaming AWS IVS β’ RTMP β’ HLS WebSocket Chat β’ Analytics |
π€ AI Integration Claude β’ GPT β’ Gemini β’ Groq RAG β’ Vector Embeddings |
π Social Analytics GitHub β’ YouTube β’ Twitch LeetCode β’ Real-time Stats |
|
π Authentication Supabase β’ JWT β’ Session Cache OAuth β’ Security |
π Geographic Check-ins β’ 3D Globe Geocoding β’ Locations |
π‘ API Services REST β’ GraphQL β’ WebSocket Swagger β’ Bronze Schema |
MVC Pattern β’ Microservice Ready β’ Event-Driven β’ Cloud-Native
Frontend β Gin API β Services β PostgreSQL + Vector DB
β β β
WebSocket REST External APIs
π¦ Click to expand full structure
majesticcoding.com/
βββ π¦ api/ # Backend API Layer
β βββ handlers/ # HTTP controllers
β βββ services/ # Business logic + integrations
β βββ models/ # Data structures
β βββ middleware/ # Auth, CORS, etc.
βββ π¦ db/ # Database Layer
β βββ *.go # Queries, connections, schemas
β βββ migrations/ # Schema changes
βββ π¦ static/ # Frontend Assets
β βββ components/ # JS modules
β βββ styles/ # Tailwind CSS
β βββ img/ # Static assets
βββ π¦ templates/ # HTML Templates
βββ π main.go # Entry point
βββ π docker-compose.yml # Container orchestration
βββ π k8s-go.yaml # Kubernetes deploymentπ’ API Layer: REST handlers + business services ποΈ Database: PostgreSQL + Vector embeddings + Session cache π¨ Frontend: Vanilla JS + Tailwind + Go templates βοΈ Infrastructure: Docker + Kubernetes ready
Go 1.23+ |
PostgreSQL |
Docker |
JavaScript |
- Backend: Go + Gin + PostgreSQL/Neon + Swagger
- Frontend: Vanilla JS + Tailwind + WebSockets
- AI: Claude + GPT + Gemini + Groq + RAG
- Cloud: AWS IVS + Supabase + Docker + K8s
| Category | Endpoint | Description |
|---|---|---|
| π Auth | POST /api/user/sync |
Sync user data |
| π₯ Stream | GET /api/stream/status |
Live stream status |
| π€ AI | POST /api/llm/ |
Chat with AI |
| π Stats | GET /api/stats/{platform} |
Social media analytics |
| π¬ Chat | GET /ws/chat |
WebSocket connection |
π Full Documentation: http://localhost:8080/docs
π Environment Variables (Click to expand)
# Database
DATABASE_URL=postgresql://user:password@host:5432/database
# Authentication
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
# AI Providers
ANTHROPIC_API_KEY=your-key
OPENAI_API_KEY=your-key
GEMINI_API_KEY=your-key
# Social APIs
GITHUB_TOKEN=your-token
YOUTUBE_API_KEY=your-key
TWITCH_CLIENT_ID=your-id
# AWS IVS
AWS_IVS_CHANNEL_ARN=your-arn|
π§ Development go run .
# or
docker compose up |
β‘ Database: Enable pgvector extension in Neon β’ Migrations run automatically
graph TD
A["Browser / Client"] -->|HTTP / WS| B["Gin Router"]
subgraph "Gin App"
direction TB
B --> C["Templates (Partials)"]
B --> D["WebSocket Hub"]
B --> E["Swagger Docs"]
B --> F["3rd-Party API Stats"]
B --> G["Stream Status"]
end
F --> H["YouTube / GitHub / Twitch / LeetCode"]
G --> I["AWS IVS RTMP"]
C --> A
D --> A
E --> A
sequenceDiagram
autonumber
participant U as "User"
participant H as "Gin Handler (/live)"
participant T as "Templates (base + partials)"
participant P as "Live Page"
participant API as "Go API"
participant SV as "IVS / DB"
U->>H: GET /live
H->>T: Render base with stream/chat/footer
T-->>P: HTML
P->>API: fetch "/api/stream/status"
API->>SV: Query
SV-->>API: Status + URL
API-->>P: JSON { live, playbackUrl }
P->>P: Update #stream and chat
sequenceDiagram
autonumber
participant OBS as OBS Encoder
participant IVS as AWS IVS (RTMP + Playback)
participant API as Go Backend API
participant JS as Live Stream Page (JS)
Note over OBS,IVS: Setup: OBS has IVS ingest endpoint + stream key
OBS->>IVS: RTMPS connect (ingest_endpoint + stream_key)
IVS-->>OBS: Accepts stream begins ingest
IVS-->>IVS: Publishes HLS/DASH playback (playback_url)
Note over JS,API: Frontend checks live status (polling)
JS->>API: GET /api/stream/status Check
API->>IVS: GetStream(AWS_IVS playback URL)
IVS-->>API: isLive = true/false, playback_url
API-->>JS: { live, playbackUrl }
alt Stream is LIVE
JS->>JS: Swap UI to "LIVE", show player
JS->>IVS: Player loads playback_url (HLS)
else Stream is OFFLINE
JS->>JS: Show "Offline" UI, hide/disable player
end
- Fork β Clone β Code β PR
- π License: MIT
- π Thanks: Go Team, Gin, Neon, Supabase
β Star this repo β’ π Report issues β’ π‘ Suggest features