olehhapuk ea1f5f8b16
CI / Lint, types, build, tests (push) Canceled after 0s
CI / Docker images build (push) Canceled after 0s
domain updates
2026-12-03 12:27:03 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 12:27:03 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 10:53:09 +02:00
2026-12-01 10:34:20 +02:00
2026-12-01 12:12:13 +02:00
2026-12-01 10:34:20 +02:00
2026-12-01 11:05:54 +02:00
2026-12-03 10:53:09 +02:00
2026-12-03 12:27:03 +02:00
2026-12-03 10:53:09 +02:00
2026-12-01 12:12:13 +02:00
2026-12-03 10:53:09 +02:00
2026-12-01 12:22:44 +02:00
2026-12-03 12:27:03 +02:00
2026-12-01 10:34:20 +02:00
2026-12-03 10:53:09 +02:00

electro4ort

A chat app: friends and direct messages, group chats, realms with cauldrons (communities and the rooms in them), files, reactions, and voice and video calls.

Where What
apps/api The API: NestJS, PostgreSQL through Drizzle, Better Auth, Socket.IO, LiveKit
apps/web The web app: TanStack Start, TanStack Query, React 19
packages/contracts Request and response shapes shared by both, as Zod schemas
packages/ui The components (shadcn/ui on Base UI)

Development

Needs Node 24, pnpm and Docker.

docker compose -f docker-compose.local.yml up -d   # PostgreSQL, Redis, LiveKit
cp apps/api/.env.example apps/api/.env             # then set BETTER_AUTH_SECRET
cp apps/web/.env.example apps/web/.env
pnpm install
pnpm --filter api db:migrate
pnpm dev                                           # web on :3000, API on :3001

After changing the tables in apps/api/src/db/schema, run pnpm db:generate --name <what-changed> and pnpm db:migrate in apps/api.

To add a shadcn/ui component: pnpm dlx shadcn@latest add button -c apps/web. It lands in packages/ui/src/components and is imported as @repo/ui/components/button.

Checks

pnpm turbo run lint typecheck build   # everything
pnpm turbo run test                   # unit tests
pnpm --filter api test:e2e            # API end to end; needs the containers above

.github/workflows/ci.yml runs the same on every push and pull request, and builds both Docker images.

Deploying

docker-compose.yml runs the app on one server: the web app, the API, PostgreSQL, Redis and LiveKit. The way in is the server's own Caddy, a separate compose project that other projects share: it gets the HTTPS certificates and reaches this one over the external Docker network web.

  1. Point three DNS names at the server: example.com, api.example.com and livekit.example.com (yours in place of example.com). The web app and the API must share a parent domain like this: the session cookie is only sent between pages of one site.

  2. Let 80 and 443 (TCP) through to Caddy, and for calls 7881 (TCP) and 7882 (UDP) through to this server: on the firewall, and on the router if the server is behind one.

  3. On the server, in a checkout of this repository:

    cp .env.example .env   # fill in the domain and the secrets; the file says how to make each
    docker compose up -d --build
    
  4. Mount deploy/Caddyfile into the shared Caddy as one of its site files (/etc/caddy/sites/electro4ort.caddy) and restart it. The three names are written out in that file: change them there if DOMAIN is not electro4ort.com.ua.

To update: git pull, then docker compose up -d --build again. Migrations are applied by the migrate service before the new API starts.

What to know before relying on it:

  • Back up the postgres-data volume (docker compose exec postgres pg_dump -U electro4ort electro4ort) and, unless files go to S3, the files volume.
  • Files are kept on the server's disk by default. Set the S3_* variables in .env to keep them in a bucket instead, which is also what running more than one API instance needs.
  • Calls work for people whose network allows UDP or TCP to the two ports above. Networks that only let HTTPS out need a TURN server, which LiveKit can run itself: see its deployment guide.
  • Accounts need no email confirmation and there is no password reset yet: both need an email provider.
  • The API trusts one proxy in front of it (TRUST_PROXY=1, Caddy). Behind another load balancer as well, raise it, or rate limits count the balancer instead of the caller.

To run the images elsewhere (Kubernetes, a platform): docker build --target api . and docker build --target web --build-arg VITE_API_URL=https://api.example.com .; the API's settings are listed in apps/api/.env.example, and its migrations run with node dist/db/migrate.js in the same image.

S
Description
No description provided
Readme
529 KiB
Languages
TypeScript 99%
CSS 0.6%
Dockerfile 0.4%