# heatherjmain/acquisitions architecture

> Architecture diagram of the GitHub repository heatherjmain/acquisitions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/heatherjmain/acquisitions
- Repository: https://github.com/heatherjmain/acquisitions

## Overview

Acquisitions API serves filtered and aggregated acquisition data through GraphQL, with a natural-language path that turns prompts into GraphQL and executes the query through the same resolvers. Database setup and CSV seeding support both query paths. The README and sampled files support the major components and principal calls shown; unsampled implementation details are omitted, and infrastructure relationships are limited to those explicit in the CDK stack.

Main entry points: [`src/llm/llm-lambda.ts`](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/llm-lambda.ts) (LLM handler), [`src/db/db.ts`](https://github.com/heatherjmain/acquisitions/blob/main/src/db/db.ts) (DB connection), [`src/graphql/resolvers.ts`](https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/resolvers.ts) (Query resolvers), [`src/cdk/stack.ts`](https://github.com/heatherjmain/acquisitions/blob/main/src/cdk/stack.ts) (CDK stack)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API interfaces"]
  node_gateway{{"API Gateway"}}
  node_graphql_lambda["GraphQL Lambda<br/>[graphql-lambda.ts]"]
  node_graphql_schema["GraphQL schema<br/>[schema.ts]"]
  node_resolvers["Query resolvers<br/>[resolvers.ts]"]
  node_local_server["Local API server<br/>[graphql.local.ts]"]
end

subgraph group_language["Natural language"]
  node_llm_lambda["LLM handler<br/>[llm-lambda.ts]"]
  node_prompts["System prompts<br/>[prompts.ts]"]
  node_llm_client["OpenAI client<br/>[client.ts]"]
  node_llm_tools["LLM tools<br/>[tools.ts]"]
  node_llm_parser["Output parser<br/>[llm-util.ts]"]
  node_openai{{"OpenAI API"}}
end

subgraph group_data["Data access"]
  node_db_connection["DB connection<br/>[db.ts]"]
  node_db_utils["DB utilities<br/>[db-util.ts]"]
  node_query_builders["SQL builders<br/>[query-builders.ts]"]
  node_aurora[("Aurora PostgreSQL")]
  node_seed_lambda["Seed Lambda<br/>[seed-db-lambda.ts]"]
  node_acquisition_csv["Acquisition CSV"]
  node_company_csv["Company CSV<br/>[companies-data.csv]"]
end

subgraph group_cloud["Cloud infrastructure"]
  node_cdk_stack["CDK stack<br/>[stack.ts]"]
end

node_user(("API user"))

node_user -->|"sends request"| node_gateway
node_gateway -->|"routes GraphQL"| node_graphql_lambda
node_gateway -->|"routes prompt"| node_llm_lambda
node_graphql_lambda -->|"uses schema"| node_graphql_schema
node_graphql_lambda -->|"registers resolvers"| node_resolvers
node_resolvers -->|"gets pool"| node_db_connection
node_resolvers -->|"builds queries"| node_query_builders
node_resolvers -->|"runs queries"| node_db_utils
node_local_server -->|"configures server"| node_graphql_schema
node_local_server -->|"configures server"| node_resolvers
node_local_server -->|"initializes database"| node_db_connection
node_local_server -->|"dispatches prompt"| node_llm_lambda
node_llm_lambda -->|"uses prompt"| node_prompts
node_llm_lambda -->|"requests generation"| node_llm_client
node_llm_lambda -->|"parses output"| node_llm_parser
node_llm_lambda -->|"executes query"| node_graphql_schema
node_llm_lambda -->|"executes query"| node_resolvers
node_llm_lambda -->|"gets pool"| node_db_connection
node_llm_client -->|"supplies tools"| node_llm_tools
node_llm_client -->|"calls responses API"| node_openai
node_db_connection -->|"runs SQL"| node_db_utils
node_db_connection -->|"builds schema"| node_query_builders
node_db_connection -->|"connects"| node_aurora
node_db_utils -->|"builds seed SQL"| node_query_builders
node_db_utils -->|"reads and writes"| node_aurora
node_seed_lambda -->|"initializes database"| node_db_connection
node_db_connection -->|"loads seed data"| node_acquisition_csv
node_db_connection -->|"loads seed data"| node_company_csv
node_cdk_stack -->|"configures routes"| node_gateway
node_cdk_stack -->|"creates function"| node_graphql_lambda
node_cdk_stack -->|"creates function"| node_llm_lambda
node_cdk_stack -->|"creates function"| node_seed_lambda
node_cdk_stack -->|"creates cluster"| node_aurora

click node_graphql_lambda "https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/graphql-lambda.ts"
click node_graphql_schema "https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/schema.ts"
click node_resolvers "https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/resolvers.ts"
click node_local_server "https://github.com/heatherjmain/acquisitions/blob/main/src/graphql.local.ts"
click node_llm_lambda "https://github.com/heatherjmain/acquisitions/blob/main/src/llm/llm-lambda.ts"
click node_prompts "https://github.com/heatherjmain/acquisitions/blob/main/src/llm/prompts.ts"
click node_llm_client "https://github.com/heatherjmain/acquisitions/blob/main/src/llm/client.ts"
click node_llm_tools "https://github.com/heatherjmain/acquisitions/blob/main/src/llm/tools.ts"
click node_llm_parser "https://github.com/heatherjmain/acquisitions/blob/main/src/llm/llm-util.ts"
click node_db_connection "https://github.com/heatherjmain/acquisitions/blob/main/src/db/db.ts"
click node_db_utils "https://github.com/heatherjmain/acquisitions/blob/main/src/db/db-util.ts"
click node_query_builders "https://github.com/heatherjmain/acquisitions/blob/main/src/db/query-builders.ts"
click node_seed_lambda "https://github.com/heatherjmain/acquisitions/blob/main/src/db/seed-db-lambda.ts"
click node_acquisition_csv "https://github.com/heatherjmain/acquisitions/blob/main/src/db/data/acquisitions-data.csv"
click node_company_csv "https://github.com/heatherjmain/acquisitions/blob/main/src/db/data/companies-data.csv"
click node_cdk_stack "https://github.com/heatherjmain/acquisitions/blob/main/src/cdk/stack.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway,node_graphql_lambda,node_graphql_schema,node_resolvers,node_local_server,node_user toneBlue
class node_llm_lambda,node_prompts,node_llm_client,node_llm_tools,node_llm_parser,node_openai toneAmber
class node_db_connection,node_db_utils,node_query_builders,node_aurora,node_seed_lambda,node_acquisition_csv,node_company_csv toneMint
class node_cdk_stack toneRose
```

## Components

### API interfaces

- **API Gateway**
- [GraphQL Lambda](https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/graphql-lambda.ts): `src/graphql/graphql-lambda.ts`
- [GraphQL schema](https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/schema.ts): `src/graphql/schema.ts`
- [Query resolvers](https://github.com/heatherjmain/acquisitions/blob/main/src/graphql/resolvers.ts): `src/graphql/resolvers.ts`
- [Local API server](https://github.com/heatherjmain/acquisitions/blob/main/src/graphql.local.ts): `src/graphql.local.ts`

### Natural language

- [LLM handler](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/llm-lambda.ts): `src/llm/llm-lambda.ts`
- [System prompts](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/prompts.ts): `src/llm/prompts.ts`
- [OpenAI client](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/client.ts): `src/llm/client.ts`
- [LLM tools](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/tools.ts): `src/llm/tools.ts`
- [Output parser](https://github.com/heatherjmain/acquisitions/blob/main/src/llm/llm-util.ts): `src/llm/llm-util.ts`
- **OpenAI API**

### Data access

- [DB connection](https://github.com/heatherjmain/acquisitions/blob/main/src/db/db.ts): `src/db/db.ts`
- [DB utilities](https://github.com/heatherjmain/acquisitions/blob/main/src/db/db-util.ts): `src/db/db-util.ts`
- [SQL builders](https://github.com/heatherjmain/acquisitions/blob/main/src/db/query-builders.ts): `src/db/query-builders.ts`
- **Aurora PostgreSQL**
- [Seed Lambda](https://github.com/heatherjmain/acquisitions/blob/main/src/db/seed-db-lambda.ts): `src/db/seed-db-lambda.ts`
- [Acquisition CSV](https://github.com/heatherjmain/acquisitions/blob/main/src/db/data/acquisitions-data.csv): `src/db/data/acquisitions-data.csv`
- [Company CSV](https://github.com/heatherjmain/acquisitions/blob/main/src/db/data/companies-data.csv): `src/db/data/companies-data.csv`

### Cloud infrastructure

- [CDK stack](https://github.com/heatherjmain/acquisitions/blob/main/src/cdk/stack.ts): `src/cdk/stack.ts`

### Other components

- **API user**

## Connections

- API user → API Gateway: sends request (evidence: `README.md`)
- API Gateway → GraphQL Lambda: routes GraphQL
- API Gateway → LLM handler: routes prompt
- GraphQL Lambda → GraphQL schema: uses schema (evidence: `src/graphql/graphql-lambda.ts`)
- GraphQL Lambda → Query resolvers: registers resolvers (evidence: `src/graphql/graphql-lambda.ts`)
- Query resolvers → DB connection: gets pool (evidence: `src/graphql/resolvers.ts`)
- Query resolvers → SQL builders: builds queries (evidence: `src/graphql/resolvers.ts`)
- Query resolvers → DB utilities: runs queries (evidence: `src/graphql/resolvers.ts`)
- Local API server → GraphQL schema: configures server (evidence: `src/graphql.local.ts`)
- Local API server → Query resolvers: configures server (evidence: `src/graphql.local.ts`)
- Local API server → DB connection: initializes database (evidence: `src/graphql.local.ts`)
- Local API server → LLM handler: dispatches prompt (evidence: `src/graphql.local.ts`)
- LLM handler → System prompts: uses prompt (evidence: `src/llm/llm-lambda.ts`)
- LLM handler → OpenAI client: requests generation (evidence: `src/llm/llm-lambda.ts`)
- LLM handler → Output parser: parses output (evidence: `src/llm/llm-lambda.ts`)
- LLM handler → GraphQL schema: executes query (evidence: `src/llm/llm-lambda.ts`)
- LLM handler → Query resolvers: executes query (evidence: `src/llm/llm-lambda.ts`)
- LLM handler → DB connection: gets pool (evidence: `src/llm/llm-lambda.ts`)
- OpenAI client → LLM tools: supplies tools (evidence: `src/llm/client.ts`)
- OpenAI client → OpenAI API: calls responses API (evidence: `src/llm/client.ts`)
- DB connection → DB utilities: runs SQL (evidence: `src/db/db.ts`)
- DB connection → SQL builders: builds schema (evidence: `src/db/db.ts`)
- DB connection → Aurora PostgreSQL: connects (evidence: `src/db/db.ts`)
- DB utilities → SQL builders: builds seed SQL (evidence: `src/db/db-util.ts`)
- DB utilities → Aurora PostgreSQL: reads and writes (evidence: `src/db/db-util.ts`)
- Seed Lambda → DB connection: initializes database (evidence: `src/db/seed-db-lambda.ts`)
- DB connection → Acquisition CSV: loads seed data (evidence: `src/db/db.ts`)
- DB connection → Company CSV: loads seed data (evidence: `src/db/db.ts`)
- CDK stack → API Gateway: configures routes (evidence: `src/cdk/stack.ts`)
- CDK stack → GraphQL Lambda: creates function (evidence: `src/cdk/stack.ts`)
- CDK stack → LLM handler: creates function (evidence: `src/cdk/stack.ts`)
- CDK stack → Seed Lambda: creates function (evidence: `src/cdk/stack.ts`)
- CDK stack → Aurora PostgreSQL: creates cluster (evidence: `src/cdk/stack.ts`)
