The API Gateway serves as a unified entry point for accessing various services in the Anticapture ecosystem. It uses GraphQL Mesh to combine multiple data sources into a single, cohesive GraphQL API.
- Unified API: Combines multiple backend services into a single GraphQL endpoint
- Dynamic Source Configuration: Automatically configures sources based on environment variables
- Custom Resolvers: Extends the schema with custom resolvers to work more as a router forwarding the request based on the query being made
The gateway is configured through environment variables:
DAO_API_*:- URLs for DAO-specific APIs (e.g.,
DAO_API_OP=https://api.optimism.dao) - This is based on the
indexerpackage which exposes both a graphql API at the root level, and a rest API on the/docspath
- URLs for DAO-specific APIs (e.g.,
ADDRESS_ENRICHMENT_API_URL: URL for the Address Enrichment service (Arkham integration)PETITION_API_URL: URL for the Petition REST API service
The API Gateway:
- Dynamically loads API sources from environment variables
- Creates both GraphQL and REST handlers for each DAO API
- Merges all sources into a unified GraphQL schema
- All the available request had to be mapped in order to make the gateway to work as a router, instead of the usual schema aggregator proposed by the GraphQL Mesh team
a.
rest,item, andlistare the requests gathered by type
To run the API Gateway locally:
- fill the
apps/api-gateway/.env - run
pnpm run gateway devat the root level