TemplatesDiscord activities
tRPC
A Discord Activity template with tRPC for type-safe APIs.
tRPC
A Discord Activity template using tRPC for end-to-end type-safe APIs.
Getting Started
Create a project with this template:
npx create-robo@next <project-name> --template discord-activities/react-trpc-tsThen navigate into your project directory:
cd <project-name>Run development mode:
npm run devFeatures
- tRPC pre-configured
- End-to-end type safety
- React Query integration
- TypeScript support
How It Works
Define your API procedures in the server and call them from the client with full type safety:
.env
// Server
export const appRouter = router({
hello: publicProcedure.query(() => 'Hello, world!')
})
// Client
const { data } = trpc.hello.useQuery()// Server
export const appRouter = router({
hello: publicProcedure.query(() => 'Hello, world!')
})
// Client
const { data } = trpc.hello.useQuery()Hosting
npm run deploy