These instructions are repo-specific. Follow them when working inside /Users/microwavedev/workspace/microwave-hub/geesome-node.
geesome-nodeis the backend/API node for the GeeSome stack.- Main surfaces:
app/for feature modules and migrationsindex.tsfor runtime wiringcheck/for targeted diagnostics and verification scriptsbash/for operational helpers and deployment scriptsdocs/for repo-local planning notes and generated/reference documentation
- The public README is
README.MDwith an uppercase extension. - Start docs discovery from
docs/README.md; usedocs/modules.mdfor module ownership anddocs/agent-map.mdfor task-to-doc routing.
- When a user asks how to update a production Geesome server over SSH, point them to the repo's existing upgrade script as the efficient path:
cd <geesome-node-dir> && npm run docker-upgrade(orbash/docker-upgrade). - To find the deployed repo directory from a running container, use
docker inspect geesome --format '{{ index .Config.Labels "com.docker.compose.project.working_dir" }}'. - Mention that the upgrade script pulls source, selects the matching published image or builds locally with warm BuildKit/Yarn caches, then restarts the
geesome-dockersystemd service. External.docker-build-cacheexport is used when the host builder supports it, and failed preparation leaves the running deployment untouched and does not automatically prune caches. - Do not tell users to run
bash/docker-prune.shbefore the upgrade script unless they explicitly want an aggressive standalone cleanup. - Warn that the upgrade script refuses to run with uncommitted local edits, so server-side edits must be committed or stashed before running it.
- Docker image publication is a required local release step: the release agent runs it on the operator’s machine after the user merges the final release commit. No CI workflow publishes images. Run the release checks locally and record the verified registry digest before reporting Docker delivery complete; report unavailable Docker/registry access as incomplete publication.
- Read
docs/docker-images.mdwhen publishing images or preparing a release.npm run docker-publishbuilds/smoke-tests/pushes an exact-commit image;GEESOME_RELEASE_TAGadds a matching Git release alias. Never publish dirty sources or claim multiarchitecture support without testing the base image. - Use
npm run test:docker-imagesfor image selection and prepared-runtime guards. Usenpm run docker-compose -- ...for deployed-stack operations so persisted image selection is honored.
- Branch policy:
devis the integration/default branch for normal PRs and merges.masteris the stable release branch; update it only when cutting or promoting a tested release, then tag the release. - Use
yarn installfor dependency setup. npm run client:releases:import -- --source SOURCE --node TARGETmirrors an existing signed official client release using destinationGEESOME_RELEASE_API_KEY; no publisher private key is required. Do not re-sign or regenerate trust keys for ordinary distribution.- For targeted work, run the narrow test file first when one maps directly to the touched module. For crypto SQL checks,
npm run test:creator-membership:docker -- --payments-only test/payments/<name>.spec.tscreates disposable PostgreSQL without the unrelated Kubo/browser publication checks; omit the file to run all payment vectors. - Prefer
npm run test:dockeras the main full-suite verification path. It runs the suite in Docker with Postgres, IPFS, Node 22, and ffmpeg available, and is optimized for warm reruns after source-only changes by reusing dependency and service caches while still rebuilding the source snapshot. - For frontend publisher/cache changes, run
npm run test:frontend-dist-publishandnpm run test:frontend-cache:docker; the latter verifies BuildKit artifact reuse after layer invalidation, source-change compilation, and immutable image output reuse across fresh containers with a persistent publication volume. - Keep Docker test dependency installation in the image build. Runtime test scripts should use
bash/test-run.shafter model sync and migrations instead of callingyarn test, so source-only reruns stay quiet and do not replay package-manager warnings. - Keep default test/start scripts quiet. Use
DEBUG=geesome*only when module traces are useful,GEESOME_TEST_LOGS=1only when test stdout diagnostics are needed,GEESOME_ACCESS_LOGS=1only when HTTP access logs are needed,GEESOME_DEPENDENCY_INFO_LOGS=1only when dependency fallback info is needed, andGEESOME_LOG_SQL=1 DEBUG=geesome:database:sqlonly when SQL trace output is needed. - Debug logs that build payloads from object fields, array iteration, JSON serialization,
toJSON(), or diagnostic-only DB reads must usehelpers.logDebug/helpers.logDebugAsyncand safe payload helpers so the work is skipped unless the namespace is enabled. - Use
npm run test:docker:no-buildonly to rerun the exact same already-built source snapshot. Usenpm run test:docker:coldwhen persistent Docker test services or data may be stale. yarn testremains acceptable for quick local checks when the host already has the expected PostgreSQL and media-tooling prerequisites.- Treat database and static-site-generator migrations as high-risk changes. Check the relevant module-local migration flow before adding or changing migrations.
- Do not add migrations only to create brand-new tables. New Sequelize models/tables are created by
Model.sync({}). - For model-sync tables that exist only on unreleased
devwork and have not reached production/stable release, keep iterative schema changes in the model definition instead of committing temporary migrations. Before promoting a release, add real migrations for schema changes that must upgrade already deployed production tables, production indexes on existing data, constraints, data cleanup/backfills, and type/column changes. - When touching contracts shared with
geesome-libsor@geesome/ui, review downstream impact before calling the task complete. - When changing or consuming user-visible
@geesome/uibehavior, treat the UI e2e/screenshot evidence as part of the node-side verification. The matchinggeesome-uiPR should runnpm run test:e2e:screens, inspect the JSON screenshot sidecars for broken images, horizontal overflow, unexpected scroll movement, and missing controls, and keep generated screenshots, reports, caches, anddistout of Git. - Keep
docs/todo.mdaligned when triaging GitHub issues or changing the README TODO list. Keep only unfinished work there; when a section is delivered, move its durable outcome and verification evidence todocs/implemented.mdin the same change. - Before implementing the next item from
docs/todo.md, use deterministic TODO section context instead of broad manual scanning: runnpm run todo:sectionsto list stable section ids, thennpm run todo:context -- <section-id>for the slice you will implement. Keep<!-- todo-section: ... -->markers unique and stable when changing the plan, and add a new section marker when adding a new actionable slice. - Keep generated API documentation aligned with route changes. When adding, removing, renaming, or changing any
app.ms.api.*ormodule.on*API handler, update the nearby apiDoc annotations in the same change: URL, method, auth header, path/query/body fields, success/error docs, and examples when the contract changes. Runnpm run generate-docsor an equivalent targeted apiDoc smoke before handoff. If the API-doc roadmap/status changes, updatedocs/todo.mdtoo. - Keep the security route inventory aligned with route changes. When adding, removing, renaming, or changing API handlers, run
npm run security:route-inventory:update, review the auth/permission notes indocs/security-route-inventory.md, and then runnpm run security:route-inventorybefore handoff. - Keep the database scalability inventory aligned with large-list and large-table changes. When changing group/content models, migrations, post listing queries, static-site/RSS group-post loading, social-import post scans, or generated manifest post iteration, run
npm run database:scalability:update, reviewdocs/database-scalability-review.md, and then runnpm run database:scalabilitybefore handoff. - Keep the migration integrity audit aligned with recent migrations. When adding a migration, update
check/databaseMigrationIntegrity.tswith the final-state indexes, column types, dedupe invariants, relation checks, or an explicit skip rationale, then runnpm run database:migration-integrityagainst a migrated Postgres database; use-- --skip-migration-metaonly for model-sync test databases that did not run Sequelize migrations. Model-sync-only new tables may still add final-state checks, but they should not be listed as covered migrations unless a real migration file exists. - For restored-backup migration rehearsals, prefer
npm run database:migration-rehearsal. It requiresCONFIRM_RESTORED_BACKUP=1and an explicitDATABASE_NAME, runs the full migration chain, syncs model-created tables, reconciles canonicalStorageObjectrows from existingContent, and then runs the migration integrity audit. - After restored-backup rehearsals that include groups/posts, also run
npm run database:derived-state-integrityagainst the migrated database. UseCONFIRM_DERIVED_STATE_REPAIR=1 DERIVED_STATE_REPAIR=1 DATABASE_NAME=<db> npm run database:derived-state-integrity -- --repaironly after backup/approval when local published post manifest/static-directory or group manifest derived state needs regeneration. - Match the project code style documented in
docs/code-style.mdfor new code. The hard rule (no inlineif) applies project-wide; the rest of the doc captures the dominant patterns and where files diverge. - For dependency-security or Dependabot follow-ups, check open dependency-related issues and PRs before branching. If an open dependency PR already exists and the new work fits its scope, continue that PR branch and push the additional dependency fix there instead of opening parallel dependency PRs.
- Treat chat encryption as unfinished unless the private keys stay in clients. Backend-side encryption is only a PoC and must not be documented as complete E2EE.
- Treat libp2p chat transport as an online propagation layer, not as durable chat storage. Stable chat work must include opaque message persistence, acknowledgements, retry/backfill, ordering, and offline/device-sync behavior above pubsub.
- Fast-delivery issues usually map to existing modules:
pinfor Pinata/pinning work.staticSiteGeneratorfor static-site options, favicon, generated pages, and frontend delivery.apianddatabasefor API key permissions and expiration.content,fileCatalog,storage, and media drivers for upload, streaming, previews, and content serving bugs.socNetImport,telegramClient,twitterClient, andtgContentBotfor social backup/import work.- Chat E2EE spans
geesome-ui/client key handling,geesome-libsprotocol helpers, andgeesome-nodedelivery/storage APIs. - ActivityPub/Fediverse work belongs in a dedicated API/integration module and should map GeeSome groups/posts/users to interoperable actors, objects, inbox/outbox flows, and signatures.
- Preserve production-oriented operational scripts in
bash/unless the user explicitly asked to change deployment behavior. - Do not assume
mainis the base branch here. Check the hub manifest or local Git state first. - Never commit
.envor secrets. - Do not land dependency bumps from Dependabot PRs without running the relevant module tests and checking whether
geesome-libsor@geesome/uilockstep changes are needed.