Hatchat 🪓

The aim of Hatchat is to build a slack-like chat application on top of SQLite.

The goal is simplicity for running the server over more features.

Server

To build a binary: go build ./cmd/server.go -o hatchat

If you have just installed, you can do just build

To start the server: ./hatchat

Command line flags:

development

Run modd (to install it: go install github.com/cortesi/modd/cmd/modd) to have the server rebuilt on every change.

environment variables

Database Schema Versioning

The database schema is versioned to ensure safe deployments and rollbacks.

How it works

Making schema changes

All schema changes must be backward-compatible to allow server rollbacks:

✅ Allowed ❌ Not Allowed
Add columns with DEFAULT values Remove columns
Add new tables Rename columns
Add indexes Change column types

When modifying schema.sql:

  1. Make your backward-compatible change
  2. Increment SchemaVersion in server/db/version.go
  3. Update the version in the schema.sql INSERT statement
  4. Run just models to regenerate database models

CI will fail if you change the schema without bumping the version.