You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Health Checks - Kubernetes-ready liveness, readiness, and startup probes
Quick Start
# Start dependencies
docker compose up -d
# Run the application
make run
# Create your first user
curl -X POST http://localhost:8080/users \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","name":"User","password":"securepassword123"}'
API Endpoints
Authentication
Method
Endpoint
Description
POST
/auth/login
Login with email/password
POST
/auth/refresh
Refresh access token
POST
/auth/logout
Logout and revoke tokens
Users
Method
Endpoint
Auth
Description
POST
/users
-
Create user
GET
/users
Admin
List all users
GET
/users/{id}
Self/Admin
Get user by ID
PATCH
/users/{id}
Self
Update own profile
POST
/users/{id}/deactivate
Self
Deactivate account
Records (Vinyl Inventory)
Method
Endpoint
Auth
Description
POST
/records
Admin
Create record
GET
/records
-
List records (with filters)
GET
/records/{id}
-
Get record by ID
PATCH
/records/{id}
Admin
Update record
POST
/records/{id}/archive
Admin
Archive record
Orders
Method
Endpoint
Auth
Description
POST
/orders
User
Create order
GET
/orders
User
List my orders
GET
/orders/{id}
Owner/Admin
Get order details
POST
/orders/{id}/cancel
Owner
Cancel pending order
Inventory Management
Method
Endpoint
Auth
Description
GET
/inventory
-
List inventory status
POST
/inventory/{record_id}/restock
Admin
Restock a record
Health & Observability
Endpoint
Description
/livez
Kubernetes liveness probe
/readyz
Kubernetes readiness probe
/startupz
Kubernetes startup probe
/metrics
Prometheus metrics (port 9090)
/debug/pprof/*
Go profiling (when enabled)
HTTP Headers
Header
Description
Example
Accept
Response format
application/vnd.vinylstore.v1+json
Accept-Encoding
Compression (gzip)
gzip
Content-Type
Request body format
application/json
Idempotency-Key
Idempotency for POST
unique-key-123
X-API-Version
Response version header
vinylstore.v1
Configuration
Configuration priority: CLI flags > env vars > config file > defaults. All env vars are prefixed with VINYL_.
# Unit tests
go test ./...
# Integration tests (requires Docker)
go test ./... -tags=integration
# Coverage
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
# Regenerate mocks
make generate
Architecture
├── app/ # Application bootstrap and server setup
├── cmd/server/ # Application entry point
├── config/ # Configuration management with Viper
├── handlers/ # HTTP handlers using zerohttp
├── models/ # Domain models (User, Record, Order)
├── mocks/ # Generated mocks for testing
└── store/ # Data persistence layer (MongoDB interface)