> For the complete documentation index, see [llms.txt](https://docs.tmc.bj/v2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tmc.bj/v2/guides/kuzzle.md).

# Kuzzle

## KaaS (Kuzzle as a Service)

<figure><img src="/files/f7UOsu9dRSmcElxtWkFL" alt=""><figcaption></figcaption></figure>

If you'd rather focus on your development and community rather than the infrastructure required for Kuzzle then TMC offers Kuzzle as a Service. You can purchase this on our [services store](https://billing.tmc.bj/store/services/kuzzle). We'll handle the hosting, upkeep and maintenance whilst you can focus on building the best community you can.

## Self Hosting

### Prerequisites

* Fully configured [Kuzzle instance](https://docs.kuzzle.io/core/2/guides/getting-started/run-kuzzle/)
* Admin access to your [Kuzzle Admin Console](https://console.kuzzle.io)
* An index to add the collections to
* A copy of our [default collections](https://git.tmc.bj/BanHammer/kuzzle-collection-mappings) downloaded

### Guide

Navigate to the index you want to create collections in. Click "Create a Collection" then follow the steps below.

![step-by-step](https://share.tmc.bj/UxeFDJ/direct.png)

1. Enter the name of the collection. This should match the name of the file you are importing. I.e. `dispatch_calls.json` becomes `dispatch_calls`.
2. Browse to and select the json file for this collection.
3. Click "Create".

Repeat these steps for each collection.

### Server User

* You must create a server profile & user that has access to the Kuzzle index and has permission to create users.
* You must create a profile for each user that only has access to read/write to the relevant indexes.
  * This profile should be able to list, get, update and delete from each collection.
  * This profile should have special permissions to use `mDelete` on the `notifications` collection.
  * This profile should have special permissions to `mGet` on the `racing_profiles`, `racing_users`, `racing_tracks`, `burner_boards` & `mdt_crimes` collections.
* Once this has been set up you can [create an API key](https://docs.kuzzle.io/core/2/api/controllers/security/create-api-key/) for your server user.

## TMC Core Configuration

### Server Config

You can then proceed to fill in your `core/config.server.lua`

{% hint style="warning" %}
If your config contains `GetConvar` and `GetConvarInt` you will need to add/set the relevant convar's in your server config. If you used the TMC recipe these will be in the `sv_pre.cfg`.
{% endhint %}

```lua
Config.Server.Kuzzle = {
    Host = '', -- The host of your kuzzle server.
    Port = 443, -- The port of your kuzzle server.
    Ssl = true, -- True/False depending on if you are using SSL.
    Index = '', -- The name of the index of your kuzzle server.
    SecretKey = '', -- The api key you generated above.
    PlayerProfileName = '' -- The profile name you created for each user. Ensure this only has the specified permissions.
}
```
