Go to file
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00
2025-10-08 14:12:48 +07:00

🐱 CatSave - Go + Next.js Monorepo

Single binary application with Go backend + Next.js frontend.

📦 Structure

catsave/
├── apps/
│   ├── web/              # Next.js frontend (static export)
│   └── server-go/        # Go backend + static file server
├── scripts/              # Build scripts
└── dist/                 # Build output

🚀 Development

Quick Start

# 1. Install dependencies
npm install

# 2. Option A: Dev Next.js only
npm run dev:web   # http://localhost:3000

# 3. Option B: Dev with Go
npm run build:dev # Build Next.js + sync to Go
npm run dev:go    # Run Go server

Workflow

Frontend Development (Next.js):

npm run dev:web   # Hot reload on :3000

Full Stack Development (Next.js + Go):

# Terminal 1: Build & sync on changes
npm run build:dev

# Terminal 2: Run Go server
npm run dev:go    # http://localhost:8080

After changing Next.js code:

npm run build:dev # Re-build and sync
# Go server will auto-serve new files

🔨 Build

Development Build (Quick)

npm run build:dev
# → Builds Next.js + syncs to Go static folder

Production Binary

npm run build
# → Builds Next.js + Go binary
# → Output: dist/catsave (single binary)

Available Commands

Command Description
npm run dev:web Dev Next.js only (port 3000)
npm run dev:go Run Go server (port 8080)
npm run build:web Build Next.js static export
npm run sync:static Copy Next.js → Go static
npm run build:dev Build + sync (development)
npm run build Full production build

🎯 Deploy

# Just copy the binary
./dist/catsave

# Runs on http://localhost:8080

🏗️ Architecture

  • Go: API + serve static files (embedded)
  • Next.js: Static export (HTML/CSS/JS)
  • Result: One binary file (~10-30MB)

📝 Tech Stack

  • Go 1.21+
  • Next.js 14
  • TypeScript
  • Tailwind CSS
Description
No description provided
Readme 787 KiB
Languages
TypeScript 47.8%
Shell 23.3%
Go 18.5%
JavaScript 5.9%
CSS 4.5%