A backend service for managing package pickup points (PVZ) and goods reception, built with Go. It features a RESTful HTTP API (with OpenAPI docs) and a gRPC API.
- User Management: JWT + Refresh Token authentication.
- RBAC:
moderator
andemployee
roles. - PVZ & Reception Workflow: Create/manage PVZs, open/close receptions, add/delete products (LIFO).
- API: REST and gRPC endpoints.
- Monitoring: Prometheus metrics.
- Testing: Unit, integration, and k6 load tests.
- Go
- PostgreSQL
- Docker
- REST (go-chi)
- gRPC
- Prometheus
- k6
-
Prerequisites: Go 1.24+, Docker, Make.
-
Clone the repository:
git clone https://github.com/shrtyk/pvz-service.git && cd pvz-service
-
Initial Setup:
# Creates .env from .env_example and generates RSA keys make setup
-
Run the application:
# Starts all services (app, db, prometheus) and applies migrations make docker/up
The services will be available at:
- HTTP API:
http://localhost:8080
- gRPC API:
localhost:3000
- Prometheus:
http://localhost:9000
- HTTP API:
-
Stop the application:
# Stops and removes all running containers and volumes make docker/down
The Makefile
provides several helpers for development. For a full list of commands, please see the Makefile
.
# Run all unit and integration tests
make test
# Run the linter
make linter/run
# Generate mocks, DTOs, and RSA keys
make generate
# Run k6 load test
make load-test/run
Load tests were executed using k6. The test scenario simulates a ramp-up from 50 to 1000 virtual users over 30 seconds, sustaining the load for 1 minute.
The following results were achieved on an Intel Core i9-9900KF CPU:
Metric | Result |
---|---|
Requests per Second | ~5,040 req/s |
p(95) Latency | 40.05ms |
Success Rate | 100% |
Total Requests | ~510,000 |