Skip to content

API



Skaya's AI-powered API generator streamlines backend-frontend integration with intelligent, context-aware scaffolding. Generate production-ready API endpoints within seconds.

API Generation Options

Skaya provides two API generation patterns:

  1. Redux-integrated APIs (with automatic state management)
  2. Direct APIs (simple request/response pattern)

Key Features

FeatureDescription
🚀 Rapid ScaffoldingGenerate complete API endpoints with 1 command
🔄 Dual ModeRedux-integrated or direct API patterns
🔐 Auth-ReadyAuto-generated auth headers and token handling
📦 Centralized ConfigUnified endpoint management in apiEndpoints.ts
🧩 Modular DesignIsolated API modules for better maintainability
📊 TypeScript FirstFull type definitions for requests/responses
⚡ Auto-SyncKeep frontend and backend types in sync

Every Api includes:

  • Core apiEndpoint file to store endpoint detials
  • backend Request integration for calling backend

Creating Components

Interactive Mode

bash
skaya create
# Follow the interactive prompts

Direct Generation

bash
skaya create api --project frontend --filename Profile

Quick Start with npx

bash
npx skaya api component -p frontend -f Profile

Example Workflow

1: Initiate Creation

bash
skaya create

2: Configuration

bash
 Select project type: frontend  
 Select component type: api  
 Enter filename (without extension): Profile  
 Enter folder path: myapp/src/apis

3. API Type Selection

bash
? Select API type:
 API with Redux
  API without Redux

 Select API type: API with Redux

4. API Specification

bash
? Enter API ID: 45
 Enter API ID: 45

? Does this endpoint require auth? (Y/n) y
 Does this endpoint require auth? Yes

? Enter the API URL: /profile
 Enter the API URL: /profile

? Select the HTTP method:
 GET
  POST
  PUT
  PATCH
  DELETE

 Select the HTTP method: GET

5. File Generation Output

bash
store doesn't exist creating one
Backend API Call added: /.../src/apis/backendRequest.ts
✅ api file created at /.../src/apis/redux/store.tsx
✅ api file created at /.../src/apis/redux/storeProvider.tsx
✅ api file created at /.../src/apis/Profile/index.ts
✅ api file created at /.../src/apis/apiEndpoints.ts

apiEndpoints.ts storing all endpoints data

typescript
export const ApiEndpoint = {
  PROFILE: {
    apiId: 101,
    withAuth: false,
    url: "v1/profile",
    method: "GET"
  }
};

Redux API Implementation

File Structure

bash
src/apis/  
├── Profile/  
   └── index.ts          # Redux slice definition  
├── redux/  
   ├── store.ts  
   └── storeProvider.tsx  
├── apiEndpoints.ts  
└── backendRequest.ts

Direct API Implementation

File Structure

bash
src/apis/  
├── apiEndpoints.ts  
└── backendRequest.ts

Usage Examples

Redux API Usage

typescript
const dispatch = useAppDispatch();
const { loading, error } = fetchProfileData(state => state.auth);

const handleLogin = () => {
  dispatch(loginUser({ email, password }));
};

Direct API Usage

typescript
const loadData = async () => {
  try {
    const response = Request({
    endpointId: 'PROFILE',
    slug: userId
  });
    setProfile(response.data);
  } catch (error) {
    console.error('Fetch failed:', error);
  }
};

Feature Comparison

FeatureRedux APIDirect API
State ManagementBuilt-inManual
ComplexityHigherLower
Best ForGlobal stateLocal component data

Best Practices

  1. Use Redux APIs for:

    • Authentication flows
    • App-wide settings
    • Frequently accessed data
  2. Use Direct APIs for:

    • Form submissions
    • One-time data fetches
    • Simple component data
  3. Always:

    • Keep endpoint definitions centralized
    • Implement consistent error handling
    • Type all request/response payloads