AI-powered web page generation platform built with Claude Agent SDK. Describe what you want in natural language, and let AI generate modern web pages for you.
English | 简体中文
- Natural Language to Code - Describe your idea, get production-ready HTML/CSS
- Real-time Streaming - Watch code generation in real-time via SSE
- Modern Tech Stack - Go + Hertz backend, Node.js Agent Server, Claude AI
- User Authentication - JWT-based auth with secure password handling
- Project Persistence - Save and manage your generated projects
| Requirement | Version | Installation |
|---|---|---|
| Go | >= 1.22 | Download |
| Node.js | >= 18 | Download |
| MySQL | >= 8.0 | brew install mysql or Download |
| Redis | >= 7.0 | brew install redis or Download |
| Claude API Key | - | Get API Key |
# Clone the repository
git clone https://github.com/test-tt/vibe-coding.git
cd vibe-coding
# Install Go dependencies
make tidy
# Install Node.js dependencies for Agent Server
cd agent-server && npm install && cd ..# macOS (using Homebrew)
brew services start mysql
brew services start redis
# Or using Docker (skip to Step 4 for full Docker setup)# Run the initialization script
mysql -u root -p < scripts/init.sqlThis creates the vibe_coding database with all required tables and test data.
Test Account:
- Email:
[email protected] - Password:
password123
# Set your Claude API key
export ANTHROPIC_API_KEY="your-api-key-here"Open two terminal windows:
Terminal 1 - Go Backend:
make dev
# Server runs at http://localhost:8888Terminal 2 - Agent Server:
make agent
# Agent runs at http://localhost:3001- Homepage: http://localhost:8888
- AI Workspace: http://localhost:8888/workspace.html
- API Docs: http://localhost:8888/swagger/index.html
Skip Steps 2-5 and use Docker instead:
# Set API key
export ANTHROPIC_API_KEY="your-api-key-here"
# Start all services (MySQL + Redis + API)
make docker-up
# View logs
make docker-logs
# Stop services
make docker-down.
├── agent-server/ # Claude Agent SDK service (Node.js)
│ ├── server.js # Express server with SSE streaming
│ └── package.json
├── cmd/api/ # Go application entrypoint
│ └── main.go
├── config/ # Configuration files
│ ├── config.yaml # Default config
│ ├── config.dev.yaml # Development config
│ └── config.prod.yaml # Production config
├── internal/ # Internal packages
│ ├── handler/ # HTTP request handlers
│ ├── service/ # Business logic
│ ├── dao/ # Data access layer
│ ├── model/ # Data models
│ ├── middleware/ # HTTP middlewares (15+)
│ └── router/ # Route definitions
├── pkg/ # Public packages
│ ├── cache/ # Three-tier caching system
│ ├── database/ # MySQL wrapper
│ ├── logger/ # Zap-based logging
│ ├── jwt/ # JWT utilities
│ └── ...
├── web/ # Frontend (HTML/CSS/JS)
│ ├── index.html # Homepage
│ └── workspace.html # AI Workspace
├── scripts/ # Database scripts
│ └── init.sql # Complete DB initialization
├── docker-compose.yaml # Docker orchestration
├── Makefile # Build commands
└── README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/auth/register |
Register new user |
| POST | /api/v1/auth/login |
Login and get JWT token |
| POST | /api/v1/auth/logout |
Logout (invalidate token) |
| GET | /api/v1/auth/profile |
Get current user profile |
| PUT | /api/v1/auth/password |
Change password |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/generate |
Create generation task |
| GET | /api/stream/:id |
SSE stream for results |
| GET | /api/sessions |
List all sessions |
curl -X POST http://localhost:8888/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "password123"}'Response:
{
"code": 0,
"message": "success",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"user": {
"id": 1,
"name": "Test User",
"email": "[email protected]"
}
}
}curl -X POST http://localhost:3001/api/generate \
-H "Authorization: Bearer <your-token>" \
-H "Content-Type: application/json" \
-d '{"prompt": "Create a modern SaaS landing page with hero section"}'# Development
make dev # Start with hot reload (Air)
make run # Run directly
make run-dev # Run with dev config
make run-prod # Run with prod config
# Agent Server
make agent # Start Agent Server
make agent-dev # Start with auto-reload
make agent-install # Install npm dependencies
# Build
make build # Build binary
make swagger # Generate Swagger docs
# Testing
make test # Run tests
make test-cover # Run with coverage
# Code Quality
make lint # Run golangci-lint
make fmt # Format code
# Docker
make docker-up # Start all services
make docker-down # Stop all services
make docker-logs # View logs
# Help
make help # Show all commands| Variable | Description | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Claude API key | (required) |
APP_SERVER_PORT |
Server port | 8888 |
APP_MYSQL_HOST |
MySQL host | 127.0.0.1 |
APP_MYSQL_DATABASE |
Database name | vibe_coding |
APP_REDIS_HOST |
Redis host | 127.0.0.1 |
JWT_SECRET |
JWT signing secret | (see config) |
config/config.yaml- Default configurationconfig/config.dev.yaml- Development overridesconfig/config.prod.yaml- Production overrides
Request → L1 LocalCache (64MB, ~50μs)
↓ miss
L2 Redis (~1ms)
↓ miss
L3 MySQL (~5ms)
↓
Backfill L2 + L1
Protection mechanisms:
- Cache penetration: Bloom filter + null value caching
- Cache breakdown: Singleflight request merging
- Cache avalanche: TTL randomization
- Recovery, RequestID, AccessLog, CORS
- RateLimit (3-tier), JWT Auth
- Prometheus Metrics, Gzip, Timeout
- OpenTelemetry Tracing, Circuit Breaker
- I18n, Security Headers
| Endpoint | QPS | P99 Latency |
|---|---|---|
| GET /ping | ~65,000 | 1.2ms |
| GET /api/v1/users | ~44,000 | 1.8ms |
| POST /api/v1/users | ~12,000 | 3.5ms |
Tested on Apple M4 Pro / 16GB / macOS
- Define model in
internal/model/ - Implement DAO in
internal/dao/ - Add business logic in
internal/service/ - Create handler in
internal/handler/(with Swagger annotations) - Register route in
internal/router/router.go - Run
make swaggerto update docs
# Before committing
make fmt # Format code
make lint # Check issues
make test # Run tests# Kill process on port 8888
kill -9 $(lsof -t -i:8888)
# Kill process on port 3001
kill -9 $(lsof -t -i:3001)- Ensure MySQL is running:
mysql.server status - Check credentials in
config/config.dev.yaml - Verify database exists:
mysql -u root -p -e "SHOW DATABASES;"
- Ensure Redis is running:
redis-cli ping - Check connection in config file
Ensure JWT secret matches between Go backend and Agent Server:
# Start Agent Server with matching JWT config
make agentWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Claude Agent SDK by Anthropic
- Hertz by ByteDance
- GORM for database operations
- All other open-source libraries that make this project possible