Shared API contracts for the Stack Analyzer polyrepo architecture.
npm install @stack/contracts
# or link locally during development
npm linkimport { initClient } from '@ts-rest/core';
import { compoundsContract } from '@stack/contracts';
const client = initClient(compoundsContract, {
baseUrl: 'http://localhost:3002'
});
const result = await client.getCompound({ params: { id: '123' } });import { initServer } from '@ts-rest/express';
import { compoundsContract } from '@stack/contracts';
const s = initServer();
const router = s.router(compoundsContract, {
getCompound: async ({ params }) => {
const compound = await db.getCompound(params.id);
return { status: 200, body: compound };
}
});compoundsContract- Compound Research APIplannerContract- Stack Planner APIvendorsContract- Vendor Intelligence API
npm install
npm run build
npm run watch # for developmentnpm run generate:openapi