AppView in a box as a Vite plugin thing hatk.dev
at main 63 lines 1.4 kB view raw view rendered
1--- 2title: Build & Deploy 3description: Build your Hatk server for production. 4--- 5 6## `hatk build` 7 8Build the frontend for production using Vite. 9 10```bash 11hatk build 12``` 13 14Compiles and bundles the SvelteKit frontend in `app/` into optimized production assets. 15 16## Deployment 17 18To run in production: 19 201. Build the frontend: 21 22 ```bash 23 hatk build 24 ``` 25 262. Start the server: 27 28 ```bash 29 hatk start 30 ``` 31 323. Configure environment variables for production: 33 ```bash 34 RELAY=wss://bsky.network \ 35 DATABASE=data/hatk.db \ 36 PORT=3000 \ 37 hatk start 38 ``` 39 40See [Configuration](/getting-started/configuration) for all available environment variables. 41 42## SQLite in production 43 44hatk 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. 45 46### Railway 47 48[Railway](https://railway.app) is a good fit for hatk apps. To deploy: 49 501. Push your project to a Git repository 512. Create a new Railway project linked to that repo 523. Add a persistent volume mounted at `/data` 534. Set environment variables: 54 55 ``` 56 DATABASE=/data/hatk.db 57 RELAY=wss://bsky.network 58 PORT=3000 59 ``` 60 615. Set the start command to `hatk start` 62 63Railway will build and deploy automatically on push. The SQLite database file persists across deploys via the mounted volume.