feat: first

This commit is contained in:
2025-08-13 19:36:09 +02:00
parent fd2ba2e999
commit 5fc4d1d997
17 changed files with 2622 additions and 111 deletions

View File

@@ -19,7 +19,9 @@ run: build
# Clean build artifacts
clean:
rm -rf bin/
rm -rf pkg/pb/
rm -rf proto/**/*.pb.go
rm -rf proto/**/*.pb.gw.go
rm -rf docs/
# Run tests
test:
@@ -45,6 +47,7 @@ install-deps:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
# Download and tidy dependencies
deps:
@@ -53,3 +56,50 @@ deps:
# Development workflow
dev: deps proto run
# Docker commands
docker-build:
docker build -t grpc-gateway-template:latest .
docker-run:
docker run --rm -p 8080:8080 -p 8090:8090 grpc-gateway-template:latest
docker-push registry="":
@if [ -z "{{registry}}" ]; then echo "Usage: just docker-push registry=<registry>"; exit 1; fi
docker tag grpc-gateway-template:latest {{registry}}/grpc-gateway-template:latest
docker push {{registry}}/grpc-gateway-template:latest
# Testing commands
test-coverage:
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
test-integration:
go test -tags=integration ./tests/...
# Formatting and linting
format:
go fmt ./...
goimports -w .
# Health check command
health:
@curl -f http://localhost:8090/health || echo "Service not healthy"
# Generate and serve API documentation
docs: proto
@echo "OpenAPI documentation generated in docs/"
@if command -v python3 >/dev/null 2>&1; then \
echo "Serving docs at http://localhost:8080/docs"; \
cd docs && python3 -m http.server 8080; \
else \
echo "Install Python 3 to serve docs locally"; \
fi
# Development with hot reload (requires air)
dev-watch:
@if ! command -v air >/dev/null 2>&1; then \
echo "Installing air for hot reload..."; \
go install github.com/cosmtrek/air@latest; \
fi
air