4chan Media Gallery 2.0
A cross-imageboard media aggregator and gallery viewer
Search by keyword across multiple imageboards simultaneously and browse all matching media in a unified gallery with a full-featured lightbox viewer.
- Multi-board search โ Query 4chan, easychan, mokachan, and desuarchive at once
- Unified gallery grid โ All results merged and sorted by timestamp
- Full-featured lightbox โ Keyboard navigation, zoom/pan, slideshow, flip, download
- Cloudflare bypass โ FlareSolverr integration for protected boards
- OR search โ Separate keywords with
|for multi-term matching - Auto-refresh โ Load in fresh media without losing your place
- Touch-friendly โ Drag-to-pan, pinch-to-zoom, double-tap reset
| Source | Board | Cloudflare | Format |
|---|---|---|---|
| 4chan | /mu/, /trash/, /gif/ | No | 4chan API |
| Easychan | /kr/ | Yes | Meguca |
| Mokachan | /kr/ | No | Meguca |
| Desuarchive | /mu/, /trash/ | No | Foolfuuka |
Adding a new board is a single config entry in src/lib/boards.ts.
| Key | Action |
|---|---|
โ / โ |
Navigate between media |
Space |
Toggle slideshow |
F |
Toggle fullscreen |
H |
Flip image horizontally |
S |
Download current media |
R |
Rotate |
Esc |
Close lightbox |
Run the app directly without pm2 โ ideal for development or quick testing:
git clone https://github.com/kpg-anon/4chmg2.git
cd 4chmg2
cp .env.example .env
nano .env # set your port, FlareSolverr URL, etc.
npm install
npm run build
npm startUse pm2 for process management with automatic restarts and zero-downtime reloads:
git clone https://github.com/kpg-anon/4chmg2.git
cd 4chmg2
cp .env.example .env
nano .env # set your domain, port, etc.
npm install
npx gulp reset # install, build, and start pm2For a full production setup with nginx, SSL, FlareSolverr, and pm2 autostart:
sudo ./install.shSee INSTALLATION.md for the complete walkthrough.
After making changes to the code:
# Local development
npm run build && npm start
# pm2 managed server
npx gulp # build + reload (everyday command)
./build_restart.sh # same thing, scriptable| Command | Description |
|---|---|
npx gulp |
Build and reload server |
npx gulp build |
Build only |
npx gulp restart |
Reload pm2 only |
npx gulp reset |
Full setup from scratch |
npx gulp logs |
View application logs |
npx gulp status |
Check pm2 process status |
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router) |
| Language | TypeScript |
| Runtime | React 19 |
| Styling | Tailwind CSS v4 |
| Process Manager | pm2 |
| Build Runner | gulp |
| Reverse Proxy | nginx + certbot |
| Cloudflare Bypass | FlareSolverr |
4CHMG2 is designed to be self-hosted. Instance-specific configuration (domain, ports, etc.) lives in .env which is gitignored. For VPS deployment details, see INSTALLATION.md.
- User accounts and saved searches
- Additional imageboard sources
- Media deduplication (perceptual hash)
- Gallery sharing via URL
MIT



