Documentation
Getting started
Client code setup

Code setup

Server

After installing and setting up your router you can link your backend-env router yo your front-end client. TSDL will by design blur the line between the two ends using TypeScript magic.

Import router from server

main.tsx
import type { Router } from "../server/src/server";

Create client

main.tsx
import type { Router } from "my-server";
 
export const tsdl = createClient<Router>(({ url }) =>
  fetch(url("http://localhost:8000/tsdl")).then((d) => d.json())
);

Start using TSDL

App.tsx
/* ... */
import { tsdl } from "./main";
 
const fruit = await tsdl.food.fetchFruit();

Next Steps

You're up and running but you're probably missing a few things: