# Installing the framework

Add the package to an AdonisJS application (Node.js version as required by your Adonis major):

```bash
npm install @akago/akago_backend
```

The published artifact exposes compiled JavaScript under `dist/` (see `package.json` `exports`). TypeScript consumers should resolve types from the package as published.

## Import entrypoint (`imports`)

You must load the framework’s **side-effect** entry module so type inferences, Auth middleware augmentations, bundled config hooks, and Japa helpers are registered.

The recommended place is your app’s **`adonisrc.ts`**

```typescript
import '@akago/akago_backend/imports'
...
```

## Environment variables

You **must** provide every environment variable expected by the stack; otherwise the app will fail validation at startup.

The authoritative list (required vs optional, types, formats) lives in [`env.ts`](../env.ts) at the root of this repository. Use it as the checklist when creating `.env` (or your deployment secrets) in the **host** application that wires Akago—not every key may apply if you fork or subset the framework, but the schema documents what this codebase expects when used as-is.

## Lucid migrations (user & device token)

Auth and event modules need user & device tokens. Here are the `up()` definition of lucid migration that are expecte :

- **User:** 
```typescript
import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
  async up() {
    this.schema.createTable('users', (table) => {
      table.uuid('id').primary().defaultTo(this.raw('uuid_generate_v4()'))
      table.boolean('is_admin').defaultTo(false)
      table.string('email', 254).notNullable().unique()
      table.dateTime('created_at').notNullable()
      table.dateTime('updated_at').nullable()
      table.dateTime('disabled_at')
      table.index('disabled_at') // recommended
      table.text('disabled_reason')
    })
  }
}
```

- **Device token:** 

```typescript
import { BaseSchema } from '@adonisjs/lucid/schema'

export default class extends BaseSchema {
  async up() {
    this.schema.createTable('device_tokens', (table) => {
      table.uuid('id').primary().defaultTo(this.raw('uuid_generate_v4()'))
      table.dateTime('created_at').notNullable()
      table.dateTime('updated_at').nullable()
      table.uuid('user_id').references('users.id').notNullable().onDelete('CASCADE')
      const enumValues = ['web']
      table.enu('type', enumValues, {
        useNative: true,
        enumName: 'network_token_type',
      })
      table.string('token').notNullable().unique()
    })
  }
}
```


## Peer expectations

Akago targets **AdonisJS v7**-style apps and related packages (auth, Lucid, mail, drive, etc.). Align your host app’s dependencies with the versions declared in this package’s `package.json` to avoid subtle incompatibilities.
