Skip to content

kpg-anon/4chmg2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

4CHMG2 Mascot

4CHMG2

4chan Media Gallery 2.0
A cross-imageboard media aggregator and gallery viewer

Version Next.js License


Search by keyword across multiple imageboards simultaneously and browse all matching media in a unified gallery with a full-featured lightbox viewer.

Homepage

โœจ Features

  • 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

Search Results

Lightbox Viewer

๐ŸŒ Supported Boards

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.

๐ŸŽฎ Lightbox Hotkeys

Key Action
โ† / โ†’ Navigate between media
Space Toggle slideshow
F Toggle fullscreen
H Flip image horizontally
S Download current media
R Rotate
Esc Close lightbox

๐Ÿš€ Quick Start

Local Development

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 start

Persistent Server (pm2 + gulp)

Use 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 pm2

VPS Deployment (Debian 12)

For a full production setup with nginx, SSL, FlareSolverr, and pm2 autostart:

sudo ./install.sh

See INSTALLATION.md for the complete walkthrough.

๐Ÿง‘โ€๐Ÿ’ป Usage

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

๐Ÿ› ๏ธ Tech Stack

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

๐Ÿ“ฆ Deployment

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.

๐Ÿ“ TODO

  • User accounts and saved searches
  • Additional imageboard sources
  • Media deduplication (perceptual hash)
  • Gallery sharing via URL

License

MIT

About

๐Ÿ€Multi-imageboard media aggregator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors