Skip to main content

Frontend API Usage

This section tracks where backend APIs are consumed across our React web application.

For every API, frontend developers document:

  1. Where it is used: The page route, UI modal/component, and file path.
  2. What it is used for: The specific user action, feature, or data display it powers.
  3. Quick Example: A simple snippet showing the React hook or component call.

Documenting an API

When adding frontend documentation for an API, follow this simple format:

# [Feature / Action Name]

- **API Endpoint**: `POST /api/your-endpoint`
- **Page Route**: `/admin/dashboard`
- **Component File**: `src/features/dashboard/components/DashboardWidget.tsx`
- **Used For**: Displays total monthly revenue stats on the main admin overview.

### React Usage Example
\`\`\`tsx
const { data, isLoading } = useQuery({
queryKey: ['revenue'],
queryFn: () => apiClient.get('/api/revenue'),
});
\`\`\`