owenwexler
owenwexler
TTCTheo's Typesafe Cult
Created by owenwexler on 2/8/2024 in #questions
Intercept server-side API calls with Playwright?
Exactly it, basically. Lots of necessary use cases for this in the future across various projects (mocking external API results, Supabase, etc). Theoretically I could also set up a local mock Express API to mock those things if Playwright allows for a separate testing environment/testing env variables (Cypress did in theory but I could never get it working), or maybe someone already has a package available for mocking Supabase? I’ll look into all of this and look into MSW too. Thank you!
4 replies
TTCTheo's Typesafe Cult
Created by SharpieMaster on 9/25/2023 in #questions
t3 app router when?
If create-t3-app adopts app router anytime soon, can we at least have a choice between app router and pages router until pages router is officially deprecated?
24 replies
TTCTheo's Typesafe Cult
Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
I’m still on pages and will be for the foreseeable future.
21 replies
TTCTheo's Typesafe Cult
Created by rovrav on 9/8/2023 in #questions
NODE_ENV exposed to the client? Is that okay?
.env or .env.local would be how you set any environment variables in development. Have you tried a test deployment to your infrastructure of choice? I use DigitalOcean App Platform and they have a form for entering production environment variables before build, and I can imagine Vercel and others have something similar. As for using NODE_ENV to determine the host URL, that can be handled conditionally not in an environment variable but in your backend code by something like const url = process.env.NODE_ENV === ‘production ? ‘Prod URL’ : ‘DEV URL’; conditionals don’t work in environment variables as .env is just a bash file that doesn’t recognize JS. But also if you are using Next API routes you don’t need a host URL, just call ‘/api/foo’ or whatever.
Hope this helps.
18 replies
TTCTheo's Typesafe Cult
Created by rovrav on 9/8/2023 in #questions
NODE_ENV exposed to the client? Is that okay?
The way I handle switching between the localhost url for dev and the production url for prod is to make a NEXT_PUBLIC_HOST_URL environment variable myself but this can also be handled conditionally using the NODE_ENV variable.
18 replies
TTCTheo's Typesafe Cult
Created by Lumberjack on 9/9/2023 in #questions
bun for a large scale app
Bun is still kind of a bleeding-edge technology at the moment, but hopefully the 1.0 release bleeds less. I’m going to do some prototyping with Bun next week and I’ll report back after I do.
147 replies
TTCTheo's Typesafe Cult
Created by rovrav on 9/8/2023 in #questions
NODE_ENV exposed to the client? Is that okay?
Next API routes are considered server-side code and therefore can access server-side environment variables. This can be verified by console.logging process.env.NODE_ENV in a NextJS API route.
18 replies
TTCTheo's Typesafe Cult
Created by chaeriz on 9/8/2023 in #questions
Question about learning react
The best way to learn is to build something honestly. Start small - todo list, movie list, weather app, etc.
5 replies
TTCTheo's Typesafe Cult
Created by jeff.kershner on 9/5/2023 in #questions
Drizzle with T3 and NextAuth
Using Drizzle with Node/Express was a nightmare too mostly due to the insistence on top-level await to connect to the DB, and as some of you know TLA is very broken in NodeJS right now. After a couple hours of dealing with circular errors and then not even being able to get a single one-to-one relation working I decided to stick with Just Writing SQL… at least for now. Maybe I will revisit it at a later time.
7 replies
TTCTheo's Typesafe Cult
Created by owenwexler on 8/10/2023 in #questions
Please critique my workflow for replacing an entire legacy project with a C3TA-scaffolded prototype?
Also had to delete and rebuild both my prod and staging branches due to merge issues which was annoying and took down my production site for about a minute but hey that’s why I do deploys to prod at 3am.
9 replies
TTCTheo's Typesafe Cult
Created by owenwexler on 8/10/2023 in #questions
Please critique my workflow for replacing an entire legacy project with a C3TA-scaffolded prototype?
UPDATE: I ended up doing the first thing, yeeting the legacy codebase from the repo entirely and dropping the successful complete prototype in its place in one fell swoop.
This mostly worked the way it was supposed to (project compiled and deployed mostly as expected and all end-to-end tests passed) except for a couple caveats that I will share for educational purposes: Hidden files. I used Finder to delete the legacy codebase, which I shouldn’t have done, definitely should have used the Terminal - because some hidden files were left behind from the legacy codebase, most notably .babelrc, .env, and .gitignore, which I noticed as soon as I attempted to compile the new frontend in the main repo and the compiler picked up the .babelrc file from the legacy codebase. Once I deleted the .babelrc file in VSCode and replaced the .env, .env.example, and .gitignore files with the ones from the prototype repo, everything worked and all the tests passed.
 When deploying to staging, my deployment platform (DigitalOcean App Platform) still had the old codebase in its build cache and built from the build cache using the old codebase instead of the new one. The solution to this was to force a rebuild/redeployment and check "Clear build cache". After doing this, the build was performed from the new codebase as expected. 
