Skip to content

mattmajestic/majesticcoding.com

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Majestic Coding

Full Stack Go Web Application with Live Streaming & AI

Go Gin PostgreSQL Docker AWS AI


πŸ“‹ Contents

πŸš€ Quick Start β€’ ✨ Features β€’ πŸ—οΈ Architecture β€’ πŸ“ Structure β€’ πŸ› οΈ Tech Stack β€’ 🌐 API β€’ πŸ”§ Setup β€’ 🐳 Deploy

πŸš€ Quick Start

🐳 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

✨ Features

πŸŽ₯ 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

🎡 Spotify Integration β€’ πŸ”§ Content Moderation β€’ πŸš€ Real-time Everything

πŸ—οΈ Architecture

MVC Pattern β€’ Microservice Ready β€’ Event-Driven β€’ Cloud-Native

Frontend ↔ Gin API ↔ Services ↔ PostgreSQL + Vector DB
    ↕         ↕         ↕
WebSocket   REST    External APIs

πŸ“ Directory Structure

πŸ“¦ 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

πŸ› οΈ Tech Stack


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

🌐 API Endpoints

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 Setup

πŸ”‘ 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

🐳 Deployment

πŸ”§ Development

go run .
# or
docker compose up

⚑ Database: Enable pgvector extension in Neon β€’ Migrations run automatically

πŸ“Š Architecture Diagrams

Gin API with Swagger Architecture Diagram

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

Loading

UI Architecture Diagram

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
Loading

Live Stream Architecture Diagram

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
Loading

🀝 Contributing

  • Fork β†’ Clone β†’ Code β†’ PR
  • πŸ“ License: MIT
  • πŸ™ Thanks: Go Team, Gin, Neon, Supabase

⭐ Star this repo β€’ πŸ› Report issues β€’ πŸ’‘ Suggest features

🌐 Website

About

Majestic Coding LLC Website in Go 🐹

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •