RESTful API endpoints for querying ServiceScape organization structure (domains, teams, services).
http://localhost:3000/api
List all domains with team counts.
Response:
[
{
"id": "uuid",
"name": "Engineering",
"metadata": {},
"teamCount": 5,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
]Get a single domain by ID.
Response:
{
"id": "uuid",
"name": "Engineering",
"metadata": {},
"teamCount": 5,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}List all teams for a specific domain.
Response:
[
{
"id": "uuid",
"domain_id": "uuid",
"name": "Backend Team",
"metadata": {},
"serviceCount": 12,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
]Get a single team by ID with members and service count.
Response:
{
"id": "uuid",
"domain_id": "uuid",
"name": "Backend Team",
"metadata": {},
"serviceCount": 12,
"members": [
{
"id": "uuid",
"team_id": "uuid",
"name": "John Doe",
"role": "Engineer",
"email": "john@example.com"
}
],
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}List all services for a specific team.
Response:
[
{
"id": "uuid",
"team_id": "uuid",
"name": "API Gateway",
"type": "REST",
"tier": "T1",
"metadata": {},
"upstreamCount": 3,
"downstreamCount": 5,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
]Get a single service by ID with dependency counts.
Response:
{
"id": "uuid",
"team_id": "uuid",
"name": "API Gateway",
"type": "REST",
"tier": "T1",
"metadata": {},
"upstreamCount": 3,
"downstreamCount": 5,
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}List all services across all teams.
Response:
[
{
"id": "uuid",
"team_id": "uuid",
"name": "API Gateway",
"type": "REST",
"tier": "T1",
"metadata": {},
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}
]{
"error": "Domain not found"
}{
"error": "Failed to fetch domains"
}The API follows a layered architecture:
-
Repository Layer (
src/repositories/): Pure SQL queries, database accessdomainRepository.tsteamRepository.tsserviceRepository.tsmemberRepository.tsdependencyRepository.ts
-
Service Layer (
src/services/): Business logic, computed fieldsorganizationService.ts- Adds counts (team count, service count, dependency counts)
-
Route Layer (
src/routes/): HTTP endpoints, request/response handlingdomains.tsteams.tsservices.ts
All endpoints have comprehensive test coverage:
- Repository layer: Unit tests with mocked database
- Service layer: Unit tests with mocked repositories
- Route layer: Integration tests with supertest
Run tests:
npm testSee src/db/migrations/001_initial_schema.sql for table definitions.
Key tables:
domains- Top-level organizational unitsteams- Teams within domainsservices- Services owned by teamsmembers- People on teamsdependencies- Service dependencies (upstream/downstream)