Loft Chat docs
Loft Cloud is the fastest default. These docs focus on the self-hosted path for teams that need Docker deployment, infrastructure control, and deeper configuration.
What Loft Chat includes
- Real-time messaging via WebSockets and PostgreSQL LISTEN/NOTIFY.
- Channels, DMs, starred lists, archiving, and thread replies.
- Unread badges, browser notifications, reactions, mentions, pinning, and bookmarks.
- File uploads with local or S3-compatible storage backends.
- Custom emoji, presence, typing indicators, user management, and multi-organization support.
- React frontend, Fastify backend, BetterAuth, PostgreSQL, and Docker-based self-hosting.
Quickstart
git clone https://github.com/loft/loft-open-source.git cd loft-open-source docker-compose up --build
Frontend: `http://localhost:5173` · Backend API: `http://localhost:4000` · PgAdmin: `http://localhost:5050`
Railway deployment
Backend service root directory: `/server`.
Required backend variables: `DATABASE_URL`, `BETTER_AUTH_SECRET`, `BETTER_AUTH_URL`, `FRONTEND_URL`.
Optional backend variables: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `UPLOAD_DIR`, `STORAGE_BACKEND`, `MAX_UPLOAD_SIZE_MB`, `ORG_STORAGE_QUOTA_MB`, `USER_STORAGE_QUOTA_MB`.
Frontend service root directory: `/client` with `VITE_API_URL` pointing at the backend URL.
Environment and auth setup
Copy `server/.env.example` to `server/.env` and `client/.env.example` to `client/.env` before starting services.
Google OAuth is optional. Set the frontend origin to your app URL and the backend callback to `/api/auth/callback/google` on your API domain.
The first workspace bootstrap stays email/password only. Google OAuth works for normal sign-in and invite-based sign-up afterward.
Project structure
loft-open-source/ ├── client/ │ └── src/ │ ├── components/ │ ├── contexts/ │ ├── hooks/ │ ├── lib/ │ ├── pages/ │ └── types/ ├── server/ │ ├── src/ │ │ ├── routes/ │ │ ├── schemas/ │ │ ├── plugins/ │ │ ├── errors/ │ │ ├── utils/ │ │ ├── config/ │ │ ├── realtime.ts │ │ ├── auth.ts │ │ └── app.ts │ └── prisma/ │ └── schema.prisma └── docker-compose.yml