ProjectsParts Services
Repository Guidelines
Project Structure & Module Organization - holds runbooks and deployment notes; update alongside code changes. - is the Bun microservice. Within it: - boots the...
Repository Guidelines
Project Structure & Module Organization
docs/holds runbooks and deployment notes; update alongside code changes.search-service/is the Bun microservice. Within it:src/index.tsboots the Hono app fromsrc/app.ts.src/routes/*.tsdefine HTTP endpoints; keep filenames lower-case.src/middleware/,src/utils/,src/types/host shared concerns—reuse before creating new helpers.src/sync/orchestrates Mongo ↔ Elasticsearch jobs and must stay idempotent.src/__tests__/contains Bun test suites (*.test.ts) mirroring module paths.scripts/ships operational tooling;deploy/maintains Cloud Run/ECS manifests;dist/is generated output.
Build, Test, and Development Commands
Run from search-service/:
bun install # install dependencies
bun run dev # watch-mode API on :3000
bun run build # emit production bundle in dist/
bun test # execute Bun tests
bun run typecheck # strict TypeScript check
bun run biome:check # lint + format verification
docker-compose up -d elasticsearch kibana # optional local stack
bun scripts/migrate-index.ts --dry-run # preview ES mapping changesCoding Style & Naming Conventions
- TypeScript with ES modules and strict typings; export DTOs from
src/types. - Biome enforces 2-space indentation, double quotes, and sorted imports—run
bun run biome:fixinstead of hand-formatting. - Use
camelCasefor symbols,PascalCasefor classes/types, and UPPER_SNAKE env keys; keep route and script filenames lower-case. - Centralize shared middleware under
src/middlewareand prefer composable functions over monolithic handlers.
Testing Guidelines
- Place unit and integration specs in
src/__tests__following thefeature.test.tsnaming scheme. - Cover happy paths, validation failures, and external dependency errors.
- Elasticsearch-dependent specs expect the docker-compose stack; guard them if services are unavailable.
- Before opening a PR, ensure
bun testandbun run typecheckpass locally.
Commit & Pull Request Guidelines
- Use Conventional Commits (
feat:,fix:,chore:) as referenced inCI_CD_SETUP.md. - Husky hooks block AI-assistant mentions and run lint-staged plus
bun run typecheck; resolve hook failures before retrying. - PRs should include a concise summary, validation notes (commands + outcomes), linked issues, and screenshots or
curlsnippets for API changes. - Update relevant docs (
docs/*.md,docs/INDEX_MIGRATION.md) whenever behavior or operations change.
Security & Configuration Tips
- Never commit
.env*,.mcp.json, or internal guides; hooks will reject them. - Treat
.env.exampleas configuration truth; store secrets in GitHub Actions or local.env. - Coordinate updates to
scripts/*.ts,deploy/*.json, and.github/workflowswhen changing Elasticsearch or Cloud Run settings.