> ## Documentation Index
> Fetch the complete documentation index at: https://core.anylayer.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration Patterns

> Common patterns for integrating ZKScore into your application

## Overview

This guide presents common integration patterns for ZKScore, including authentication flows, score displays, achievement tracking, and trust verification.

## Pattern 1: Authentication Flow

<CodeGroup>
  ```javascript JavaScript theme={null}
  async function authenticateWithZKScore(walletAddress) {
    // Get user's ZKS ID
    const identity = await zkScore.getIdentity(walletAddress);
    
    // Get score
    const score = await zkScore.getScore(walletAddress);
    
    // Check minimum requirements
    if (score.total < 100) {
      throw new Error('Minimum score not met');
    }
    
    // Create session
    return createSession({
      address: walletAddress,
      zksId: identity.name,
      score: score.total
    });
  }
  ```
</CodeGroup>

## Pattern 2: Real-time Score Display

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { useScore } from '@zkscore/sdk-react';

  function ScoreDisplay({ identity }) {
    const { data: score, loading } = useScore(identity, { realTime: true });
    
    if (loading) return <div>Loading...</div>;
    
    return <div>Score: {score?.total || 0}</div>;
  }
  ```
</CodeGroup>

## Best Practices

1. **Caching**: Cache scores to reduce API calls
2. **Real-time Updates**: Use WebSocket for live data
3. **Error Handling**: Handle all edge cases
4. **User Experience**: Provide clear feedback

## Related Documentation

* [JavaScript SDK](/sdk/javascript/getting-started)
* [React SDK](/sdk/react/getting-started)