Command-P shows tons of deleted files from the old codebase in recently opened which is annoying. The solution to this was to clear the recently opened list out entirely by hand.
That's about it. I had another separate issue with deployment to staging that was completely unrelated to this workflow (a wrong environment variable that caused our CORS protection handler to throw a 403 on attempt to fetch from the backend - that took a bit to figure out), but everything else seems to have gone well so far. The push to production happens in about 15 minutes - wish me luck!
9 replies
TTCTheo's Typesafe Cult
Created by owenwexler on 8/10/2023 in #questions
Please critique my workflow for replacing an entire legacy project with a C3TA-scaffolded prototype?
That probably was a better way to do it, but hindsight is 20/20. I’m gonna rewrite my backend with TS and Drizzle later this year after some time off from codebase rewrites and gonna take a more incremental approach to doing that in the same repo… definitely lesson learned there. But as far as the frontend is concerned, basically right now I have what amounts to an almost-finished fully-functional extensively tested better quality clone of my own app, and once it is actually finished, I want to replace the soon to be legacy production app with the clone and make the clone the actual app, if that makes sense. Right now I’m deciding whether to yeet the legacy codebase out of the repo and drop the new “clone” in in one fell swoop, or replace it in parts (update the deps, then copy the configs, then, copy the TS components over folder by folder, etc), those are the two options I see being viable at this point, the way I’ve done things.
9 replies
TTCTheo's Typesafe Cult
Created by owenwexler on 8/10/2023 in #questions
Please critique my workflow for replacing an entire legacy project with a C3TA-scaffolded prototype?
Old app was scaffolded with create-next-app using Next 10, JS (no TS) and MUI at the end of 2020 if that helps. MUI has been the primary motivation for the rewrite.
9 replies
TTCTheo's Typesafe Cult
Created by Deniz on 5/9/2023 in #questions
create t3 app for nextjs 13.4 app dir
When it is shipped can we have an option to use app dir or not. Definitely don’t feel ready for app dir yet.
6 replies
TTCTheo's Typesafe Cult
Created by BarMemes on 5/10/2023 in #questions
Best database for a social network if starting from scratch today?
I would say either SQL or maybe even a graph databases because a social network of any kind is going to have a lot of complex relations which is definitely not a good use case for a NoSQL db.
75 replies
TTCTheo's Typesafe Cult
Created by josh-dev627 on 4/25/2023 in #questions
Client-Side Fetching with React-Query
Try this syntax: const response = useQuery([‘data’], async () => { const response = await getDataFromAPI(); // where getDataFromAPI() is your function to fetch the data from the API return response; },{ cacheTime: 1000 * 60 * 5, // 5 minutes, or however long you want these values to be staleTime: 1000 * 60 * 5, refetchOnWindowFocus: false }); That’s been working for me with RQ 4.12. I think the keys need to be arrays now if I’m not mistaken because compound keys are a thing with RQ 4 and later (and I love that feature because I can do stuff like this [‘feed’, JSON.stringify(currentFilters), ‘page=1’] for a paginated filtered newsfeed on my web app).
 Anyway hope this helps.
15 replies
TTCTheo's Typesafe Cult
Created by constraints on 4/23/2023 in #questions
Tailwind seemingly not working randomly when deployed.
There’s a few places in my prototype frontend where I’m using dynamically generated class names 😬 Thank you for bringing this to my attention, you just saved me a lot of grief and headdesking when my first deployment of this frontend happens (will be doing continuous iterative private deployments from when I get my proxy routes to the backend working [tomorrow?] until release).
6 replies
TTCTheo's Typesafe Cult
Created by xtcnorbi on 4/24/2023 in #questions
Global state management in T3.
I’m a pretty new user to Create-T3-App (using it to prototype a new refactored frontend for my web app, and if all goes well it will become the actual frontend replacing the old one entirely), but I’ve been using React-Query for server state (API responses) and Jotai for in-app state (search filters and the like) and it’s been going well so far 🤞🏻… both seem to be working out of the box in both cases. What you want to do with this cart seems like a pretty good use case for React-Query with an optimistic update.
8 replies