Onboarding Guide: treetracker-query-api

Machine-generated onboarding guide from the Understand-Anything knowledge graph.

Project Overview

treetracker-query-api is a RESTful API that exposes Greenstand treetracker data (captures, planters/growers, organizations, trees, species, tags, countries, tokens and transactions) for clients such as the web map app. It follows a Domain Driven Design layered architecture: an Express protocol/router layer, a business model layer, and a knex/pg repository layer over PostgreSQL.

Architecture Layers

The system splits into 8 layers. The 3 core code layers form the DDD request path (router -> model -> repository -> database).

Key Concepts

Business Domains

Guided Tour

Recommended reading order for a new developer.

  1. Project Overview: README.md
  2. Application Entry Point: server/server.ts, server/app.ts
  3. Runtime Configuration: package.json, .env.example
  4. Router Layer and Shared Utilities: server/routers/utils.ts
  5. Concrete Resource Routers: server/routers/treesRouter.ts, server/routers/growerAccountsRouter.ts
  6. Business Model Layer: server/models/Tree.ts, server/models/GrowerAccount.ts
  7. Domain Model Contract: server/interfaces/DbModel.ts
  8. Repository Foundation: server/infra/database/Session.ts, server/infra/database/BaseRepository.ts, server/infra/database/delegateRepository.ts
  9. Concrete Repository: server/infra/database/TreeRepositoryV2.ts
  10. Structured Error Handling: server/utils/HttpError.ts
  11. Containerization: Dockerfile, tsconfig.json
  12. Kubernetes Deployment: deployment/base/deployment.yaml, deployment/base/kustomization.yaml
  13. CI/CD Pipelines: .github/workflows/pull-request-ci.yml, .github/workflows/deploy-prod-env.yml

File Map (key files by layer)

Protocol & Router Layer

Business Model Layer

Repository & Data Access Layer

Complexity Hotspots

Approach these files carefully; they carry the most logic.

Next Steps