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

# OneSDK Quickstart Guide

> OneSDK provides two implementation approaches to match your technical requirements and customization needs.

## Technical Requirements

<CardGroup cols={2}>
  <Card title="Frontend Knowledge" icon="code">
    * Frontend frameworks (React, Vue, Angular)
    * NPM
  </Card>

  <Card title="Dev Environment" icon="gear">
    * Node.js 18+
    * TypeScript 5+
  </Card>
</CardGroup>

## Getting Started

<Callout icon="bell" color="#FFCA16" iconType="regular">
  Always use environment-specific credentials and never commit API keys to version control.
</Callout>

<Steps>
  <Step title="Obtain Your Credentials">
    You'll need the following for both UAT and Production:

    ```plaintext theme={null}
    - Customer ID
    - API Keys
    ```

    <Callout icon="thumbtack" color="#1A6CFF" iconType="regular">
      Don't have credentials? Contact [FrankieOne Support <Icon icon="arrow-up-right-from-square" size={12} />](mailto:support@frankieone.com) to get started.
    </Callout>
  </Step>

  <Step title="Get OneSDK on your Web App">
    Our SDK supports two integration methods to fit your development workflow, using CDN and NPM.

    <Tabs>
      <Tab title="Implementation with CDN">
        Use this method if you're working with plain HTML/JavaScript or as a fallback if you're having issues with NPM integration.

        Just include the following script tag in your HTML file:

        <CodeGroup>
          ```html theme={null}
          <html>
            <head>
              <script src="https://assets.frankiefinancial.io/one-sdk/v1/oneSdk.umd.js">
              </script>
            </head>
          </html>
          ```
        </CodeGroup>
      </Tab>

      <Tab title="Implementation with NPM package">
        <CodeGroup>
          ```bash npm theme={null}
          npm install @frankieone/one-sdk
          ```

          ```bash yarn theme={null}
          yarn add @frankieone/one-sdk
          ```
        </CodeGroup>
      </Tab>
    </Tabs>
  </Step>
</Steps>

<Panel>
  ##### Quick Integration Example

  <Callout icon="bell" color="#FFCA16" iconType="regular">
    Note: The sample code below is just an example. **Never generate tokens on the frontend** — doing so can expose your credentials.
    Always generate tokens securely on your backend and pass them to your app as needed.
  </Callout>

  <CodeGroup>
    ```typescript A basic implementation of the OCR component theme={null}
    import OneSdk from '@frankieone/one-sdk';

    const tokenResultRaw = await fetch(
      'https://backend.kycaml.uat.frankiefinancial.io/auth/v2/machine-session',
      {
        method: 'POST',
        headers: {  // Encode credentials as base64 for authorization header
          authorization: 'machine ' + btoa(`${CUSTOMER_ID}:${API_KEY}`),
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          permissions: {
            preset: 'one-sdk',
            // You can pass either your own unique customer reference
            // or if entity already created/existed, you can pass its ID here
            reference: "customer-reference",
            entityId: "abc-def-ghi"
          },
        }),
      }
    );

    // Initialize OneSDK with configuration
    const oneSdk = await OneSdk({ // Pass the auth token response
      session: tokenResultRaw,    // Set environment mode
      mode: "production",
      recipe: {
        ocr: {
          maxDocumentCount: 3,    // Allow up to 3 document scans
        }
      }
    });
    ```
  </CodeGroup>

  <Callout icon="check" color="#3DD892" iconType="regular">
    Visit our [npm package page](https://www.npmjs.com/package/@frankieone/one-sdk) for the latest version and detailed API documentation.
  </Callout>
</Panel>
