Developer Guide#
Prerequisites#
- Bun installed (v1.x or newer).
Steps to Run#
Clone the repository and navigate into the directory:
git clone https://github.com/svyatoslav-kubakh/podhound.git cd podhoundInstall dependencies:
bun installStart the server in development mode (with hot-reloading):
bun start:devThe server will start listening at
http://localhost:8080.Run automated test suite:
bun testRun load & memory benchmark test:
bun run test:loadLint and auto-fix code style:
bun run lint # check only bun run lint:fix # auto-fixBuild a standalone executable binary:
bun run build ./dist/podhound
Performance & Optimization Notes#
- Password Hashing: Uses
bcrypt(cost: 10) for minimal RAM overhead (~14 MB total server memory footprint). - Basic Auth Cache: In-memory caching with 5-minute TTL to bypass repeated password verification on high-frequency API calls.
- Prepared Statements: Pre-compiled SQLite queries in service constructors to eliminate heap allocations per request.
- Garbage Collection: Automatic background GC scheduled periodically via
Bun.gc(true).
Project Structure#
src/
βββ config/ # App configuration (env variables)
βββ db/ # Database client, migrations
β βββ migrations/ # SQL migration files
βββ routes/ # HTTP and CLI routing
β βββ api/ # API sub-routers (auth, devices, subscriptions, episodes)
β βββ cli/ # CLI sub-routers (user management)
βββ services/ # Business logic (auth, users, subscriptions, episodes)
βββ types/ # Shared TypeScript interfaces
βββ main.ts # Application entry pointFor a full list of available settings, please refer to the Environment Variables documentation.