flexport-cost-tuning

Featured

Optimize Flexport API usage costs through efficient pagination, caching, webhook-driven updates, and monitoring API call volume. Trigger: "flexport costs", "flexport API usage", "reduce flexport calls", "flexport billing".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Flexport Cost Tuning ## Overview Reduce Flexport API costs by minimizing unnecessary calls. Key strategies: use webhooks instead of polling, cache aggressively, maximize page sizes, and batch operations. ## Instructions ### Strategy 1: Webhooks Over Polling ```typescript // BAD: Polling every 5 minutes (288 API calls/day per shipment) setInterval(async () => { const shipment = await flexport(`/shipments/${id}`); if (shipment.data.status !== lastStatus) updateDB(shipment); }, 5 * 60 * 1000); // GOOD: Webhook-driven (0 API calls — Flexport pushes updates) app.post('/webhooks/flexport', (req, res) => { const event = req.body; if (event.type === 'shipment.milestone') { updateDB(event.data); // Only processes real changes } res.sendStatus(200); }); // Savings: 100 shipments * 288 calls/day = 28,800 calls/day eliminated ``` ### Strategy 2: Maximize Page Size ```typescript // BAD: Default pagination (per=25) // 1000 shipments = 40 API calls // GOOD: Max pagination (per=100) // 1000 shipments = 10 API calls (75% reduction) const shipments = await flexport('/shipments?per=100&page=1'); ``` ### Strategy 3: Cache with Smart TTLs | Data Type | Change Frequency | Cache TTL | Impact | |-----------|-----------------|-----------|--------| | Products | Rarely | 1 hour | ~95% fewer calls | | Shipment list | Every few hours | 5 minutes | ~90% fewer calls | | Shipment detail | On milestones | Until webhook | ~99% fewer calls | | Purchase orders | Daily | 15 minutes ...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category