Local Development
Mock Servers
Run JustKalm API locally without network calls. Use our OpenAPI specification with Prism, WireMock, or MSW for offline development and testing.
Mock Server Options
Setup Guides
Prism OpenAPI Mock Server
# Install Prism CLI
npm install -g @stoplight/prism-cli
# Download JustKalm OpenAPI spec
curl -o justkalm-openapi.yaml https://api.justkalm.com/openapi.yaml
# Start mock server on port 4010
prism mock justkalm-openapi.yaml --port 4010
# Now make requests to localhost:4010
curl http://localhost:4010/v2/valuate \
-H "Authorization: Bearer any-token" \
-d '{"url": "https://example.com/product"}'
# Returns dynamically generated mock data matching OpenAPI schemaContract Testing
Pact Contract Test
// contract.test.ts - Pact contract testing
import { PactV4 } from '@pact-foundation/pact';
const provider = new PactV4({
consumer: 'MyApp',
provider: 'JustKalmAPI',
});
describe('JustKalm API Contract', () => {
it('valuates a product URL', async () => {
await provider
.addInteraction()
.given('a valid product URL')
.uponReceiving('a valuation request')
.withRequest({
method: 'POST',
path: '/v2/valuate',
headers: { 'Content-Type': 'application/json' },
body: { url: 'https://example.com/product' },
})
.willRespondWith({
status: 200,
headers: { 'Content-Type': 'application/json' },
body: {
id: like('val_abc123'),
price_min: like(1000),
price_max: like(1500),
confidence: like(95),
},
})
.executeTest(async (mockServer) => {
const response = await fetch(`${mockServer.url}/v2/valuate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://example.com/product' }),
});
expect(response.ok).toBe(true);
});
});
});Why Use Mock Servers?
Faster Development
No network latency. Instant responses. Work offline without internet connectivity.
Deterministic Tests
Consistent responses every time. No flaky tests due to network issues or API changes.
Edge Case Testing
Easily simulate errors, timeouts, and rate limits that are hard to trigger in production.
CI/CD Integration
Run integration tests in CI without API access. No rate limits or authentication needed.
Develop Offline
Download our OpenAPI spec and start mocking locally in minutes.