McKamyk
McKamyk
TTCTheo's Typesafe Cult
Created by McKamyk on 11/9/2024 in #questions
Posthog analytics on api hotpaths.
Hi, I have an app with many APIs we expose to users (Actually tanstack start serverFns). These APIs are calling downstream APIs from one of our providers. I'd like to get some insight into which of our ServerFns are calling which downstream APIs, and how often. I'm thinking of using Posthog, because I've heard lots about them. I have a wrapper I'm putting at the top of all my ServerFns that checks auth and stuff, so I can easily put a capture({...}) event there, no problem. I also have wrappers for the downstream apis from our provider that I reuse all over the site, I can easily put another capture({...}) in each of those. What I'd like to be done though, tie the capture({...}) at the top of the serverFn to all of the capture({...})s that are done by the downstream apis. So, I'd like to understand which ServerFns are using the most downstream API credits. I'm running everything in lambda, if that makes a difference.
7 replies
TTCTheo's Typesafe Cult
Created by McKamyk on 1/11/2023 in #questions
Create T3, appDir, tRPC
So I'm wanting to start new pet project, this'll be the first time I'm using T3 with Tailwind, Next, and tRPC. I want to use the new experimental appDir setting. When I create a repo with npm create t3-app@latest it defaults to the pages/ style. I added experimental: {appDir: true} to the next config, created a app/ directory, and copy pasted pages/index.tsx to app/page.tsx. But I'm getting errors saying I'm importing a component that needs useState, which only works on Client Components.
Maybe one of these should be marked as a client entry with "use client":
node_modules/@trpc/next/dist/index.mjs
src/utils/api.ts
src/app/page.tsx
Maybe one of these should be marked as a client entry with "use client":
node_modules/@trpc/next/dist/index.mjs
src/utils/api.ts
src/app/page.tsx
Should I forego T3 and setup Next/Tailwind/Typescript/tRPC manually, or should I adapt T3 into using app/ properly?
14 replies