Development
Start the client dev server usingpnpm dev:client and API / game servers with pnpm dev:server,
or traverse into client and server directories individually to run pnpm dev in each.
Database and accounts
Accounts are optional, they require a PostgreSQL database, to disable them adddatabase: { enabled: false } to survev-config.hjson.
After installing PostgreSQL, start the service and create a database:
sudo -u postgres initdb --locale=C.UTF-8 --encoding=UTF8 -D /var/lib/postgres/data --data-checksums
systemctl enable --now postgresql.service
sudo -u postgres createuser survev
sudo -u postgres createdb survev -O survev
Then populate the database with the schema:
cd server
Run this everytime you make changes to schema.ts.
pnpm run db:generate
pnpm run db:migrate
Start the server
pnpm run dev
or
pnpm run dev:api
pnpm run dev:game
To interact with the database through an interface:
pnpm run db:studio
To wipe the database and start over:
# Set database permissions.
sudo -u postgres psql -c "ALTER USER survev WITH PASSWORD 'survev';"
Wipe database.
pnpm run db:wipe
NOTE: Do not run this in production!
Caching
Caching is disabled by default. SetcachingEnabled to true in config.ts to use it.
Install Redis:
sudo apt install redis-server
Ensure Redis starts on boot and is running:
systemctl enable --now redis-server