Framework Integrations

This section provides detailed guides for integrating SpecJet CLI with popular frontend frameworks and development environments.

Available Integrations

  • Node.js - Use SpecJet with Node.js applications and servers
  • React - Complete guide for React applications with hooks and patterns
  • Vue.js - Integration with Vue 3 Composition API and best practices

Common Integration Patterns

Environment-Based API URLs

All framework integrations support switching between mock and production APIs:

const api = new ApiClient(
  process.env.NODE_ENV === 'development'
    ? 'http://localhost:3001'  // Mock server
    : process.env.API_URL      // Production API
);

Type Safety

Every integration maintains full TypeScript type safety:

import { User, CreateUserRequest } from './src/types/api';

const user: User = await api.getUser(1);
const newUser: CreateUserRequest = { name: 'John', email: 'john@example.com' };

Error Handling

Consistent error handling across all frameworks:

try {
  const users = await api.getUsers();
} catch (error) {
  // Handle API errors
  console.error('API Error:', error.message);
}

For detailed framework-specific examples, select your framework from the navigation sidebar.


Table of contents


Copyright © 2025 SpecJet. Open source CLI for API contract development.