2025-11-03 00:11:13 +08:00

24 lines
2.9 KiB
Markdown

# Repository Guidelines
## Project Structure & Entry Points
Meteor is split into npm workspaces plus standalone Go/Rust services. `meteor-web-backend/` (NestJS) boots from `src/main.ts` and modules under `src/devices|events|metrics`. `meteor-frontend/` (Next.js App Router) serves UI from `src/app/` with data access helpers in `src/services/`. `meteor-compute-service/` (Go) starts at `cmd/meteor-compute-service/main.go` and pushes SQS payloads through `internal/processor`. `meteor-edge-client/` (Rust) exposes the CLI in `src/main.rs`; the runtime loop lives in `Application::run` inside `src/app.rs`. Shared fixtures sit in `test-data/`, Terraform under `infrastructure/`, and long-form docs in `docs/`.
## Build & Run
- `npm run install:all` installs JS/TS workspaces; `npm run dev` launches backend (3000) and frontend (3001).
- `npm run test:backend|frontend|integration|e2e` guard merges; `npm run test:fullstack` orchestrates docker-compose suites via `docker-compose.test.yml`.
- Edge client: `cargo run -- run --camera file:meteor-edge-client/video.mp4` replays fixtures locally; use `cargo build --release` for deployment binaries.
- Compute service: `go run cmd/meteor-compute-service/main.go` and `go test ./...` before shipping changes.
- Use `./test-setup.sh` to provision LocalStack/Postgres before integration tests.
## Coding Style & Naming
TypeScript follows ESLint + Prettier (`npm run lint:*`); keep controllers/services PascalCase, providers suffixed `*.service.ts`, DTOs in `src/devices/dto/`. React components live in `src/app/<route>/` using 2-space indent and camelCase hooks. Rust adheres to `rustfmt` (`cargo fmt`) with modules snake_case; prefer `?` over `unwrap()`. Go code must pass `go fmt` and `go vet`. Avoid committing generated bundles, compiled binaries, or `tmp-home` artifacts.
## Testing Expectations
Backend uses Jest under `test/` with Supertest integration specs; keep `npm run test:cov` green. Frontend combines Jest + Testing Library with Playwright scripts in `e2e/`. Rust edge client relies on `cargo test` plus end-to-end runs such as `cargo run -- run --camera file:…`; test fixtures live in `meteor-edge-client/test-data`. Compute service needs table-driven `go test` coverage. Add regression tests alongside bug fixes.
## Commit & PR Workflow
Write imperative commits with optional scopes (`fix(edge): ...`). Reference issues in bodies, list commands executed, and attach screenshots for UI work or CLI transcripts for device flows. PRs must call out cross-service impacts and any config migrations (`migrations/` or `meteor-client-config.toml`). Wait for CI green and obtain approvals from service owners before merge.
## Security & Ops
Keep JWTs and bearer tokens in `.env` or OS keychain; never commit `meteor-client-config.toml`. Edge devices read configs from `dirs::config_dir()`—override with `HOME=<path>` when testing. Rotate credentials when sharing sample configs and scrub logs before uploading.