HUT RI Microsite — Architecture Reference
A quick reference for the architecture behind the HUT RI (Indonesia’s Independence Day) live event microsite. Live at kemerdekaan.liputan6.com.
Stack
| Layer | Choice |
|---|---|
| Backend | Laravel |
| Frontend | Inertia.js + React 19 + TypeScript |
| Styling | Tailwind v4 + shadcn/Radix |
| Realtime | Laravel Echo + Pusher-compatible websockets, Redis for aggregation |
| Admin | Plain Blade (not Inertia) |
Pages
- Home — sections for mini games, live match, latest news
/berita— latest news/galeri— gallery/video— video/livematch— live match widget (real-time team reactions)/widget— embeddable overlay widget/games/{game}— mini games (balapkarung,panjatpinang,tariktambang)
Gating Mini Games Properly
Game index.html files live in resources/games/<slug>/, not public/, and are only served through GameController::show() which checks a GamesSwitch toggle first. Static assets (public/game-assets/<slug>/) stay unguarded — harmless if downloaded while games are closed, unlike the playable game itself.
public function show(string $game): Response
{
abort_unless($this->games->isOpen(), 404);
$path = resource_path("games/{$game}/index.html");
abort_unless(is_file($path), 404);
// ...
}
Lesson: a feature switch only really closes access if the gated thing isn’t independently reachable as a static file.
Asset URL Helper (CDN Switch)
Mirrors Laravel’s asset() on the frontend. __ASSET_URL__ is injected by Vite from an env var; empty locally, CDN origin in production.
const ASSET_ORIGIN = (__ASSET_URL__ || BASE_PATH).replace(/\/+$/, "");
export const assetUrl = (path = ""): string =>
`${ASSET_ORIGIN}/${String(path).replace(/^\/+/, "")}`;
All image references in React go through assetUrl() — CDN switch is a one env var, not a find-and-replace.
Reaction Aggregation (Redis) — Don’t Broadcast Per Click
Reactions increment a Redis hash instead of broadcasting immediately:
Redis::pipeline(function ($pipe) use ($key, $room, $team, $reaction) {
$pipe->hincrby($key, "{$team}:{$reaction}", 1);
$pipe->sadd(self::REACTION_ROOMS_KEY, $room);
$pipe->expire($key, self::REACTION_TTL_SECONDS);
});
A ticker drains counters per active room on an interval and broadcasts one batched frame, only if non-empty:
foreach (Redis::smembers(self::REACTION_ROOMS_KEY) as $room) {
$frame = $this->drainReactions($room);
if ($frame === []) continue;
ReactionBatchSent::dispatch($room, $frame);
}
Broadcast volume is bounded by tick rate, not by viewer click rate.
Chat Moderation — Composable Validation Rules
Each concern is its own Laravel validation rule, applied independently to username and message:
NoBadWordsNoJudol— blocks online-gambling spamNoPolitics
'message' => [
'required', 'string', 'min:1', 'max:200',
new NoBadWords($this->filter),
new NoJudol($this->filter),
new NoPolitics($this->filter),
],
Bot personas (CMS-toggleable) keep the chat room feeling alive before real traffic ramps up.
Why the CMS Is Plain Blade, Not Inertia
- The React bundle ships to the audience — no reason to grow it for pages only a few committee members open.
- CMS keeps working to fix/toggle things even if the audience-facing frontend build is broken.
- No registration/password-reset routes — admin account created via a
seed_admin_usermigration.
Admin Safety Guards
- Leaderboard reset requires typing a confirmation phrase exactly (checked server-side in
LeaderboardCmsController::reset()), not a browserconfirm(). - Login throttled per IP at the route level (
throttle:20,1) plus a tighter per-email+IP limit inside the controller.
Checklist When Extending
- New realtime feature? Aggregate-then-flush by default, don’t broadcast per event.
- New static/gated content? Check it isn’t independently reachable outside the gate.
- New CMS page? Keep it Blade, keep it independent of the audience frontend build.