title: Build & Deploy description: Build your Hatk server for production.#
hatk build#
Build the frontend for production using Vite.
hatk build
Compiles and bundles the SvelteKit frontend in app/ into optimized production assets.
Deployment#
To run in production:
-
Build the frontend:
hatk build -
Start the server:
hatk start -
Configure environment variables for production:
RELAY=wss://bsky.network \ DATABASE=data/hatk.db \ PORT=3000 \ hatk start
See Configuration for all available environment variables.
SQLite in production#
hatk uses SQLite for all data storage. The DATABASE environment variable sets the path to the database file. In production, make sure this path points to a persistent volume.
Railway#
Railway is a good fit for hatk apps. To deploy:
-
Push your project to a Git repository
-
Create a new Railway project linked to that repo
-
Add a persistent volume mounted at
/data -
Set environment variables:
DATABASE=/data/hatk.db RELAY=wss://bsky.network PORT=3000 -
Set the start command to
hatk start
Railway will build and deploy automatically on push. The SQLite database file persists across deploys via the mounted volume.