BBS/README.md

75 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WarezHou$e BBS
A late-80s / early-90s style bulletin board system that runs in the browser.
Dial in, hear the modem handshake, log on, and land on the main menu.
(303) 674-5489 :: 7 Nodes - 1.5 GB Online - HQ and Distro
## Quick start
```sh
cp .env.example .env # set a real POSTGRES_PASSWORD
docker compose up -d --build
```
Open http://localhost:8080 and press any key to dial. ESC skips the handshake.
## How it works
- **app** – Node.js/TypeScript. Serves the browser terminal (xterm.js) and a
WebSocket at `/ws`. Each WebSocket is one caller on one *node*; the BBS
logic runs server-side, the browser is a dumb terminal.
- **db** – PostgreSQL 16, data in the `bbs_pgdata` volume.
Settings (`.env`): `PORT`, `BAUD` (simulated output speed, `0` = unthrottled),
`MAX_NODES`, `IDLE_TIMEOUT_MIN`, and the Postgres credentials.
## Layout
| Path | What |
|---|---|
| `src/server.ts` | HTTP + WebSocket server, node allocation |
| `src/session/Session.ts` | Per-caller I/O: baud-throttled output, hotkeys, line input |
| `src/session/ansi.ts` | Pipe colour codes (`|00`-`|15` fg, `|16`-`|23` bg, `|CL`) |
| `src/screens/` | Welcome/logon, login, new user, main menu |
| `src/ui/` | Shared widgets (boxes, menus, number prompts) |
| `src/doors/` | Door framework (`registry.ts`, `doorMenu.ts`) and one folder per door |
| `src/doors/starlane/` | **STARLANE**, a frontier space-trading door game |
| `src/art/welcome.ts` | Welcome ANSI art |
| `src/users/userRepo.ts` | User accounts (bcrypt), call log |
| `db/migrations/` | SQL migrations, applied automatically on start |
| `public/` | Browser terminal, CRT styling, synthesized modem audio |
## Adding things
- **New screen:** add a module under `src/screens/` that takes a `Session`, and
wire a key to it in `src/screens/mainMenu.ts`.
- **New door game:** create `src/doors/<id>/index.ts` exporting a `DoorModule`
and add it to `src/doors/registry.ts`. See `src/doors/CLAUDE.md`.
- **New tables:** core tables go in `db/migrations/002_whatever.sql`. A door
keeps its own in `src/doors/<id>/migrations/`. Both run on next start.
## Tests
`npm test` builds and runs the unit tests (pure game-engine logic, no database).
## STARLANE
The first door. Trade between ports, haggle with brokers, fight Reavers and
other callers, seed planets and build Bastions, form Syndicates. Turns refill
daily. The universe is generated on first start. The Sysop (first account) can
press **Z** in-game to edit pilots or trigger a Big Bang (new universe).
Design notes live in `src/doors/starlane/CLAUDE.md`.
## Database access
```sh
docker compose exec db psql -U bbs bbs
```
## Font
For the full IBM PC look, install a VGA font such as "Px437 IBM VGA 8x16"
locally (the page will use it if present), or add an `@font-face` for it in
`public/style.css`.