3 min read

Tech Snippets #3

Welcome to the third Tech Snippets article 🥹


tRPC

In the previous snippet I mentioned htmx and how it allows you to speed up the development process by getting rid of the API layer. tRPC is different but it also allows you to move fast while having end-to-end typesafe APIs to avoid breaking stuff. While htmx is language and framework agnostic, tRPC is a TypeScript library which plays exceptional well with Next.js.

If your backend can be written in TypeScript or you are already using Next.js this is definitely worth to check out. I am currently developing a multiplayer game using Next.js and tRPC and it is a great developer experience and you can even use websockets for communicating, although I had a bit of hard time to setup a websocket server with Next.js.

tRPC - Move Fast and Break Nothing. End-to-end typesafe APIs made easy. | tRPC
End-to-end typesafe APIs made easy. Automatic typesafety & autocompletion inferred from your API-paths, their input data, & outputs 🧙‍♂️

create-t3-app

When starting a new project I am always looking for a modern template I can learn things from and build up on. However many templates are too opinionated or bloated for me. But if you are in the TypeScript / React / Next.js ecosystem or interested in it check out the T3 stack.

create-t3-app is a CLI that streamlines the setup of a modular T3 Stack app. It is an opinionated template but a minimal one and during the setup the CLI will ask you a couple of questions, so it only adds the things you actually need.

It will generate a full-stack Next.js application configured with TypeScript and makes use of Tailwind CSS, Prisma or Drizzle, NextAuth.js and tRPC. The multiplayer online game I mentioned above is also based on this T3 Stack. However, I configured a few things on my own like eslint, prettier and tests using vitest, as these are not included by default.

Create T3 App
The best way to start a full-stack, typesafe Next.js app.

Django Styleguide by HackSoftware

I am using Django as my main go-to backend web framework and this guide is the reason for it. In the past I always struggled using Django as I was unsure about how to do things "correctly". The official documentation was also no help as it does not show how to write good production code, it actually has a lot of bad practices in it or just shows too simple examples.

But this guide really opened my eyes, although I do make a few things differently. But in my opinion this guide really helps in writing a beautiful and greatly maintainable backend.

Due to this guide Django became my favorite web framework.

GitHub - HackSoftware/Django-Styleguide: Django styleguide used in HackSoft projects
Django styleguide used in HackSoft projects. Contribute to HackSoftware/Django-Styleguide development by creating an account on GitHub.

Thank you for reading and have a wonderful day ☀️