Documentation Index
Fetch the complete documentation index at: https://docs.launchtoday.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Launch uses tRPC to share API types across the API, mobile app, and web app. The API defines a single router, and both clients import the router type directly from the API package.Prerequisites
- API package built and available
apps/api/src/types.tsexportsAppRouter
Steps
- Define routers in
apps/api/src/router.ts - Export
AppRouterfromapps/api/src/types.ts - Import
AppRouterin mobile and web
Single source of truth
- Router definition:
apps/api/src/router.ts - Type export:
apps/api/src/types.ts
apps/api/package.json exposes types, both clients can import
AppRouter from the api package without any manual codegen.
Mobile client usage
Web client usage
Extending routers safely
- Add a new router in
apps/api/src/routers/ - Register it in
apps/api/src/router.ts - Use the typed hooks on mobile/web immediately
- The client imports
AppRouterfromapi - You avoid
anyor casting tRPC hooks
Common pitfalls
- Missing router registration: If a router isn’t added to
appRouter, clients won’t see it. - Casting away types: Avoid
as anyoras unknownat the tRPC boundary. - Out-of-date builds: Restart the mobile/web dev server after adding new procedures to pick up updated types.
Troubleshooting
- Types missing: ensure
apps/api/package.jsonpoints totypes - Type errors in mobile: restart dev server to pick up changes