Catalog npm
PACKAGE EXPLORERView in registry

404game

npm

Turn boring 404 pages into playable mini-games. Drop-in JS library with snake, flappy, breakout, and dino runner. Zero dependencies.

404breakoutbrowser-gamecanvasdinoeaster-eggembedflappygamelibrarymini-gamesnaketypescriptzero-dependencies
Versions collected1
Direct dependencies2From release 0.1.0
Last observed20 Oct, 19:58 UTC

README

Current package documentation

404game.js

Turn boring 404 pages into playable mini-games. Drop-in, zero dependencies, < 30KB.

🎮 Live Demo →

<script src="404game.js"></script>
<div id="game"></div>
<script>Game404.mount('#game');</script>

That's it. Your 404 page now has Snake, Flappy Bird, Breakout, or a Dino runner.


🎮 Games included

GameControls (Desktop)Controls (Mobile)
🐍 SnakeArrow keysSwipe
🐦 FlappySpace / ClickTap
🧱 BreakoutArrow keys + SpaceSwipe + Tap
🦖 DinoSpaceTap

Plus 4 themes: neon, retro, minimal, dark.


📦 Install

npm install 404game

or use the CDN-style UMD bundle:

<script src="https://unpkg.com/404game/dist/404game.umd.cjs"></script>

🚀 Usage

Vanilla / <script> tag

<div id="game"></div>
<script src="404game.umd.cjs"></script>
<script>
  Game404.mount('#game', {
    game: 'random',   // 'snake' | 'flappy' | 'breakout' | 'dino' | 'random'
    theme: 'neon',    // 'neon'  | 'retro'  | 'minimal'  | 'dark'
  });
</script>

ES Modules / bundlers

import Game404 from '404game';

Game404.mount('#game', { game: 'snake' });

React

import { useEffect, useRef } from 'react';
import Game404 from '404game';

function NotFoundPage() {
  const ref = useRef(null);
  useEffect(() => {
    const instance = Game404.mount(ref.current, { game: 'random' });
    return () => instance.destroy();
  }, []);
  return <div ref={ref} />;
}

⚙️ Options

OptionTypeDefaultDescription
game'snake' | 'flappy' | 'breakout' | 'dino' | 'random''random'Which game to load
theme'neon' | 'retro' | 'minimal' | 'dark''neon'Visual theme
widthnumbercontainer width or 480Canvas width (px)
heightnumber360Canvas height (px)
messagestring'404 — Page Not Found'Big banner text
subMessagestring'But hey, want to play instead?'Small banner text
showHighscorebooleantrueShow "Best" score in HUD
autoStartbooleanfalseSkip start screen
onStart() => void—Fired when player starts
onScore(score: number) => void—Fired on every score update
onGameOver(score: number) => void—Fired when player loses
onWin(score: number) => void—Fired when player wins (Breakout)

🔧 API

const instance = Game404.mount(selector, options);

instance.restart();        // Restart current game
instance.getScore();       // Current score
instance.destroy();        // Remove from DOM, free resources

Game404.unmount(selector); // Same as instance.destroy()

Game404.games;             // ['snake', 'flappy', 'breakout', 'dino']
Game404.version;           // '0.1.0'

✨ Features

  • 🎮 4 classic games built in
  • 🎨 4 themes included
  • 📱 Touch + keyboard controls — works everywhere
  • 💾 Local high scores per game
  • 🪶 Zero dependencies — pure browser APIs
  • 📦 < 30KB minified + gzipped
  • 🧩 TypeScript types included
  • ♻️ Auto-cleanup with destroy()
  • 🎯 Framework-friendly (React, Vue, Svelte, vanilla, anywhere)

🛠️ Development

npm install
npm run dev        # Vite dev server at http://localhost:5173
npm run build      # Build to dist/
npm run preview    # Preview built demo at http://localhost:4173

Open demo/index.html after building to see all 4 games at once. Open demo/404.html to see a real-world 404 page integration.


📄 License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.0Registry latest29 May 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
x1n-q/404game

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:58 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:db3db8160614995b5703f5350f3226bdc345e50fc37ec7ac81a7fec8d46e69ed