Onboarding Guide: treetracker-admin-api

Machine-generated onboarding guide for the Greenstand Treetracker Admin API. It derives from the Understand-Anything knowledge graph (184 nodes, 230 edges, 9 layers, 14-step tour).

Project Overview

Architecture Layers

The codebase splits into nine layers. The first four hold the running application; the rest cover tests, infrastructure, and project tooling.

  1. API Layer (13 nodes): LoopBack 4 REST controllers for trees, planters (growers), organizations, species, and tags, plus cross-org variants, the routing index, and a health-check ping controller.
  2. Data Access Layer (23 nodes): LoopBack entity models, repositories that run raw parameterized SQL through a shared query builder, and the PostgreSQL datasource bindings.
  3. Application Core & Messaging (10 nodes): application bootstrap, server startup, the custom request sequence, the migration runner, runtime config, the authorization policy, and the RabbitMQ publisher.
  4. Shared Utilities (4 nodes): cross-cutting JavaScript helpers for JWT auth, audit logging, filter-query construction, and generic utilities.
  5. Testing (8 nodes): integration and unit suites plus database seed fixtures.
  6. Infrastructure & Deployment (43 nodes): Dockerfiles, docker-compose, Kubernetes Kustomize bases and overlays with SealedSecrets, dev scripts, nginx reverse proxy, and the systemd unit.
  7. CI/CD Pipelines (9 nodes): GitHub Actions workflows for CodeQL analysis, build-and-deploy, and environment-specific production and test deployments.
  8. Documentation (9 nodes): README, changelog, developing and tutorial guides, per-module READMEs, and the OpenAPI specification.
  9. Project Configuration (17 nodes): build, lint, formatting, release, and tooling configs, plus static HTML assets and ignore rules.

Key Concepts

  1. Project Overview: README.md, DEVELOPING.md
  2. Application Entry Point: src/index.ts, src/server.ts
  3. LoopBack 4 Application Core: src/application.ts, src/sequence.ts
  4. Configuration and Datasource: src/config.js, src/datasources/config.ts, src/datasources/treetracker.datasource.ts
  5. Domain Models: src/models/index.ts, trees.model.ts, planter.model.ts, organization.model.ts, species.model.ts
  6. Repositories and SQL Query Building: src/repositories/index.ts, trees.repository.ts, planter.repository.ts, src/js/buildFilterQuery.js
  7. REST Controllers: src/controllers/index.ts, trees.controller.ts, planter.controller.ts, organization.controller.ts
  8. Authentication and Authorization: src/js/auth.js, src/policy.json, src/js/Audit.js
  9. Event-Driven Messaging with RabbitMQ: src/messaging/RabbitMQMessaging.js, src/messaging/config.js, domainEvent.model.ts, domainEvent.repository.ts
  10. Database Migration: src/migrate.ts
  11. Integration Testing and Seeding: src/__tests__/integration/integration.ts, src/__tests__/seed/seed.ts, src/js/auth.int.test.js
  12. Containerization and Local Stack: Dockerfile, dev/compose/docker-compose.yml
  13. Kubernetes Deployment: deployment/base/treetracker-admin-api-deployment.yaml, kustomization.yaml, the database and RabbitMQ SealedSecrets
  14. CI/CD Pipelines: .github/workflows/treetracker-admin-api-build-deploy.yml, codeql-analysis.yml

File Map (by layer)

Application Core & Messaging

API Layer

Data Access Layer

Shared Utilities

Complexity Hotspots

Approach these files carefully; the graph marks them as the most complex (16 of 136 file-level nodes):

Business Domains

The domain graph identifies five domains (14 flows, 58 steps):