Files
insertr/insertr-server/README.md
Joakim ae9ae7e442 docs: update all documentation for unified binary architecture
📚 **Complete Documentation Overhaul**

**Updated Files:**
 **README.md** - Updated commands, configuration, and workflow
 **COMMANDS.md** - New comprehensive command reference
 **INTEGRATION-SUMMARY.md** - Updated architecture overview
 **insertr-server/README.md** - Redirect to unified binary docs

**Key Documentation Changes:**

🔧 **Unified Binary Commands:**
- Updated all examples to use `./insertr enhance` and `./insertr serve`
- Removed references to separate CLI/server binaries
- Added comprehensive configuration documentation

⚙️ **Configuration Section:**
- Added YAML configuration examples (`insertr.yaml`)
- Documented environment variables (`INSERTR_*`)
- Explained configuration precedence (CLI → env → YAML → defaults)

📖 **Command Reference (COMMANDS.md):**
- Complete reference for all commands and flags
- Usage patterns for development and production
- API endpoint documentation
- Error handling and debugging guides
- CI/CD integration examples

🏗️ **Architecture Updates:**
- Updated development workflow instructions
- Fixed CLI → Binary terminology
- Updated hot reload and build process documentation

**Migration Notes:**
- All functionality preserved in unified binary
- Simplified development workflow with `just dev`
- Single executable for all operations
2025-09-10 18:12:31 +02:00

144 lines
4.3 KiB
Markdown

# ⚠️ Deprecated: Insertr Content Server
> **This standalone server has been replaced by the unified `insertr` binary.**
> **Please see the [main README](../README.md) for updated instructions.**
## 🔄 Migration to Unified Binary
The Insertr Content Server functionality has been integrated into the unified `insertr` binary. Instead of running a separate server binary, use:
```bash
# Old approach (deprecated)
./insertr-server --port 8080
# New unified approach
./insertr serve --port 8080 --dev-mode
```
## ✅ All Features Preserved
The unified binary includes all server functionality:
- **Content Management**: Full CRUD operations for content items
- **Version Control**: Complete edit history with rollback functionality
- **User Attribution**: Track who made each change
- **Type-Safe Database**: Uses sqlc for generated Go code from SQL
- **SQLite & PostgreSQL**: Database flexibility for development to production
## 🚀 Updated API Endpoints
### Content Operations (Unchanged)
- `GET /api/content?site_id={site}` - Get all content for a site
- `GET /api/content/{id}?site_id={site}` - Get single content item
- `GET /api/content/bulk?site_id={site}&ids[]={id1}&ids[]={id2}` - Get multiple content items
- `POST /api/content` - Create new content
- `PUT /api/content/{id}?site_id={site}` - Update existing content
- `DELETE /api/content/{id}?site_id={site}` - Delete content
### Version Control (Unchanged)
- `GET /api/content/{id}/versions?site_id={site}` - Get version history
- `POST /api/content/{id}/rollback?site_id={site}` - Rollback to specific version
### Health & Status (Unchanged)
- `GET /health` - Server health check
## 🚀 New Quick Start (Unified Binary)
```bash
# Build unified binary (from project root)
go build -o insertr .
# Start server with development mode
./insertr serve --dev-mode --port 8080
# Start production server
./insertr serve --port 8080 --db "postgresql://user:pass@host/db"
# Check health (same endpoint)
curl http://localhost:8080/health
```
## User Attribution (Unchanged)
All content operations still support user attribution via the `X-User-ID` header:
```bash
curl -X PUT "http://localhost:8080/api/content/hero-title?site_id=demo" \
-H "Content-Type: application/json" \
-H "X-User-ID: john@example.com" \
-d '{"value": "Updated content"}'
```
## 🛠️ Development (Updated for Unified Binary)
### Using sqlc (From Project Root)
```bash
# Install sqlc
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
# Generate Go code from SQL (from project root)
sqlc generate
# Build unified binary
go build -o insertr .
# Development with hot reload
just dev # Full-stack development
air # Hot reload unified binary only
```
### Database Schema (Location Updated)
See `db/sqlite/schema.sql` and `db/postgresql/schema.sql` for database-specific schemas. Key tables:
- `content` - Current content versions
- `content_versions` - Complete version history
### Example Version Control Workflow
```bash
# Create content
curl -X POST "http://localhost:8080/api/content" \
-H "Content-Type: application/json" \
-H "X-User-ID: alice@example.com" \
-d '{
"id": "hero-title",
"site_id": "demo",
"value": "Original Title",
"type": "text"
}'
# Update content (creates version)
curl -X PUT "http://localhost:8080/api/content/hero-title?site_id=demo" \
-H "Content-Type: application/json" \
-H "X-User-ID: bob@example.com" \
-d '{"value": "Updated Title"}'
# View version history
curl "http://localhost:8080/api/content/hero-title/versions?site_id=demo"
# Rollback to version 1
curl -X POST "http://localhost:8080/api/content/hero-title/rollback?site_id=demo" \
-H "Content-Type: application/json" \
-H "X-User-ID: admin@example.com" \
-d '{"version_id": 1}'
```
---
## 📖 For Complete Documentation
**➡️ See the [main README](../README.md) for:**
- Unified binary installation and usage
- Complete configuration options (YAML, environment variables, CLI flags)
- Development workflow with `just dev`
- Production deployment guidance
- Full architecture documentation
**➡️ See [INTEGRATION-SUMMARY.md](../INTEGRATION-SUMMARY.md) for:**
- Technical architecture details
- Database schema information
- API integration examples
The unified `insertr` binary provides all server functionality with improved developer experience and simplified deployment.