# ⚠️ 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.