Quick Start Guide
This guide will help you get the Shinkansen Commerce platform up and running in 5 minutes.
Prerequisites
- Docker and Docker Compose
- Go 1.21+ (for local development)
- Make
- uv (Python package manager) - optional, for analytics worker
Quick Start (5 minutes)
1. Start All Services
bash
# Start PostgreSQL, Redis, and all 7 microservices
make up
# Wait for services to be healthy (30-60 seconds)
docker-compose ps2. Test the Platform
bash
# Run integration tests (tests complete order flow)
make test-integration
# Or test individual endpoints
curl http://localhost:8080/health
# Register a user
curl -X POST http://localhost:8080/v1/users/register \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "password123",
"name": "John Doe",
"phone": "090-1234-5678"
}'
# List products
curl http://localhost:8080/v1/products3. View Logs
bash
# View all logs
make logs
# View specific service logs
docker-compose logs gateway
docker-compose logs product-service4. Stop Services
bash
# Stop all services
make down
# Stop and remove volumes (full cleanup)
make clean-allServices
| Service | Port | Description |
|---|---|---|
| Gateway (HTTP) | 8080 | REST API gateway |
| Product Service | 9091 | Product catalog (gRPC) |
| Order Service | 9092 | Order management (gRPC) |
| User Service | 9103 | User authentication (gRPC) |
| Payment Service | 9104 | Payment processing (gRPC) |
| Inventory Service | 9105 | Stock management (gRPC) |
| Delivery Service | 9106 | Shipping & delivery (gRPC) |
| PostgreSQL | 5432 | Database |
| Redis | 6379 | Cache |
Development Workflow
Build All Services
bash
# Build all Go services to bin/
make build-all
# Or build specific service
make build-gateway
make build-product-service
make build-order-service
make build-user-service
make build-payment-service
make build-inventory-service
make build-delivery-serviceRun Tests
bash
# Run unit tests for all services
make test
# Run tests with coverage
make test-coverage
# Run integration tests
make test-integrationGenerate Code
bash
# Generate gRPC code from protobufs
make proto-gen
# Generate SQL code
make sqlc-gen
# Generate OpenAPI docs
make proto-openapi-gen
# Generate all code
make genAPI Endpoints
User Management
POST /v1/users/register- Register new userPOST /v1/users/login- LoginGET /v1/users/me- Get current userPUT /v1/users/me- Update profileGET /v1/users/me/addresses- List addressesPOST /v1/users/me/addresses- Add address
Products
GET /v1/products- List productsGET /v1/products/{id}- Get productGET /v1/products/search- Search productsGET /v1/products/variants- Get product variants
Orders
GET /v1/orders- List ordersPOST /v1/orders- Create orderGET /v1/orders/{id}- Get orderPOST /v1/orders/{id}/status- Update statusPOST /v1/orders/{id}/cancel- Cancel order
Payments
POST /v1/payments- Create paymentGET /v1/payments/{id}- Get paymentPOST /v1/payments/{id}/process- Process paymentPOST /v1/payments/{id}/refund- Refund payment
Inventory
GET /v1/inventory/stock- Get stock levelPUT /v1/inventory/stock- Update stockPOST /v1/inventory/reserve- Reserve stockPOST /v1/inventory/release- Release reservation
Delivery
GET /v1/delivery/slots- Get delivery slotsPOST /v1/delivery/slots- Reserve slotGET /v1/shipments/{id}- Get shipmentPUT /v1/shipments/{id}/status- Update status
Architecture
mermaid
graph TB
subgraph Client
A[Web App]
B[Mobile App]
end
subgraph Gateway
G[HTTP Gateway<br/>:8080]
end
subgraph Services
P[Product Service<br/>:9091]
O[Order Service<br/>:9092]
U[User Service<br/>:9103]
PY[Payment Service<br/>:9104]
I[Inventory Service<br/>:9105]
D[Delivery Service<br/>:9106]
end
subgraph Data
PG[(PostgreSQL<br/>:5432)]
REDIS[(Redis<br/>:6379)]
end
A --> G
B --> G
G --> P
G --> O
G --> U
G --> PY
G --> I
G --> D
P --> PG
P --> REDIS
O --> PG
O --> REDIS
U --> PG
PY --> PG
I --> PG
D --> PGDatabase Schema
The database contains 6 schemas:
catalog- Products, categories, variantsorders- Orders, order itemsusers- Users, addressespayments- Payments, transactionsinventory- Stock items, movements, reservationsdelivery- Delivery zones, slots, shipments
Troubleshooting
Services Not Starting
bash
# Check service logs
docker-compose logs [service-name]
# Restart specific service
docker-compose restart [service-name]
# Rebuild and start
make clean
make build-all
make upDatabase Issues
bash
# Reset database
make down
docker volume rm shinkansen-commerce_postgres_data
make upPort Already in Use
bash
# Check what's using the port
lsof -i :8080
# Change port in docker-compose.yml
# Or kill the processEnvironment Variables
Services can be configured with environment variables:
| Variable | Default | Description |
|---|---|---|
HTTP_SERVER_ADDRESS | :8080 | Gateway HTTP port |
JWT_SECRET | your-jwt-secret-change... | JWT signing key |
DATABASE_URL | postgres://... | PostgreSQL connection |
REDIS_URL | redis://localhost:6379 | Redis connection |