Quick Start Guide
Get the Pricing Engine running in 5 minutes.
Prerequisites
- Docker and Docker Compose installed
- Git for cloning the repository
๐ Setup Steps
1. Clone Repository (if not already)
cd /path/to/projects
git clone https://github.com/hungryhub-team/pricing-engine.git
cd pricing-engine
2. Start Services
# Start PostgreSQL, Redis, and API
docker-compose up -d
# Verify services are running
docker-compose ps
Expected output:
NAME STATUS
pricing-engine-api Up
pricing-engine-db Up
pricing-engine-redis Up
3. Run Database Migrations
docker-compose exec api bundle exec rails db:migrate
4. Verify API is Running
curl http://localhost:3001/health
Expected response:
{
"status": "ok",
"timestamp": "2025-12-09T10:30:00Z"
}
๐งช Test the API
Option 1: Using Postman (Recommended)
- Open Postman
- Import collection:
docs/postman/Pricing_Engine_API.postman_collection.json - Import environment:
docs/postman/Pricing_Engine_Local.postman_environment.json - Select โPricing Engine - Localโ environment
- Get an OAuth token from your authentication service
- Try: Pricing Rules โ List Rules
See POSTMAN_GUIDE.md for detailed setup.
Option 2: Using cURL
# Get OAuth token first (from your auth service)
TOKEN="your_bearer_token"
# List pricing rules
curl -X GET http://localhost:3001/api/partner/v1/pricing_rules \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
โ Verification Checklist
- Docker containers running (
docker-compose ps) - Database migrated successfully
- Health endpoint returns
{"status":"ok"} - Can authenticate with Bearer token
- Can list pricing rules
๐ Common Issues
Port 3001 Already in Use
# Check what's using the port
lsof -ti:3001
# Stop and restart
docker-compose down
docker-compose up -d
Database Connection Error
# Reset database
docker-compose down -v
docker-compose up -d
docker-compose exec api bundle exec rails db:setup
Authentication Failed
- Verify
PARTNER_ENGINE_BASE_URLin environment - Check OAuth token is valid
- Ensure token is prefixed with
Bearer
๐ Next Steps
Now that your environment is running:
- Understand Authentication: AUTHENTICATION.md
- Explore DateTime Rules: datetime-rule/README.md
- Read API Reference: API_REFERENCE.md
- Setup Postman: postman/SETUP_GUIDE.md
๐ ๏ธ Useful Commands
# View logs
docker-compose logs -f api
# Run tests
docker-compose exec api bundle exec rspec
# Rails console
docker-compose exec api bundle exec rails console
# Stop services
docker-compose down
# Rebuild after code changes
docker-compose down
docker-compose build api
docker-compose up -d
Estimated Time: โฑ๏ธ 5 minutes
Difficulty: ๐ข Beginner
Next: AUTHENTICATION.md