Skip to content

Conversation

@insider89
Copy link
Collaborator

@insider89 insider89 commented Jan 18, 2026

Summary

Server inventory management solution for tracking servers across data centers. Includes REST API, CLI tool, and PostgreSQL backend.

How to Run

# Start the stack
docker compose up --build -d

# Health check
curl http://localhost:8080/health | jq

# Run tests
docker compose exec api pytest -v

# Stop
docker compose down

API Endpoints

Method Endpoint Description Success
POST /servers Create server 201
GET /servers List servers 200
GET /servers/{id} Get server 200
PUT /servers/{id} Update server 200
DELETE /servers/{id} Delete server 204

Example: Create Server

curl -X POST http://localhost:8080/servers \
  -H "Content-Type: application/json" \
  -d '{"hostname": "web-01", "ip_address": "192.168.1.100", "state": "active"}' | jq

Example: List Servers

curl http://localhost:8080/servers | jq

CLI Commands

# Create server
docker compose exec api server-cli create --hostname web-01 --ip 192.168.1.100

# List all servers
docker compose exec api server-cli list

# List as JSON
docker compose exec api server-cli list --state active --json

# Update server
docker compose exec api server-cli update <id> --state retired

# Delete server
docker compose exec api server-cli delete <id> --force

Validation

  • Hostname: RFC 1123 compliant, unique, lowercase
  • IP Address: Valid IPv4 or IPv6
  • State: active (default), offline, retired

Documentation


🤖 Generated with Claude Code

…kend

- FastAPI-based REST API with full CRUD endpoints for server management
- PostgreSQL database with schema for servers (hostname, IP, state)
- CLI tool for managing servers from command line
- Comprehensive test suite using pytest
- Docker Compose stack for local development
- Input validation: unique hostnames, valid IP addresses
- Server states: active, offline, retired
- API documentation with Swagger UI and ReDoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants