post-cover
Weave Addendum
Looking over design decisions
Written Mon Jul 31 2023
By Michael Freno
69 Hits
Weave Addendum
Looking over design decisions

Looking at what was done wrong.

Weave was made with the t3 stack (typescript, next.js, prisma, tRPC, tailwind, NextAuth) and at the time it was supremely helpful getting started with nextjs and a project that had a large scope and with much larger ambitions than anything I had done before.

Problems with t3

  1. The main issue I had with t3 was the use of prisma (while this is optional, I had no reason to assume it to be an issue). I decided that it would work well as I had never written raw SQL, previously I had only used python based backends, flask and Django and hadn’t need to write SQL. This was a massive mistake as prisma works very poorly in a serverless environment, it’s got a very slow cold start, which is bad enough but it gets worse. Prisma doesn’t do actual sql joins. I never would have guessed that would be the case but it was a very good learning experience for future as I will never not use such an important piece of a stack, how interactions with my database so flippantly. Plus just writing SQL (which I’ve done for this website), really isn’t that hard anyway.

  2. NextAuth is my only other significant regret and not for any kind of reason like prisma. NextAuth does what it advertises and does it quite well. It makes authentication very easy and secure so no regrets on that front. My only regret is that when trying to hook in desktop or mobile, it becomes a nightmare. I just couldn’t get it to work with leptos(rust by the way) and expo wasn’t looking great either before I gave up on it as it was simply taking up too much time and the mobile/ desktop was just going to be for a learning experience anyway. It did however look after some digging that it wouldn’t look too painstaking with electron but I really didn’t want to use electron as I hate using every electron app on my computer.

What was good about t3

  1. Without reservation my favorite thing in t3 was hilariously one of the smallest things, it’s environment variables solution. https://env.t3.gg/ It’s great. It uses zod under the hood to make sure that you have envs you expect in place and you can also put in restrictions for length etc to make sure it is in the form you expect. Small but super handy and easy to use.

  2. It took some time to get used to and I haven’t used it again because as of writing this it doesn’t play well with next13 yet, but I really enjoyed using tRPC. Its main drawback is being a little weird to learn and quite a lot of boilerplate (much of which t3 takes care of for you), but is super user as it essentially upgrades your apis to superJSON and keeps your frontend in the know at the same time so no need for type casting .json() from any, all your potential api returns are known on the frontend. Super helpful and will most likely use again.

  3. Hesitant to include this because I used it before and will always and forever use it in the future: tailwind. It’s great, not question about it, if you write css and haven’t used it, why? It’s just a bunch of utility classes that are standard stuff, makes maintaining frontend code and creating it super easy. It also cleans up what you don’t use so you don’t ship unnecessary css to a users device. It would be number 1 best thing if it wasn’t so popular already and a basic guaranteed use before hand.

Other design decisions

  1. My other main regret was not understanding how next actually worked. I had used react once before making weave and it was a very simple SPA and I was thinking in the same model when creating Weave, not understanding how <Link> tags in next work to create what is essentially SPA levels of smooth navigation, but with none of the down sides of a SPA. Weave's /app page should have been made with every different server being a different url, but it was made effectively as a SPA and that was a massive mistake.

  2. Next13 with its app dir was released right around when I was starting Weave and it seemed to confusing to use (Weave uses next 12). Having now used it to make 3 websites now(this one included) I deeply regret not spending the time to learn it right from the start.

Wrapping up...

Making Weave was a massive learning experience and while I wish I had chosen some different choices at the start it was still a lot of fun to create and made me a much better developer for having created it :).

Comments
No Comments Yet