mirror_match/REBUILD.md
ilia bc4a6b93b6 Add rebuild scripts and HelpModal component
- Introduced `rebuild.sh` script for streamlined application rebuild and server management in both production and development modes.
- Created `REBUILD.md` documentation for quick start instructions and detailed steps for rebuilding the application.
- Added `HelpModal` component to provide users with in-app guidance on how to play the MirrorMatch game, including features, tips, and keyboard shortcuts.
- Updated `layout.tsx` to include the `HelpModal` for user accessibility.
- Adjusted authentication handling in `auth.ts` to ensure proper cookie management based on environment settings.
2026-01-04 21:31:37 -05:00

1.1 KiB

Rebuild Scripts

Quick Start

./rebuild.sh prod
# or just
./rebuild.sh

Development Mode (Hot reload)

./rebuild.sh dev

What it does

  1. Kills all processes - Stops any running Node/Next.js processes
  2. Frees ports - Ensures ports 3000 and 3003 are available
  3. Cleans build artifacts - Removes .next, cache files, etc.
  4. Rebuilds (production only) - Runs npm run build
  5. Starts server - Runs in foreground (dev) or background (prod)

Viewing Logs

Production Mode

tail -f /tmp/mirrormatch-server.log

Development Mode

Logs appear directly in the terminal (foreground mode)

Manual Commands

If you prefer to run commands manually:

# Kill everything
sudo fuser -k 3000/tcp
killall -9 node
pkill -f "next"
sleep 2

# Clean
cd /home/beast/Code/mirrormatch
rm -rf .next node_modules/.cache

# Rebuild (production)
npm run build

# Start
NODE_ENV=production npm run start > /tmp/server.log 2>&1 &
# or for dev
NODE_ENV=development npm run dev