# Quickstart

### Installation <a href="#installation" id="installation"></a>

Install Authora using your package manager of your choice.

```
npm install authora
```

### Initialize Authora <a href="#initialize-lucia" id="initialize-lucia"></a>

Import `Authora` and initialize it with your adapter(if you are using session). Refer to the [Database](https://lucia-auth.com/database) page to learn how to set up your database and initialize the adapter. Make sure you configure the `sessionCookie/JWT` option and register your `Authora` instance type.

<pre class="language-typescript"><code class="lang-typescript">import { Authora } from "authora";

const adapter = new BetterSQLite3Adapter(db); // your adapter

<a data-footnote-ref href="#user-content-fn-1">// for sessions</a>
export const authora = new Authora(adapter, {
	sessionCookie: {
		attributes: {
			// set to `true` when using HTTPS
			secure: process.env.NODE_ENV === "production"
		}
	}
});

<a data-footnote-ref href="#user-content-fn-2">// for jwt</a>
export const authora = new Authora({
  useJWT: true,
  jwtSecret: process.env.JWT_SECRET,
  // the jwt option can be overide later
  jwtOptions: {
    signOptions: {
      expiresIn: '1h'
    }
  }
});

// IMPORTANT!
declare module "authora" {
	interface Register {
		Authora: typeof authora;
	}
}
</code></pre>

### Polyfill <a href="#polyfill" id="polyfill"></a>

If you're using Node.js 18 or below, you'll need to polyfill the Web Crypto API. This is not required in Node.js 20, CloudFlare Workers, Deno, Bun, and Vercel Edge Functions. This can be done either by importing `webcrypto`, or by enabling an experimental flag.

```typescript
import { webcrypto } from "node:crypto";

globalThis.crypto = webcrypto as Crypto;
```

```
node --experimental-web-crypto index.js
```

[^1]: Session

[^2]: JWT


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rou-technology.gitbook.io/authora-docs/getting-started/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
