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

# Quickstart

> Get started with Gately in under 5 minutes

## Create Your Project

<Steps>
  <Step title="Sign Up">
    Create a free account at [usegately.com/signup](https://usegately.com/signup) and create your first project.
  </Step>

  <Step title="Get Your Project ID">
    Navigate to **Settings > General** to find your Project ID. You'll need this to initialize the SDK.
  </Step>

  <Step title="Install the SDK">
    Add Gately to your website using one of the methods below.
  </Step>
</Steps>

## Installation

<Tabs>
  <Tab title="Script Tag">
    Add this script to your HTML `<head>` tag:

    ```html theme={null}
    <script 
      src="https://cdn.usegately.com/gately.min.js" 
      data-project-id="YOUR_PROJECT_ID"
      defer
    ></script>
    ```

    The SDK will automatically initialize and be available as `window.Gately`.
  </Tab>

  <Tab title="NPM">
    Install the package:

    ```bash theme={null}
    npm install gately
    ```

    Initialize in your code:

    ```javascript theme={null}
    import { GatelyClient } from 'gately'

    const gately = new GatelyClient('YOUR_PROJECT_ID')
    ```
  </Tab>

  <Tab title="React">
    Install the package:

    ```bash theme={null}
    npm install gately
    ```

    Wrap your app with the provider:

    ```jsx theme={null}
    import { GatelyProvider } from 'gately'

    function App() {
      return (
        <GatelyProvider projectId="YOUR_PROJECT_ID">
          <YourApp />
        </GatelyProvider>
      )
    }
    ```
  </Tab>
</Tabs>

## Basic Usage

### Check Authentication Status

```javascript theme={null}
// Check if user is logged in
if (gately.isAuthenticated()) {
  const user = gately.getUser()
  console.log('Welcome,', user.email)
} else {
  console.log('Please log in')
}
```

### Login a User

```javascript theme={null}
try {
  const { user, session } = await gately.login('user@example.com', 'password123')
  console.log('Logged in as:', user.email)
} catch (error) {
  console.error('Login failed:', error.message)
}
```

### Sign Up a New User

```javascript theme={null}
try {
  const { user, session } = await gately.signup('user@example.com', 'SecurePass123!', {
    full_name: 'John Doe'
  })
  console.log('Account created for:', user.email)
} catch (error) {
  console.error('Signup failed:', error.message)
}
```

### Social Login

```javascript theme={null}
// Login with Google
await gately.loginWithGoogle({
  redirectTo: '/dashboard'
})

// Login with GitHub
await gately.loginWithGithub({
  redirectTo: '/dashboard'
})
```

### Logout

```javascript theme={null}
await gately.logout()
console.log('User logged out')
```

## Protect Content

Add the `data-gately-protected` attribute to any element you want to protect:

```html theme={null}
<div data-gately-protected data-plan="premium">
  <h2>Premium Content</h2>
  <p>This content is only visible to premium members.</p>
</div>
```

The SDK will automatically hide this content from non-authenticated users or users without the required plan.

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="lock" href="/docs/authentication">
    Learn about all authentication options
  </Card>

  <Card title="SDK Reference" icon="book" href="/docs/sdk/introduction">
    Explore the full SDK documentation
  </Card>

  <Card title="API Reference" icon="code" href="/docs/api-reference/introduction">
    Build custom integrations with the API
  </Card>

  <Card title="Webhooks" icon="webhook" href="/docs/api-reference/webhooks/overview.mdx">
    Set up real-time event notifications
  </Card>
</CardGroup>
