Theo's Typesafe Cult

TTC

Theo's Typesafe Cult

Join the community to ask questions about Theo's Typesafe Cult and get answers from other members.

Join

replace [projectId] with project name

Currently my url looks like this: http://localhost:3000/projects/asdjkfb67284v. How can I replace ithe id "asdjkfb67284v" with a unique project name? For example, I want something like http://localhost:3000/projects/my-new-project....

Linter & type check in nextjs app

hi if all the linter & typecheck is already done in each PR branch with CI, do i still need to do check lint & types in master branch before deployment ? is there any edge case that i dont think of ? ...

Consumer tRPC client package from private API type?

I have a monrepo (template from t3-turbo), with a tRPC API package. I'd like to expose a router for a public SDK by simply exposing the type of that router such that a tRPC client can be created, like ```tsx // private api package export const publicRouter = createTRPCRouter({...

SKIP_ENV_VALIDATION

I have this set to 'true' in my .env but I'm still getting errors about missing envs (they aren't missing and have another question open about why) but my understanding would be that this should skip such a check and therefore should make seeing that error impossible.
Solution:
Maybe you can't set it to true but instead need to set it to 1

How to add unique username to user that signed in via provider?

What I'm trying to do: I'm trying to force user to add username after they signed in via provider. After they signed in, it'll redirect them to "/auth/new-user/". If they did not specify their username on this page, set default username "user{user.id}". In database I'll add new field "username" and make it unique....

Recommended architecture for my simple web scraping data visualizer for gym capacity

Hello. As of now, I have set up a lambda function that runs every 15min (scheduled by AWS EventBridge). This Lambda hits an API to get my gym's current capacity, then hits a google sheet API to store that data as a row in a google sheet. I am now building a Vite + React app to visualize the data and provide a bunch of over-engineered data about how busy my gym is. I built a nodejs script that reads from the google sheet and stores the data in a JSON file that is stored within the React app. I would eventually like to host this site and have the data live update. Does anyone have any suggestions for a light-weight way to provide the react app access to the data in a live fashion (a new row is added every 15 minutes) and I don't mind making the user refresh to get the latest data? I don't really want to spin up an entire database. One idea I had is just to make a lambda that gets all of the rows from the sheet that is accessible via API gateway and have the Vite/React app hit that endpoint anytime it's loaded, but that doesn't seem to scale if traffic were to be a bit high. Maybe if I could store the processed JSON file in S3 and somehow have the Vite app always read from the latest S3 file?...

If I make a cross platform website/app with nextJS + react native, how does the backend work?

i havent used nextJS before so its a gray area for me , will my react-native app share the same backend of my nextJS website or will i have seperate backend that both can share?

what should i know about backend before starting with nextjs?

I am learning react for a while, and I am felling pretty comfortable with building things with that and now I want to move to next.js, I have some ideas with app with simple backend and I know it may be good option for that. But i don't know anything about backend. I worked with api in my job ofc, but i dont know how databases works and how create backend. Should i get some knowledge before i am gonna start learning nextjs?...

Invalid Environment Variables

I am having an issue with accessing my ENVs within my drizzle.config.ts. I'm getting an error about invalid env variables despite them being present and being destructured in the env.mjs Each ENV is listed in the .env wrapped in single quotes....

I need help understanding request body types

Hello 👋
I need help understanding how to tell typescript what type of value I expect json to be....
Solution:
or cast using as [type]

Moving primary content when sidebar appears

Hi! I am not really sure what this would be called or considered, so my searching for something similar hasn't been too fruitful, but essentially the idea is that I am trying to create a page of cards that have items, these items are for a store, I am looking for the ability for a sidebar to appear on the right side, however the cards would account for this. Currently, the sidebar appears and blocks some of the cards, but I guess is there a "good way" of avoiding this from happening, where when...

when i deploy frontend trpc fails to compile

im trying to deploy my create-react-app with tRPC to Vercel it works perfectly fine on localhost it also works fine when i build the CRA on my local computer and just open the index.html...
Solution:
ok I know the issue but i dont know the fix. its because the frontend code needs node_modules installed on the server folder

why do I get an error when running `npm create t3-app@latest`

I have already tried clearing the cache/updating node but cant make any sense of the error message. terminal output: changed 18 packages in 34s PS C:\code\react\t3> npm create t3-app@latest node:internal/errors:490...

How to process.exit(1) from NextJS app

Currently I´m trying to `process.exit(1) from inside a nextjs app runnig in standalone mode inside a container. But I cannot get the process (and container) to be terminated. Instead I get a ``` Error: socket hang up...

App directory support

Does create-t3-app support app directory?
Solution:
Read up on that thread if you want

utils from api.useContext() not working?

Anyone know why utils from api.useContext() is not working. I cannot see any of my routers. I have restarted my TS server, still nothing. Is there some kind of setup I need to do to access this? I am trying to get the data from cache from one of my queries here, similar to this other screenshot from T3 docs: https://create.t3.gg/en/usage/trpc#-utilsapits . Is there any docs or examples that any of you suggest I read up on? Thanks in advance.

is this the correct use of usecallback?

```js const foo = React.useCallback(() => { const clientDate = new Date() const utcDate = clientDate.getTime() + clientDate.getTimezoneOffset() * 60000 const timeOffset = 5.5...

How to get singular type on trpc query

const serviceOrders = api.serviceOrders.getAll.useQuery({}); const [selectedServiceOrder, setSelectedServiceOrder] = useState<(typeof serviceOrders.data)[0]>(); it says...