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

# Database & Storage Configuration for PerPlayerKit

> Configure PerPlayerKit's storage backend. Choose from SQLite, MySQL, PostgreSQL, or Redis to match your server's scale and infrastructure.

PerPlayerKit persists all kit data — inventory contents, enderchest snapshots, and player associations — in a database. You choose the storage backend inside `config.yml` under the `storage` key. For a single-server setup the built-in SQLite driver requires zero external services and is ready immediately after installation. If you run a network of servers that share kit data, switch to MySQL, PostgreSQL, or Redis to give every node access to the same persistent store.

## Choosing a Backend

<CardGroup cols={2}>
  <Card title="SQLite" icon="database">
    **Recommended for single servers.** Stores all data in a local file — no database server needed. Zero configuration beyond setting the type.
  </Card>

  <Card title="MySQL / MariaDB" icon="server">
    **Recommended for multi-server networks.** A widely supported relational database that all your nodes can read from and write to simultaneously.
  </Card>

  <Card title="PostgreSQL" icon="server">
    **Recommended for multi-server networks.** A powerful open-source relational database. Use this if your infrastructure already runs Postgres.
  </Card>

  <Card title="Redis" icon="bolt">
    **High-performance distributed setups.** An in-memory data store suited for networks that need extremely fast read/write throughput.
  </Card>
</CardGroup>

<Warning>
  The `yml` (YAML) storage type writes kit data to flat files on disk. It exists only for development and quick testing — **do not use it in a production environment.** It does not scale, offers no query capability, and can corrupt data under concurrent load.
</Warning>

## Configuration

Set `storage.type` to the backend you want, then fill in the corresponding credentials block. You only need to populate the section that matches your chosen type — all other credential blocks are ignored.

<Tabs>
  <Tab title="SQLite">
    SQLite requires no additional credentials. Set the type and you're done.

    ```yaml config.yml theme={null}
    storage:
      type: "sqlite"
    ```
  </Tab>

  <Tab title="MySQL">
    ```yaml config.yml theme={null}
    storage:
      type: "mysql"

    mysql:
      host: "localhost"
      port: "3306"
      dbname: "kitdatabase"
      username: "username"
      password: "pa55w0rd"
      useSSL: false
      maximumPoolSize: 10
    ```
  </Tab>

  <Tab title="PostgreSQL">
    ```yaml config.yml theme={null}
    storage:
      type: "postgresql"

    postgresql:
      host: "localhost"
      port: "5432"
      dbname: "kitdatabase"
      username: "username"
      password: "pa55w0rd"
      useSSL: false
      maximumPoolSize: 10
    ```
  </Tab>

  <Tab title="Redis">
    ```yaml config.yml theme={null}
    storage:
      type: "redis"

    redis:
      host: "localhost"
      port: 6379
      password: "pa55w0rd"
    ```
  </Tab>
</Tabs>

## Configuration Reference

### Common Fields (MySQL & PostgreSQL)

<ParamField path="host" type="string" required>
  The hostname or IP address of your database server. Use `localhost` if the database runs on the same machine as your Minecraft server.
</ParamField>

<ParamField path="port" type="string" required>
  The port the database server listens on. Defaults are `3306` for MySQL and `5432` for PostgreSQL.
</ParamField>

<ParamField path="dbname" type="string" required>
  The name of the database (schema) PerPlayerKit will use. Create this database in advance and grant your user the necessary permissions.
</ParamField>

<ParamField path="username" type="string" required>
  The database user PerPlayerKit authenticates as. Grant this user `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and `CREATE TABLE` privileges on the target database.
</ParamField>

<ParamField path="password" type="string" required>
  The password for the database user. Store your `config.yml` securely and restrict file permissions so this value is not exposed.
</ParamField>

<ParamField path="useSSL" type="boolean" default="false">
  Set to `true` to require an encrypted TLS connection between PerPlayerKit and the database server. Recommended for any database not running on `localhost`.
</ParamField>

<ParamField path="maximumPoolSize" type="integer" default="10">
  The maximum number of connections HikariCP will open to the database. Increase this value if you have a high player count and observe connection-wait timeouts in the logs.
</ParamField>

### Redis Fields

<ParamField path="host" type="string" required>
  The hostname or IP address of your Redis server.
</ParamField>

<ParamField path="port" type="integer" default="6379">
  The port Redis listens on. The default is `6379`.
</ParamField>

<ParamField path="password" type="string">
  The Redis `requirepass` password. Leave empty or omit if your Redis instance has no authentication configured.
</ParamField>

<Tip>
  If you need to move existing kit data from one backend to another — for example, migrating from SQLite to MySQL as your network grows — see the [Storage Migration guide](/guides/storage-migration) for step-by-step instructions.
</Tip>
