feat: initialize ingest-api with Koa and telemetry handling

- Create ingest-api with Koa framework for handling device telemetry.
- Implement telemetry ingestion with MongoDB, Redis, and PostgreSQL.
- Add API endpoints for telemetry and health checks.
- Set up testing with Vitest for unit and end-to-end tests.
- Configure Prettier and ESLint for code formatting and linting.
- Create Docker Compose setup for PostgreSQL, MongoDB, and Redis services.
- Establish contracts package for shared Zod schemas and TypeScript types.
- Implement React frontend with device status and greeting functionalities.
- Add VS Code setup documentation for onboarding developers.
This commit is contained in:
marco.chan committed 2026-09-03 10:13:02 +08:00
1 parent 534fa6dc51
commit 7923ba1b8d
70 files changed
+3085 -3434

No files matched your search

+27 -12
View File
@@ -1,20 +1,35 @@
# marco-trest-test
Internal onboarding workspace for learning and testing the private `trest` package.
Onboarding template: device ingest (Koa) vs user CRUD (Express), shared Zod contracts, Compose for Postgres / Mongo / Redis.
## Start Here
## Layout
1. Read [docs/trest-onboarding.md](docs/trest-onboarding.md) for full setup instructions.
2. Follow [docs/trest-test-plan.md](docs/trest-test-plan.md) to validate installation and basic usage.
3. If you are new to Yarn, read [docs/yarn-basics-cheatsheet.md](docs/yarn-basics-cheatsheet.md).
4. If you come from Express + SQL background, read [docs/express-sql-to-monorepo-guide.md](docs/express-sql-to-monorepo-guide.md).
```text
packages/contracts Zod only
apps/ingest-api Koa POST /telemetry
apps/crud-api Express GET /greeting GET /devices/:id/status
apps/web React + Redux + axios + Tailwind
```
## Goal
Read [docs/architecture.md](docs/architecture.md) for the mermaid diagrams and the dual-write warning.
By the end of this onboarding, you should be able to:
## Start
- Access the private repository in Gitea.
- Install `trest` in a local sandbox project.
- Run a small smoke test and a few behavior checks.
- Document what worked, what failed, and open questions for the team.
```bash
docker compose up -d
yarn install
yarn dev:crud
yarn dev:ingest
yarn dev:web
```
- UI: http://127.0.0.1:5173/devices
- Greeting: http://127.0.0.1:5173/greeting
- Express: http://127.0.0.1:3000/greeting?name=Marco
- Ingest: `POST http://127.0.0.1:3001/telemetry`
Frontend-only install (no Mongo/Koa):
```bash
yarn workspaces focus web
```