Recovery tools

Use these tools if you (or the CAD owner) are locked out. They change the CAD database directly and require the recovery token stored on the server. Back up your database before making changes.

The token is stored on the API server in the file apps/api/.recovery-token (readable only by the user running SnailyCAD). It is never sent by email or shown in logs.

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.

ParameterVariable(s)Example
Database nameDATABASE_URL / DB_NAMEsnaily-cad-v4
UsernameDATABASE_URL / DB_USERsnailycad
PasswordDATABASE_URL / DB_PASSWORD<your password>
HostDATABASE_URL / DB_HOSTlocalhost
PortDATABASE_URL / DB_PORT3306

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

Back to login