-
Notifications
You must be signed in to change notification settings - Fork 0
Storage Backends
This page explains the available storage backends in Coffers and Coffers Legacy, when to use each one, and what to consider before choosing a storage mode.
Coffers supports three storage backend types:
yamlsqlitemysql
These are available in both:
Coffers.jarCoffers-Legacy.jar
The active backend is selected through the config:
storage:
type: yamlYour storage backend determines:
- where balances are saved
- where transaction history is stored
- how easy the plugin is to manage
- how well the economy setup fits a small server versus a larger deployment
Choosing the right backend depends on your server size, infrastructure, and how much persistence and flexibility you need.
YAML is the simplest storage option.
It stores balances and history in local configuration files inside the plugin data folder.
Modern line example:
storage:
type: yaml
yaml:
accounts-file: accounts.yml
history-file: history.ymlLegacy line example:
storage:
type: yaml
yaml:
accounts-file: legacy-accounts.yml
history-file: legacy-history.yml- small servers
- simple installations
- administrators who want the least setup work
- local-only economy storage
- easiest to set up
- no SQL server required
- simple file-based storage
- good for smaller communities or test servers
- not ideal for larger deployments
- less structured than SQL storage
- file-based storage is not the best fit for complex scaling needs
SQLite stores data in a local database file on the server.
Modern line example:
storage:
type: sqlite
sqlite:
file: coffers.dbLegacy line example:
storage:
type: sqlite
sqlite:
file: coffers-legacy.db- single-server production use
- admins who want more structured persistence without running MySQL
- servers that need a stronger storage format than YAML
- local database storage
- no external database server required
- cleaner structure than flat file storage
- very good option for one-server setups
- still local to one machine
- not the right fit for shared multi-server database setups
MySQL is intended for larger setups or environments that want shared SQL storage.
Modern line example:
storage:
type: mysql
mysql:
host: localhost
port: 3306
database: coffers
username: root
password: change-me
parameters: useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTCLegacy line example:
storage:
type: mysql
mysql:
host: localhost
port: 3306
database: coffers_legacy
username: root
password: change-me
parameters: useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC- larger servers
- advanced administrators
- environments that already use MySQL
- shared or centralized data infrastructure
- structured SQL persistence
- suitable for larger environments
- better fit for central database management
- requires database setup and credentials
- more moving parts than YAML or SQLite
- configuration mistakes can prevent startup
Recommended backend:
yaml
Why:
- simple
- quick to configure
- no database setup required
Recommended backend:
sqlite
Why:
- stronger persistence than YAML
- no external database required
- good middle ground for many servers
Recommended backend:
mysql
Why:
- better for central database management
- better fit for more advanced deployments
The selected backend stores not only balances, but also account history.
This includes:
- account balances per currency
- recent ledger entries
- transaction audit metadata
The amount of history retained per account is controlled separately through:
history:
max-per-account: 50If you change storage type after using Coffers for a while, keep in mind:
- existing data does not automatically move unless you migrate it yourself
- you should back up your current data before changing storage mode
- switching from one backend to another without planning may make old balances appear missing
Best practice:
- stop the server
- back up the current Coffers data
- change the storage type in config
- move or import data if needed
- restart and verify balances
Avoid these common storage setup problems:
- using MySQL without valid credentials
- changing storage mode without backing up existing data
- assuming YAML, SQLite, and MySQL share data automatically
- forgetting that modern and legacy lines use different default file names and database names
The storage model is similar between both lines, but the defaults differ slightly.
Examples:
- modern YAML files use names like
accounts.ymlandhistory.yml - legacy YAML files use names like
legacy-accounts.ymlandlegacy-history.yml - modern SQLite defaults to
coffers.db - legacy SQLite defaults to
coffers-legacy.db - modern MySQL defaults to the
coffersdatabase name - legacy MySQL defaults to the
coffers_legacydatabase name
If you want the simplest possible setup:
- use
yaml
If you want the best local production choice for one server:
- use
sqlite
If you want a larger or more advanced deployment:
- use
mysql