| name | flexport-local-dev-loop |
| description | Configure Flexport local development with mock API responses and testing.
Use when setting up a development environment, creating mock shipment data,
or establishing a fast iteration cycle for Flexport logistics integration.
Trigger: "flexport dev setup", "flexport local development", "flexport mock API".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","logistics","flexport"] |
| compatibility | Designed for Claude Code |
Flexport Local Dev Loop
Overview
Set up a fast, reproducible local development workflow for Flexport integrations. Since Flexport has no official SDK, the dev loop centers on a typed HTTP client wrapper with mock responses for testing.
Instructions
Step 1: Project Structure
flexport-integration/
├── src/
│ ├── flexport/
│ │ ├── client.ts # Typed Flexport API client
│ │ ├── types.ts # API response types
│ │ └── mock-data.ts # Test fixtures
│ └── index.ts
├── tests/
│ ├── flexport.test.ts # Unit tests with mocks
│ └── integration.test.ts # Live API tests (CI only)
├── .env.local # Local secrets (git-ignored)
├── .env.example
└── package.json
Step 2: Typed Client Wrapper
interface FlexportShipment {
id: string;
status: 'booked' | 'in_transit' | 'arrived' | 'delivered';
freight_type: 'ocean' | 'air' | 'trucking';
origin_port: { code: string; name: string };
destination_port: { code: string; name: string };
cargo_ready_date: string;
estimated_arrival_date: string;
}
interface FlexportResponse<T> {
data: { records: T[]; total_count: number };
}
export class FlexportClient {
base = ;
: <, >;
() {
. = {
: ,
: ,
: ,
};
}
(page = , per = ): <<>> {
res = (, {
: .,
});
(!res.) ();
res.();
}
}