Skip to content

qdouble/stack-contracts

Repository files navigation

@stack/contracts

Shared API contracts for the Stack Analyzer polyrepo architecture.

Installation

npm install @stack/contracts
# or link locally during development
npm link

Usage

Client (Frontend)

import { 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' } });

Server (Express)

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 };
  }
});

Contracts

  • compoundsContract - Compound Research API
  • plannerContract - Stack Planner API
  • vendorsContract - Vendor Intelligence API

Development

npm install
npm run build
npm run watch   # for development

Generate OpenAPI

npm run generate:openapi

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors