Prism API
(Developer API Platform)A developer platform for projects, owners and deployments, with REST, GraphQL and a TypeScript SDK driven by one schema.
- 1 shared GraphQL schema
- 2 API interfaces: REST + GraphQL
- 5 active API keys per workspace
2026 · Next.js · React · TypeScript · GraphQL · DataLoader · PostgreSQL
Problem
(what hurt)
Maintaining REST routes, a GraphQL API, docs and an SDK separately creates drift between what an API promises and what it does. Prism explores a schema-first approach while giving each account a private workspace and secure access to project data.
Project goal: Let external apps read projects, owners and deployment history through a secure API. Keep REST routes, the TypeScript SDK and runnable documentation aligned with a single GraphQL schema.
Architecture
(how it fits together)
A Next.js dashboard uses password login and session cookies to manage projects, deployments and API keys. External requests authenticate with a hashed key that determines the workspace. Generated REST routes execute through the same GraphQL resolvers and request-scoped DataLoaders as GraphQL requests. The data layer scopes PostgreSQL queries to the authenticated workspace; PostgreSQL also stores rate-limit state and usage.
Tech decisions: Next.js 15 and TypeScript serve the dashboard and APIs. REST routes compile from the GraphQL schema, and request-scoped DataLoaders batch nested reads. PostgreSQL stores workspace data, hashed API keys, shared token buckets and usage metrics.
- Next.js
- React
- TypeScript
- GraphQL
- DataLoader
- PostgreSQL
owner: (project: ProjectRow, _args: unknown, { loaders }: Context) =>
loaders.user.load(project.ownerId),
deployments: async (
project: ProjectRow,
{ first = 20, after }: { first?: number; after?: string },
{ loaders }: Context,
) => {
assertFirst(first);
const rows = await loaders.deployments.load({
where: { projectId: project.id }, take: first + 1,
cursor: after ? { id: decode(after) } : undefined,
});
return toConnection(rows, first);
},Features
(what it does)
One schema across the API
REST routes compile at startup from the GraphQL schema, the TypeScript SDK is generated from it, and runnable docs use the real routes. The SDK accepts cursor pagination parameters, returns page information and automatically retries 429 responses.
Workspace isolation and API keys
Each account gets one private workspace and up to five active API keys. Keys are shown once and stored as SHA-256 hashes. The key determines the workspace.
Runnable docs and usage insights
Try authenticated requests in the docs and GraphQL playground, compare database query counts with batching on or off, and inspect requests, errors, 429s, p50/p99 latency and top routes in the dashboard. An optional public sandbox provides read-only exploration.
Challenges
(what was hard)
01Nested reads without N+1 queries
Request-scoped DataLoaders batch owner and deployment reads across projects. Cursor pagination bounds result sets, and the playground exposes query counts so the effect of batching can be inspected.
02Rate limits shared across instances
Token buckets live in PostgreSQL, so limits survive restarts and apply across server instances. Standard keys allow a burst of 100 requests and refill at 10 per second; responses include limit headers and a Retry-After value on 429s.
03Schema changes that protect clients
A CI schema check compares schemas against a trusted base revision. When operation history is configured, it blocks changes that invalidate queries observed in the last 30 days; without that history, it blocks every detected breaking schema change. CI also checks that the generated SDK is current.
Results
- 1 shared GraphQL schema
- 2 API interfaces: REST + GraphQL
- 5 active API keys per workspace
Prism connects read-only REST and GraphQL APIs, generated Typescript SDK, runnable docs and usage analytics, backed by integration and schema checks.
design & code by Shreya Pathak