Study backend project with microservices for minimal marketplace
A brief description of repository
api/ External REST contracts (OpenAPI)
proto/ Internal gRPC contracts (Protobuf)
internal/platform/ Shared infrastructure docs
services/
...api-gateway/
...auth-service/
...cart-service/
...catalog-service/
...notification-service/
...order-service/
...payment-service/
...user-service/
...
docker compose up --buildBy default, services available at:
- gateway:
:8080 - auth:
:8081 - cart:
:8082 - catalog:
:8083 - notification:
:8084 - order:
:8085 - payment:
:8086 - user:
:8087
curl -i http://localhost:8081/health
curl -i http://localhost:8081/readyThe same way for other services, just
get /health and /ready
with CURL by service's port, or run loop:
for port in 8081 8082 8083 8084 8084 8085 8086 8087; do
curl -fsS "http://localhost:${port}/health" && echo " <- ${port} OK"
donecurl -s -X POST http://localhost:8081/auth/register \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com", "password": "yourpassword"}'curl -s -X POST http://localhost:8081/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com", "password":"yourpassword"}'Warning
Save access_token and refresh_token from response
Checkout pipeline consist of:
- Create order
- Payment
- Get notification
You can test this pipeline with integration test:
cd services/order-service && go test ./internal/order -run TestCreateOrderPaymentNotificationFlowImportant
Now this integration test and related business logic are still not implemented. Reference only
curl -s -X POST http://localhost:8081/auth/logout \
-H 'Content-Type: application/json' \
-d '{"refresh_token":"<refresh_token>"}'curl -s -X POST http://localhost:8081/auth/reset-password \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com"}'Then you should approve password reset:
curl -s -X POST http://localhost:8081/auth/reset-password/confirm \
-H 'Content-Type: application/json' \
-d '{"token":"<reset_token>", "new_password":"yournewpassword"}'If you're looking for contracts docs, check this out: