Skip to content

Latest commit

Β 

History

1,134 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 Real-Time Forum

Go Version JavaScript Runtime Linter CI


Problem: Traditional forums rely on page refreshes or periodic polling for updates, causing latency in live chat, presence status, and typing indicators.

Solution: A split-server Go and Vanilla JS Single-Page Application (SPA) driven by Gorilla WebSockets, handling typing indicators and presence channels concurrently via Go select-loops.


A powerhouse, production-grade Real-Time Single-Page Application (SPA). Built with a high-performance Go backend and a cutting-edge Vanilla JavaScript (ES2026+) frontend. Experience seamless navigation, lightning-fast interactions, and live private messagingβ€”all delivered through a single HTML document.


🚦 Project Status

The project is currently in Active Development (Wave 3).

  • Foundations (Wave 1): βœ… Complete
  • Auth & Core Forum (Wave 2): βœ… Complete
  • Real-Time Chat (Wave 3): πŸ—οΈ In Progress (Proxy ready, Backend started)
  • Bonus Features: βœ… User Profiles (A07) implemented ahead of schedule.

Check the Ticket Tracker for detailed progress.


✨ Key Features

πŸ” Secure Authentication

  • Universal Login: Access via Nickname or Email with a secure password.
  • Extended Profiles: Rich registration capturing age, gender, and full name.
  • Session Integrity: Hardened HttpOnly session cookiesβ€”no fragile JWTs.
  • Global Auth Shell: Persistent login/logout controls reachable from every corner of the app.
  • Zero Guest Access: A private, authenticated-only community experience.

πŸ“œ Dynamic Content

  • Fluid Feed: Paginated post exploration with category tagging and rich media.
  • Deep Conversations: Detail-focused comment threads load on-demand, keeping the feed lean.
  • Draft Mastery: Save your thoughts and polish your posts before they go live.
  • Rich Media: Dedicated image upload support for both posts and comments.

πŸ’¬ Real-Time Private Messaging

  • Dynamic Roster: A persistent chat sidebar with live presence indicators.
  • Intelligent Sorting: Users are ordered by latest activity or alphabetically for new connections.
  • Elastic History: Infinite-scroll chat history loading (10-message batches) with smart throttling.
  • Live Delivery: Instant message arrival via WebSocketsβ€”no refresh, no delay.
  • Bonus Capabilities: Send images in DMs and view full user profiles.

πŸ› οΈ Technical Excellence

Backend Stack

  • Engine: Go 1.24+ (Standard Library focus)
  • Database: SQLite (ACID compliant persistence)
  • Real-Time: gorilla/websocket for low-latency events
  • Security: bcrypt hashing & google/uuid session tracking
  • Concurrency: Advanced Goroutine/Channel patterns for maximum throughput

Frontend Stack

  • Logic: Vanilla JS (ES2026+) β€” zero frameworks (React/Vue/Angular)
  • Tooling: Bun for speed, Biome for precision, Vitest for testing
  • Design: Modern Clean Vertical Slices / Screaming Architecture
  • Performance: Promise-based async operations and Proxy-driven state

πŸ—οΈ Architecture

graph TD
    Browser[Browser: Vanilla JS SPA] <-->|HTTP / WebSockets| Frontend[Frontend Proxy :3000]
    Frontend <-->|Proxy API & WS| Backend[Go API Backend :8080]
    Backend <-->|SQL / Transactions| SQLite[(SQLite Database)]
Loading
  • cmd/ β€” Server entry points (Backend: :8080, Frontend: :3000)
  • SPA/ β€” The Frontend Core: Domain-driven vertical slices (Auth, Feed, Post, Activity, Profile, Shell, Chat)
  • internal/ β€” Decoupled business logic, persistence layers, and HTTP handlers
  • web/ β€” Static frontend assets and browser startup validation wrappers
  • data/ β€” SQLite transactional storage files
  • docs/ β€” System Design, Product Requirements, and verification audit trails

Note

The project utilizes a Split-Server Topology. The Frontend server (:3000) serves the SPA shell and proxies all /api/ and /ws traffic to the Backend server (:8080).


πŸš€ Quick Start

πŸ“‹ Prerequisites

  • Go 1.24+
  • Bun (Runtime & Package Manager)
  • Make
  • SQLite

⚑ Run the Stack

# 1. Install all dependencies
make deps

# 2. Launch both servers (Backend & Frontend)
make run

# 3. Verify Infrastructure (Sanity Checks)
make verify-infra

πŸ”— Access the Forum: http://localhost:3000

πŸ§ͺ Quality Control

make test          # Run the full suite (Go + Vitest + Playwright)
make test-e2e      # Run only Playwright E2E tests
make lint          # Execute Biome static analysis
make format        # Standardize code formatting (Backend + Frontend)
make format-frontend # Fix Biome static analysis issues

Run E2E through make, not Playwright directly. make test / make test-e2e are the supported local entry points: they free ports 3000 (frontend) and 8080 (backend) and start a fresh server. The Playwright config sets reuseExistingServer: false, so invoking bun x playwright test by hand while a dev server is already running fails with a port-in-use error instead of silently reusing the existing (possibly stale) instance. Stop your dev servers β€” or just use make test-e2e, which handles cleanup for you.

πŸ§ͺ Testing Tiers

The project follows a rigorous three-tier validation strategy:

Tier Purpose Tools
Unit Isolated component & helper logic Vitest (JSDOM/Node)
Integration Feature interactions & API contracts Go httptest + Vitest
E2E Full multi-step user journeys Playwright (Headless Chrome)

Note: Playwright browsers are automatically installed during make deps. If you encounter issues, run bun x playwright install chromium.

🌱 Database Seeding

Use the QA seed runner when you want a deterministic local dataset.

make seed-qa

By default this seeds:

./data/forum.db

You can also target a different SQLite file:

go run ./cmd/qa-seed --db-path /tmp/forum-seed-check.db

Important notes:

  • The seed runner resets QA-owned tables and recreates the same users, posts, comments, reactions, and notifications each time.
  • Bootstrap categories are not treated as QA sample data and are preserved separately.
  • Do not reseed a database that is actively being used by a running backend process.

πŸ§ͺ Test Credentials

For quick testing and QA, the following user is available in the default seed data:

Role Nickname / Email Password
Test User tester / tester@example.com password

πŸ“‚ Documentation

Deep dive into the project's blueprints:

  • πŸ“– docs/requirements.md: The basic requirements document, source of truth for what the project should do.
  • πŸ“ docs/SDS.md: Detailed technical specifications.
  • πŸ“‹ docs/audit.md: Success criteria and verification gate source of truth.
  • πŸ€– AGENTS.md: Essential guide for AI coding assistants.
  • πŸ—οΈ architecture.md: High-level structural overview.

πŸ›°οΈ API at a Glance

Method Endpoint Description
POST /api/v1/users/login Authenticate and start session
POST /api/v1/users/register Create account with profile data
GET /api/v1/users/me Bootstrap session verification
GET /api/v1/posts Fetch the paginated global feed
GET /api/v1/chats Retrieve roster with presence state
GET /ws WebSocket for live chat & events

Related


Built with ❀️ by the Real-Time Forum Team. Licensed under GPL-3.0.

About

Self-hosted real-time forum SPA. Go backend + Vanilla JS frontend, WebSocket presence/typing, SQLite, 1125 commits.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages