Database settings
If the recovery tools cannot be used (for example the API does not start), you can connect to the database directly. The settings are in the .env file in the SnailyCAD root folder. Never share these values.
| Parameter | Variable(s) | Example |
|---|---|---|
| Database name | DATABASE_URL / DB_NAME | snaily-cad-v4 |
| Username | DATABASE_URL / DB_USER | snailycad |
| Password | DATABASE_URL / DB_PASSWORD | <your password> |
| Host | DATABASE_URL / DB_HOST | localhost |
| Port | DATABASE_URL / DB_PORT | 3306 |
Prisma (the API) only reads DATABASE_URL. Its format is mysql://USER:PASSWORD@HOST:PORT/DB_NAME (MySQL 8.0+ or MariaDB 10.6+). In the default .env it is built from DB_USER, DB_PASSWORD, DB_HOST, DB_PORT and DB_NAME, so if you change one of those, make sure DATABASE_URL still matches (or write the values directly into DATABASE_URL).
mysql -u snailycad -p -h localhost -P 3306 snaily-cad-v4 # MariaDB: mariadb -u snailycad -p -h localhost -P 3306 snaily-cad-v4
Locating, rotating and replacing the token
- Locate: on the API server, run cat apps/api/.recovery-token from the SnailyCAD folder. The exact absolute path is shown on the admin dashboard for the owner. Set RECOVERY_TOKEN_FILE in .env to use another location.
- Rotate: as the owner, open the admin dashboard and click "Rotate token". The new token is shown once and replaces the old one immediately.
- Replace: if you cannot log in, delete apps/api/.recovery-token and apps/api/.recovery-token.json and restart the API. A new token is generated, and you can read it from the file.
Full guide: sh/docs/RECOVERY.md