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

# Nitro

> Integrate Nile Auth with Nitro applications

This guide will help you get started with Nile Auth and Nitro. This guide outlines the steps required to configure and integrate authentication in your application. This guide uses the `Nuxt` layouts, and can be adjusted for any `Nitro` application

<Note>
  If you have not done so yet, be sure you have [obtained credentials from the
  console](../getting-started/installation).
</Note>

<Steps>
  <Step title="Install packages">
    <CodeGroup>
      ```bash npm theme={null}
        npm install @niledatabase/server @niledatabase/nitro
      ```

      ```bash yarn theme={null}
        yarn add @niledatabase/server @niledatbase/nitro
      ```

      ```bash pnpm theme={null}
        pnpm add @niledatabase/server @niledatabase/nitro
      ```
    </CodeGroup>
  </Step>

  <Step title="Configure the extension">
    Create the base nile instance, extended with the nitro plugin

    ```ts app/composables/useNile.ts theme={null}
    import { Nile } from "@niledatabase/server";
    import { nitro } from "@niledatabase/nitro";
    import type { withNitro } from "@niledatabase/nitro";

    export const nile = Nile<withNitro>({
      debug: true,
      extensions: [nitro],
    }));

    ```
  </Step>

  <Step>
    Add the route so that the APIs can be handled `ts server/api/[...slug].ts
          import {nile} from "~/composables/useNile"; export default
          defineEventHandler(nile.handlers); `
  </Step>
</Steps>

## The extension

Under the hood, the nitro extension does the following reconfigures `handlers` to use the h3 callbacks, vs the default. The default method calls are still handled the same way internally, it only modifies the base call.

For instance, the calls on the server-side will still need to have their context set.

```ts theme={null}
import { nile } from '~/composables/useNile';

const serverFunction = (event) => {
  const ctxNile = nile.withContext({ headers: event.headers });
  const userTenants = await ctxNile.tenants.list();
};
```
