README.mdis still Bun scaffold text; trustpackage.jsonscripts instead.- This is a single Bun + TypeScript service (not a monorepo).
- Main boot is
src/index.ts: load config -> init DB -> init permission helper -> ensure log dir -> start task queue processing -> init Aptly -> sync additional live-repo files -> init API -> start Aptly -> start Hono API. bun run start(and compiled binaries) usescripts/entrypoint.ts, which force-setsLRA_DB_AUTO_MIGRATE=true.bun run devrunssrc/index.tsdirectly and does not force migrations.- When the users table is empty, startup creates a default
adminuser and writes a reset URL to${LRA_CONFIG_BASE_DIR}/initial_admin_password_reset_token.txt.
- Required env vars are enforced in
src/utils/config.ts; missing required keys exit the process. - Required keys include
LRA_PRIVATE_KEY_PATH,LRA_PUBLIC_KEY_PATH, and allLRA_S3_*settings. - Boolean env parsing is strict: only the string
"true"becomestrue; everything else becomesfalse. - First Aptly startup downloads a binary to
${LRA_APTLY_ROOT}/bin/aptly; host needs network access andunzip. - Package upload verification runs
dpkg --info; keepdpkgavailable for release upload flows/tests.
- Install deps:
bun install - Dev server:
bun run dev - Start server (auto-migrate):
bun run start - Typecheck:
bun run typecheck(checkssrc,tests,scripts) - Run all tests:
bun test - Run one test file:
bun test tests/permission-helper.test.ts - DB workflow after schema edits:
bun run db:generatethenbun run db:migrate - Regenerate Aptly API client:
bun run aptly-api-client:generate - Compile binary:
bun run compile <platform|auto|all> [version] [--no-version-tag] - Docker expects
build/bin/leios-api-linux-x64-baseline; generate withbun run compile linux-x64-baseline --no-version-tag.
bunfig.tomlpreloadstests/helpers/preload.tsfor every test run.- Preload builds a self-contained test env with a temp DB, generated GPG keys, and a local
s3rver, then starts the Hono API on port12151and Aptly on a random free dynamic port. - Tests are integration-heavy (DB + Aptly + S3-style publish config + generated local GPG keys), not pure unit tests.
- The test preload does not start
TaskScheduler.processQueue(), so routes that enqueue tasks only create DB task records unless a test starts the scheduler explicitly. tests/aptly.test.tsneeds.debfixtures undertestdata/.
src/aptly/api-client/**is generated byopenapi-ts; do not hand-edit generated files.- After DB schema changes, commit both
drizzle/*.sqlanddrizzle/meta/*. - Keep API responses aligned with
APIResponse; success responses includedata, error responses currently returnsuccess,code, andmessage. - Package/release delete/upload routes enqueue
testing-repo:update; these tasks only execute when the task scheduler loop is running.