File size: 3,365 Bytes
4fe4a91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | # NES Game Player
A self-hosted retro NES game player powered by EmulatorJS, with password authentication, ROM upload, and automatic HTTPS via Caddy.
## Features
- **Browser-based NES emulator** β play games directly in your browser
- **Password protected** β simple password auth (no username required)
- **Upload & Play** β upload `.nes` ROMs through the web UI, saved permanently on the server
- **Searchable game library** β instant search filtering across all games
- **Alphabetical listing** β games sorted A-Z in a clean row-based layout
- **Lazy loading** β shows 50 games at a time, loads more on scroll
- **Automatic HTTPS** β Caddy reverse proxy with free Let's Encrypt SSL
- **Docker-based** β single `docker compose up -d` to run everything
## Quick Start
### 1. Prerequisites (Ubuntu 24)
```bash
sudo apt update
sudo apt install -y docker.io docker-compose-v2
sudo usermod -aG docker $USER
# Log out and back in
```
### 2. Clone and Deploy
```bash
git clone https://github.com/PBhadoo/retro.git
cd retro
```
### 3. Configure Domain (Optional)
Edit `Caddyfile` and replace the placeholder with your domain:
```
retro.yourdomain.com {
reverse_proxy emulatorjs:80
}
```
For IP-only access (no domain), keep the default:
```
:80, :443 {
reverse_proxy emulatorjs:80
}
```
### 4. Start
```bash
sudo docker compose up -d
```
### 5. Open
- **With domain:** `https://retro.yourdomain.com`
- **Without domain:** `http://YOUR_SERVER_IP`
**Password:** `bhadoo`
## Usage
### Playing Games
1. Enter the password on the login page
2. Browse the game library or use the search bar
3. Click any game to play instantly in your browser
### Uploading New Games
1. Click **Upload & Play** to upload and immediately play a `.nes` ROM
2. Click **Upload Only** to save a ROM to the server without playing
3. Uploaded games appear at the top of `index.json` and are sorted alphabetically on the page
## File Structure
```
.
βββ docker-compose.yml # Docker services (Node.js app + Caddy)
βββ Caddyfile # Caddy reverse proxy config (HTTPS)
βββ server.js # Node.js server (auth, upload, static files)
βββ web/
β βββ index.html # Game player frontend
βββ roms/
βββ index.json # Game list (auto-updated on upload)
βββ *.nes # ROM files
```
## Architecture
- **Caddy** β reverse proxy on ports 80/443, handles HTTPS/SSL automatically
- **Node.js** β internal HTTP server serving the web UI, handling uploads, and managing ROMs
- **EmulatorJS** β loaded from CDN (`cdn.emulatorjs.org`), runs the NES emulator in the browser
## Configuration
| Setting | Location | Default |
|---------|----------|---------|
| Password | `server.js` β `PASSWORD` | `bhadoo` |
| Games per page | `web/index.html` β `PAGE_SIZE` | `50` |
| Domain | `Caddyfile` | `:80, :443` |
| External ports | `docker-compose.yml` | `80, 443` |
## Firewall
```bash
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
```
## Management
```bash
# View logs
sudo docker compose logs -f
# Restart
sudo docker compose restart
# Stop
sudo docker compose down
# Rebuild after changes
sudo docker compose down && sudo docker compose up -d
```
## Logout
Visit `/logout` to clear your session.
---
Built and Hosted by Parveen Bhadoo β€ |