Building math_class: A Self-Hostable, Offline-Ready Browser Game Hub in React

●1 ●3 ●12
calendar_today ago • schedule2 min read

If you have ever wanted to run a fast, self-hostable browser game portal—complete with offline caching, local play-time analytics, and shared-computer privacy controls—check out math_class (math_games v1.3.1).

Built with React, TypeScript, Tailwind CSS, esbuild, Vercel serverless functions, and a Cloudflare Worker, it bundles 637+ games (650+ listed in the repo summary) into a unified, static-first hub you can deploy anywhere or run locally in minutes.

Why math_class Stands Out

Most browser game sites are bloated, ad-heavy, or impossible to customize. math_class takes a different approach:

Zero User Accounts Required: Preferences, favorites, play statistics, and offline schedules all live locally in localStorage.

Built for Shared Computers: Includes a Tab Cloak (disguise the tab as Classroom or Docs), a one-key Panic Button, and a Site Lock password gate on refresh.

Offline-First PWA Support: Powered by service workers (sw.js, notification-sw.js) and generated offline manifests (offline-manifest.json, offline-packs.json), users can cache the hub and games for scheduled offline play.

Self-Host & Fork Friendly: MIT-licensed and designed to deploy cleanly to Vercel, Cloudflare Workers, or any static host.

Key Features Under the Hood

Feature

How It Works

Unified Game Catalog

Combines self-hosted HTML games (games/), externally hosted titles, and archived PolyTrack builds (0.5.0/ active, 0.3.1/ historical) via catalog.json and games/config.json.

Discovery & Layouts

Search, sort, and filter by status (Editor's Pick, Verified, Trending, Flash, Error:bug, Blocked), with classic row-card or cover-mosaic views.

In-Hub Launcher

Same-origin games open inside an in-page launcher with reload, favorite, panic, and auto-filled bug-report controls (or launch in a new tab).

Per-Device Play Stats

Tracks real elapsed time (automatically pausing when a tab sleeps or freezes), sessions, clicks, and most-played games—with an Always count toggle and hard reset.

Custom Appearance

Switch between halftone shaders, solid colors, or gradient backgrounds, and toggle the loading animation, side chat, visitor counter, footer, and optional ad space.

Moderation & Mirrors

Includes live reachability checks for mirrors/proxies, a standalone game submission form (submit/), and a password-protected admin panel backed by api/ and cf/.

Architecture & Tech Stack

Frontend (src/): React + TypeScript compiled with esbuild (scripts/build-client.mjs) into dist/home.bundle.js, styled with Tailwind CSS (dist/styles.css).

Serverless & Edge (api/, cf/): Vercel serverless functions handle admin actions, search, flags, and submissions, while a Cloudflare Worker powers proxy shortcuts, visitor/click analytics, and hub API routes.

Analytics: Optional build-time PostHog (posthog-js) integration via PUBLIC_POSTHOG_KEY and PUBLIC_POSTHOG_HOST.

License: MIT License.

Run It Locally

You only need Node.js 18+ and npm:

git clone https://github.com/NOTAM-bobk/math_class.git
cd math_class
npm install
npm run build

Then serve the repository root with any static file server:

npx serve .

or

python3 -m http.server

Deploying Your Own Instance

If you deploy the backend (api/ on Vercel and cf/ on Cloudflare Workers), set matching ADMIN_PASSWORD (or ADMIN_SECRET / VERCEL_ADMIN_PASSWORD) and HUB_INTERNAL_KEY environment variables across both deployments.

Try It Live & Contribute

Primary Site: poly2.benlaunches.icu

GitHub Repository: github.com/NOTAM-bobk/math_class

If you build a custom fork, add new games to games/config.json, or experiment with the offline service-worker packs, drop your feedback or questions in the comments!

Want more #games & #unblocked deep dives?

Join 5,978+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

1 Comment

0 votes

More Posts

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

Local-First: The Browser as the Vault

Pocket Portfolio - Apr 20

React Native Quote Audit - USA

kajolshah - Mar 2

How to Make a Browser Trivia Game Work Offline with Service Workers

seven - Nov 17

Cache-Control Headers for Web Performance: CDN and Browser Caching That Sticks

ApogeeWatcherverified - Sep 17
chevron_left
926 Points • 16 Badges
United States • Hiresawyer.base31.org
4Posts
2Comments
14Connections
Founder and owner of base31.org

Related Jobs

View all jobs →

Commenters (This Week)

15 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!