open-index/open-npm huggingface dataset:
npm package: @sawa-dev/sdk
Description: 💍 Backend API for Sawa - A marriage-focused relationship platform for Egypt & the Middle East. Built with Next.js 16+, MongoDB, Socket.io, and intelligent matching algorithms.
Author: Yousif Abozid
Latest version: 1.0.11

# @sawa-dev/sdk

TypeScript SDK for Sawa Backend API - A marriage-focused relationship platform for Egypt & the Middle East.

## Installation

```bash
npm install @sawa-dev/sdk @tanstack/react-query axios
```

## Quick Start

### 1. Setup React Query Client

```tsx
// app/providers.tsx
'use client';

import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useState } from 'react';

export function Providers({ children }: { children: React.ReactNode }) {
  const [queryClient] = useState(() => new QueryClient());

  return (
    <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
  );
}
```

### 2. Configure API Base URL

```tsx
// lib/api-config.ts
export const API_CONFIG = {
  baseURL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000',
};
```

### 3. Use SDK Hooks

```tsx
// components/auth/LoginForm.tsx
import { useLoginMutation } from '@sawa-dev/sdk';

export function LoginForm() {
  const loginMutation = useLoginMutation();

  const handleLogin = async (email: string, password: string) => {
    try {
      const result = await loginMutation.mutateAsync({
        data: { email, password },
      });

      if (result.success) {
        localStorage.setItem('token', result.data.token);
        // Redirect or update auth state
      }
    } catch (error) {
      console.error('Login failed:', error);
    }
  };

  return (
    <form
      onSubmit={e => {
        e.preventDefault();
        const formData = new FormData(e.target);
        handleLogin(
          formData.get('email') as string,
          formData.get('password') as string
        );
      }}
    >
      <input name="email" type="email" required />
      <input name="password" type="password" required />
      <button type="submit" disabled={loginMutation.isPending}>
        {loginMutation.isPending ? 'Logging in...' : 'Login'}
      </button>
    </form>
  );
}
```

## Available Hooks

### Authentication

- `useLoginMutation()` - User login
- `useSignupMutation()` - User registration

### Profile

- `useGetProfile()` - Get current user profile
- `useUpdateProfileMutation()` - Update user profile
- `useCompleteProfileMutation()` - Complete profile setup

### Discovery

- `useGetDiscoveryFeed()` - Get discovery feed
- `useLikeUserMutation()` - Like a user

### Matches

- `useGetMatches()` - Get user matches

### Verification

- `useSubmitVerificationMutation()` - Submit ID verification

## Configuration

The SDK automatically handles:

- Authentication token management
- Request/response interceptors
- Error handling
- TypeScript types

## License

MIT