Query multiple freight carriers and get consolidated rates in one API call.
Supports: XPO Logistics • TForce Freight • GLI Freight (20+ carriers)
-
Clone and install:
git clone https://github.com/yourusername/quickRateLTL.git cd quickRateLTL npm install -
Configure credentials:
cp .env.example .env # Edit .env and add your API credentials (see instructions below) -
Start development server:
npm run dev
-
Test the API:
curl -X POST http://localhost:3000/api/aggregate \ -H "Content-Type: application/json" \ -d '{ "origin": {"city": "Portland", "state": "OR", "zip": "97201"}, "destination": {"city": "Phoenix", "state": "AZ", "zip": "85001"}, "shipDate": "2025-01-15", "freightClass": "85", "weights": {"numUnits": 1, "unitWeight": 500, "numPieces": 1} }'
-
Deploy to Vercel:
- Push to GitHub
- Import in Vercel
- Add environment variables
- Done!
See .env.example for all configuration options.
XPO Logistics (OAuth2):
XPO_BASE_URL- API endpointXPO_CLIENT_BASIC- Base64-encoded credentials ORXPO_USERNAME+XPO_PASSWORDXPO_ACCOUNT_INST_ID- Your account ID- Contact: LTLWebAPISupport@xpo.com
TForce Freight (Azure AD):
TFORCE_CLIENT_ID- Azure AD app IDTFORCE_CLIENT_SECRET- Azure AD secretTFORCE_TOKEN_ENDPOINT- Azure tenant endpointTFORCE_SCOPE- API scope- Contact: TForce Freight support
GLI Freight (API Key):
GLI_API_KEY- Your API keyKV_*variables - Vercel KV/Redis for caching- Contact: GLI support
Optional:
DISCORD_WEBHOOK_URL- For error alerts (optional)
See detailed docs in ENVIRONMENT_VARIABLES.md for:
- How to obtain each credential
- Step-by-step configuration
- Security best practices
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /api/aggregate |
Get rates from all carriers |
| POST | /api/providers/xpo |
XPO only |
| POST | /api/providers/tforce |
TForce only |
| POST | /api/providers/gli |
GLI only |
| GET | /api/health/providers |
Check provider status |
| GET | /api/health/circuits |
View circuit breaker status |
Request body (shipment details):
{
"origin": {"city": "Portland", "state": "OR", "zip": "97201"},
"destination": {"city": "Phoenix", "state": "AZ", "zip": "85001"},
"shipDate": "2025-01-15",
"freightClass": "85",
"weights": {"numUnits": 1, "unitWeight": 500, "numPieces": 1},
"dimensions": {"length": 48, "width": 40, "height": 48},
"accessorials": {"pickup": ["RESP"], "delivery": ["RESD"]},
"providers": ["gli", "xpo", "tforce"]
}See .ai/core/api-endpoints.md for complete API documentation.
- Configuration: See
ENVIRONMENT_VARIABLES.md - Architecture & Design: See
.ai/core/architecture.md(in repo) - API Reference: See
.ai/core/api-endpoints.md(in repo) - Implementation Patterns: See
.ai/patterns/README.md(in repo) - Development Workflows: See
.ai/workflows/README.md(in repo)
npm run dev # Start development server
npm run build # Build for production
npm start # Run production server
npm run lint # Check code style
npm run typecheck # Check TypeScript types- Push code to GitHub
- Go to https://vercel.com/new
- Import your repository
- Add environment variables (see
.env.example) - Deploy!
Your app will be live at https://your-project.vercel.app
curl https://your-project.vercel.app/api/health/providersShould return provider status (healthy, degraded, or unhealthy).
- All credentials stored in environment variables (never committed)
- OAuth2 tokens cached securely in memory with expiration
- Request timeouts protect against hanging requests
- Circuit breaker prevents cascading failures
- Structured logging with request IDs for debugging
Never commit: .env, .env.local, or any files with real credentials
MIT
Need help? Check the docs in .ai/ folder for detailed guides on configuration, API usage, and troubleshooting.