A modern, secure, and scalable rewrite of the ControlMe platform in Go, providing a clean modern API for applications.
- β Modern API: RESTful API with JWT authentication
- β Real-time Communication: WebSocket support for instant messaging
- β Secure: Modern authentication, bcrypt password hashing, HTTPS support
- β Scalable: Docker-based deployment
- β Cross-platform: Runs on Linux, macOS, and Windows
- β Well-tested: Comprehensive test coverage
controlme-go/
βββ cmd/
β βββ server/ # Main application entry point
β βββ tools/ # Development and maintenance tools
βββ internal/
β βββ api/
β β βββ handlers/ # HTTP request handlers
β β βββ routes/ # Route definitions
β βββ auth/ # Authentication logic
β βββ config/ # Configuration management
β βββ database/ # Database connection and setup
β βββ middleware/ # HTTP middleware
β βββ models/ # Data models (GORM)
β βββ services/ # Business logic layer
β βββ websocket/ # WebSocket hub and handlers
βββ configs/ # Configuration files
βββ scripts/ # Development and deployment scripts
βββ docker/ # Docker configuration
βββ docs/ # Documentation
- Go 1.21+
- Docker & Docker Compose
- Make (optional, but recommended)
-
Clone the repository
git clone <repository-url> cd controlme-go
-
Set up the development environment
make setup
-
Start the development server
make dev
The server will be available at http://localhost:8080
-
Start Docker services
./scripts/docker.sh up
-
Install dependencies
go mod tidy
-
Build and run
go build -o bin/server cmd/server/main.go ./bin/server
make help # Show all available commands
make setup # Set up development environment
make dev # Start development server with hot reload
make build # Build the server binary
make test # Run all tests
make lint # Run code linter
make fmt # Format code
make clean # Clean build artifacts
make docker-up # Start Docker services (includes Swagger UI)
make docker-down # Stop Docker services
make seed # Run database seed data
make swagger # Generate Swagger documentation
make swagger-serve # Generate docs and start serverThe Docker Compose setup includes:
- PostgreSQL Database (port 5432)
- Go Server with hot reload (port 8080)
- Swagger UI for API documentation (port 8081)
- Nginx reverse proxy for production (port 80/443)
- API Server: http://localhost:8080
- Built-in Swagger: http://localhost:8080/swagger/index.html
- Dedicated Swagger UI: http://localhost:8081
- Health Check: http://localhost:8080/health
Copy the example configuration and modify as needed:
cp configs/config.example.yaml configs/config.yamlKey configuration options:
- Database connection settings
- Server port and host
- JWT secret keys
- CORS settings
- Log levels
Run the full test suite:
make testTest specific packages:
go test ./internal/auth/...
go test ./internal/api/handlers/...Base URL: http://localhost:8080/api/v1
POST /auth/login- User authenticationPOST /auth/refresh- Refresh JWT token
GET /commands/pending- Get pending commands for userPOST /commands/complete- Mark command as completedPOST /commands/create- Create new command
GET /users/profile- Get user profilePUT /users/profile- Update user profile
WS /ws/client- Universal WebSocket connection (all clients)
- Language: Go 1.21+
- Web Framework: Gin
- Database: PostgreSQL with GORM ORM
- Authentication: JWT with bcrypt password hashing
- Real-time: WebSocket with message hub
- Deployment: Docker Compose
- Modern API Layer: RESTful API with proper HTTP methods and status codes
- Authentication Service: JWT-based authentication with bcrypt password hashing
- WebSocket Hub: Real-time message broadcasting and client management
- Command Service: Business logic for command creation, assignment, and completion
- User Service: User management, authentication, and profile handling
-
Production deployment
docker-compose -f docker-compose.prod.yml up -d
-
Environment variables
export DB_HOST=your-db-host export DB_PASSWORD=your-secure-password export JWT_SECRET=your-jwt-secret
-
Build for production
CGO_ENABLED=0 GOOS=linux go build -o controlme-server cmd/server/main.go
-
Run with environment configuration
export ENVIRONMENT=production ./controlme-server
go test ./internal/...go test -tags=integration ./...# TODO: Add load testing instructionscurl http://localhost:8080/health- Application metrics available at
/metrics(when enabled) - Docker container metrics via
docker stats
- Structured JSON logging via logrus
- Log levels: debug, info, warn, error
- Configurable log output (stdout, file)
- Password Security: bcrypt hashing with salt
- JWT Authentication: Secure token-based authentication
- HTTPS Support: TLS/SSL configuration available
- CORS: Configurable cross-origin resource sharing
- Rate Limiting: Built-in request rate limiting
- Input Validation: Comprehensive input sanitization
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
make test) - Run linter (
make lint) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow standard Go conventions
- Use
gofmtfor formatting - Write comprehensive tests
- Document public APIs
- Follow semantic commit messages
This project is for educational and research purposes only.
- Documentation: Check this README and inline code documentation
- Issues: Open an issue on GitHub
- JWT-based authentication
- Bcrypt password hashing
- RESTful API design
- WebSocket communication
- Enhanced security features
- Improved error handling
- Comprehensive testing
- Performance optimization
- Microservices architecture
- Advanced monitoring
- Load balancing
- Multi-tenant support
- API versioning strategy
Last Updated: July 2025
Version: 1.0.0
Go Version: 1.21+