avatarAlex Streza

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

5322

Abstract

e">The CSS space is getting rather crowded with various options, from full on opinionated component libraries to preprocessors and utility frameworks.</p><p id="5d33">Out of this sea of convoluted ideologies, I pick <a href="https://bit.dev/"><b>Tailwind CSS</b></a>, I find it the most flexible way of writing CSS without any BS. added to the bundle size. I’d also use <a href="https://github.com/joe-bell/cva"><b>Class Variance Authority</b></a> to structure classes and better understand the props a component exposes.</p><h2 id="0adc">Build system</h2><p id="2c4c">Monoliths resurface after the microservices boom, thanks to tools like <a href="https://lerna.js.org/">Lerna</a>, <a href="https://classic.yarnpkg.com/lang/en/docs/workspaces/">yarn workspaces</a>, and, most importantly, <a href="https://turborepo.org/"><b>turborepo</b></a>.</p><figure id="7ecd"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*0Dsb9gL201oPSfhuA8HMog.png"><figcaption>Rust is the new TypeScript</figcaption></figure><p id="a5e7">I love the idea of Rust, to underline the idea, I’ve read through many lines of Rust (mainly smart contracts) and am awed at the performance it spits out, yet I ache for its difficult syntax and structure. That's why I'm jumping on the rust tooling for JS bandwagon with turborepo at its peak, followed by <a href="https://turbo.build/pack"><b>turbopack</b></a>.</p><h1 id="2e6e">Server</h1><p id="e82e">Coming from a strong React CSR (client-side rendering) background, it was a tad bit unnatural to get used to the SSR/SSG paradigm. Instead of storing the build output of a project in an S3 bucket, you run a server that responds and renders content according to the route accessed.</p><h2 id="6bbc">Backend framework</h2><p id="a18b">This moves considerable computation to the server, resulting in better client experience and SEO compatibility. Without a doubt, Next.js (hosted on <a href="https://vercel.com/"><b>Vercel</b></a>) wins the popularity battle, although Astro, <a href="https://remix.run/">Remix</a>, and even <a href="https://redwoodjs.com/">Redwood</a> are closing in on more niche use cases.</p><p id="0695">The API is then moved to Next API handlers, and in the latest version, directly within React server components thanks to the new <a href="https://github.com/reactjs/rfcs/pull/229">RFC</a>.</p><h2 id="412e">API</h2><p id="40c2">Instead of running a code generation tool like <a href="https://www.the-guild.dev/graphql/codegen">graphql-codegen</a> or <a href="https://orval.dev/">orval</a> on an API or GraphQL schema, I prefer implementing a <a href="https://trpc.io/"><b>trpc router</b></a> to share types between server and client.</p><figure id="1eb0"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*5szSFP4b0_4dzIE6nAbWXw.png"><figcaption>Type generation is great but you don’t actually need it</figcaption></figure><h2 id="283c">ORM</h2><p id="6cc8">Querying databases is another largely discussed topic, my pick is by far the most optimized yet considered robust enough to cover most needs. <a href="https://www.prisma.io/"><b>Prisma </b></a>transitioned throughout the years from a GraphQL-only solution to a more SQL-oriented ORM, but note that it’s rather heavy and can increase server times considerably if left unchecked.</p><h1 id="31d1">Storage</h1><p id="1e5c">Debating the best storage solution is a no-man's land of technology: NoSQL, SQL, caching, object storage, and so many other terms that it's like a full-fledged word war. Honestly, I don’t like NoSQL, document databases like Mongo, or “scalable” proprietary solutions like Firebase.</p><figure id="fd3c"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*2bHGWaLc1RosWOzeddYqvw.png"><figcaption>Great platforms to spin up databases ASAP</figcaption></figure><h2 id="d184">Database</h2><p id="9838">I'm an SQL boomer who prefers simple storage, such as <b>MySQL</b> or <b>Postgres</b>, depending on whether I need map-related features or not. Where I host those databases, well, that’s another story.</p><p id="f163" type="7">You won't find me connecting cables in my backyard Raspberry PI farm nor building Amazon-hosted services from the ground up.</p><p id="db37">I love all the platforms that provide beautiful developer experiences and unreal performances without having to hire a DevOps engineer with 17 certificates and 3 cats.</p><h2 id="44ee">Database hosting</h2><p id="1a7f">For MySQL, I go with <a href="https://planetscale.com/"><b>PlanetScale</b></a>, which offers instant scaling, smooth branching, and easy integration with something like Prisma.</p><p id="ee4e">For Postgres, it comes down to whether I’m lazy and don’t want to own auth so I go with <a href="https://supabase.com/"><b>Supabase</b></a>, otherwise, it’s <a href="https://railway.app/"><b>Railway</b></a><b> </b>with their insane value proposition (go there and create a container without even being authenticated, it’s crazy).</p><h2 id="e73b">Caching</h2><p id="13c4">The enigma of caching is solved as always by adding <a href="https://redis.io/"><b>Redis</b></a> cache layer to any application including in this stack, the speed of a key-value store is hardly ever rivaled. I’d look into <a href="https://upstash.com/"><b>Upstash</b></a> since they offer a serverless solu

Options

tion to Redis so setting up is as trivial as possible.</p><h2 id="a372">Object storage</h2><p id="b95e">The only component for which I would consider AWS from the start is object storage. <a href="https://aws.amazon.com/s3/"><b>S3</b></a> is way too cheap not to use, and presigned URLs make uploading for users a piece of cake. The one place where I don’t use S3 is blog images, I have a <a href="https://www.cloudflare.com/en-gb/products/cloudflare-images/"><b>Cloudflare Images</b></a> subscription, and it’s blazingly fast and optimized.</p><h1 id="de53">3rd Party</h1><p id="fc45">The tools I listed below can be excessive for most MVPs since they are more of a long-term, scalable solution for a small-medium start-up with no DevOps or Infra team and a preference for JavaScript tooling.</p><figure id="2975"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*8fyN5fOuqgivMB9DQvV3cQ.png"><figcaption>Don’t be afraid of the 3rd party</figcaption></figure><h2 id="05b8">Analytics</h2><p id="9227">Tracking user behaviour in application isn’t only about big tech collecting data to sell to brokers for unethical forms of marketing but also for improving the features of an application as well as logging potential bugs. I wouldn’t start with something heavy like Google Analytics since it’s a bit harder to configure.</p><p id="a6f5"><a href="https://splitbee.io/">Splitbee</a> is a bright new analytics solution, recently acquired by Vercel, that enables GDPR & EPR friendly analytics with light <4kb JS bundle. The JS SDK allows recording custom events, funnels, and even creating notification automations in a non-convoluted UI (looking at you GA).</p><h2 id="ce29">Payments</h2><p id="1238">Payments. It’s all about money in the end, right? How can you provide the best payment experience from a UI and UX standpoint? Nowadays <a href="https://stripe.com/"><b>Stripe</b></a> is the clear winner for that, if the sneezy gradient animation on the landing page didn’t win you over when you try the SDK you’ll certainly fall for it.</p><p id="b9fe">Real time updates, insane customization and beautiful DX are some of the features Stripe has. To be honest this sounds too much like utopic propaganda, my experience with Stripe was amazing but biased since I haven’t tried any other solution so take it with a grain of salt.</p><h2 id="71b9">Mails/Newsletter</h2><p id="2285">Since the day of old mails have gained a sort of reputation for being largely despised yet rather effective for marketing and connecting with your user base. Sending notifications covering updates to the product or even keeping a newsletter can get expensive.</p><p id="ffd9">Platforms like <a href="https://mailchimp.com/en-gb/">Mailchimp</a> and <a href="https://www.mailjet.com/pricing">Mailjet</a> are known in the field as rather expensive, <a href="https://www.sendinblue.com/">Sendinblue</a> has the best free plan I found so far with <b>300 e-mails</b> a day limit, more than enough to get to a sustaining revenue.</p><h2 id="62fb">Error logging</h2><p id="024c">Even the giants of the field have <a href="https://www.theverge.com/2020/5/7/21250689/facebook-sdk-bug-ios-app-crash-apple-spotify-venmo-tiktok-tinder">errors</a>, since such systems are built by humans and errors are humane. That’s why we need to implement methods to log those errors so we can understand and fix them.</p><p id="c5f7"><a href="https://www.axiom.co/">Axiom</a> is my favorite so far as it’s focused on the server compared to others like <a href="https://www.honeybadger.io/">Honeybadger</a> or <a href="https://sentry.io/welcome">Sentry</a>, a beautiful interface and let’s not forget, <b>0.5 TB!</b> of <b>FREE</b> log storage, if you need an upgrade from that plan you better be looking for new developers.</p><h2 id="02b1">Support</h2><p id="aa58">Expensive AI-powered chat bot solutions for instant support and collection of feedback from users. Let me rephrase that, insanely <b>annoying</b>, often <b>useless</b> AI support instead of a clear customer support hotline with <b>REAL</b> humans.</p><figure id="3fea"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*wIr_VvDMGwnJpWT6-6emwg.png"><figcaption>Prompt: “a Renaissance era oil painting depicting modern artificial intelligence replacing customer support call centers”</figcaption></figure><p id="e648">With that description out of the way, I won’t be paying the base price tier of <b>$1100!</b> a month for Integromat and would look into something like <a href="https://www.chatwoot.com/">Chatwoot</a> (open-source) or just building a feedback widget myself similar to the underrated, yet marvelous tutorial by <a href="https://www.youtube.com/watch?v=LRj8kHinjYk">Mahmoud at Next Conf</a>.</p><p id="6d67">I said <b>“I”</b> so many times in this article yet I must mention this tech stack is highly opinionated and subjective, none of the components (other than TypeScript and probably Vercel) are <b>mandatory</b> and everything else is <b>interchangeable</b>.</p><p id="3816">Do you have any questions or suggestions? Feel free to reach out! 🚀. If you want to stay updated on my future writings follow me on <a href="https://medium.com/@alex.streza/membership">Medium</a> or <a href="https://twitter.com/alex_streza">Twitter</a>.</p></article></body>

The Hunt for the Perfect JavaScript Tech Stack

It may not be what you think

JavaScript has come a long way and is without a doubt the most used programming language, at least on Earth. It’s become the fastest way to build a digital product (with code), but with millions of developers worldwide, there are also countless opinions on what’s the best tech stack.

With no further ado, let’s see the beautiful (slightly biased) diagram that I spent half an hour sketching, which gave me the idea for writing this article. In its entirety, the stack is very opinionated; it’s more of an extension of create-t3-app with guidelines set around 3rd-party and storage integrations.

One diagram to rule them all

I’ve split the stack into 4 categories — client, server, storage, and 3rd party — to isolate interchangeable components. Let’s cover my picks for each in a detailed and subjective manner that no one asked for.

Client

A client application should have the following: accessibility, good performance, great SEO, rich features, and a ton of JavaScript. Wait a second…

We should reduce JS payloads as much as possible without reducing interactivity. I will go down the Astro rabbit hole in another article, so let’s forget about the JS payload bonanza of modern apps.

The fact that each week a new JavaScript framework is born is a meme but not a myth, fortunately, I’m trying to be on bleeding edge (responsibly), so I won’t go over any “Born on a Monday Died on a Saturday” sort of framework.

JS developers being JS developers

Frontend library

I chose React for the same reason I chose JavaScript: it’s extremely popular; there are a ton of developers available if you need help or hire, laying the groundwork for a future Unicorn is straightforward (a lot of bad performing spaghetti code that will have to be replaced with Rust later on).

Programming language

TypeScript is another braindead choice even for the most unopinionated JS developers; writing future-proof code and making onboarding new developers practically automated are a few of the benefits of having types. Let’s not forget that DX is through the roof, as we can clearly see in the JamStack Community Survey (bubble no. 2).

Source: Jamstack Community Survey 2022

After the brilliant Next.js is a back-end framework talk by Theo at Next Conf. I decided to move it to the server section but was too lazy to update the diagram, crocodile tears.

CMS

Most services require an admin application to manage the data presented by the front-facing app. For B2B products, such dashboard views are mandatory.

A controversial decision is coding this yourself, which can be a big overhead compared to a CMS like Sanity or Directus. Truthfully, I haven’t tried any CMS or admin panel yet since I prefer owning the code and infra (as well as shared branding).

Sanity & Directus are cool but the learning curve not so much

UI library

A shared component library is often implemented for reusability’s sake in the case of multi-project platforms that want to keep the branding consistent and keep it all DRY. There are a couple of giants in the field, Storybook and Bit, neither of which I’d use for starters (although I am inclined to pick Storybook) because, as quoted, “Theo doesn’t like Storybook” and my tech (life) decisions are strictly guided by his.

Storybook & Bit are overkill for most projects

CSS framework

The CSS space is getting rather crowded with various options, from full on opinionated component libraries to preprocessors and utility frameworks.

Out of this sea of convoluted ideologies, I pick Tailwind CSS, I find it the most flexible way of writing CSS without any BS. added to the bundle size. I’d also use Class Variance Authority to structure classes and better understand the props a component exposes.

Build system

Monoliths resurface after the microservices boom, thanks to tools like Lerna, yarn workspaces, and, most importantly, turborepo.

Rust is the new TypeScript

I love the idea of Rust, to underline the idea, I’ve read through many lines of Rust (mainly smart contracts) and am awed at the performance it spits out, yet I ache for its difficult syntax and structure. That's why I'm jumping on the rust tooling for JS bandwagon with turborepo at its peak, followed by turbopack.

Server

Coming from a strong React CSR (client-side rendering) background, it was a tad bit unnatural to get used to the SSR/SSG paradigm. Instead of storing the build output of a project in an S3 bucket, you run a server that responds and renders content according to the route accessed.

Backend framework

This moves considerable computation to the server, resulting in better client experience and SEO compatibility. Without a doubt, Next.js (hosted on Vercel) wins the popularity battle, although Astro, Remix, and even Redwood are closing in on more niche use cases.

The API is then moved to Next API handlers, and in the latest version, directly within React server components thanks to the new RFC.

API

Instead of running a code generation tool like graphql-codegen or orval on an API or GraphQL schema, I prefer implementing a trpc router to share types between server and client.

Type generation is great but you don’t actually need it

ORM

Querying databases is another largely discussed topic, my pick is by far the most optimized yet considered robust enough to cover most needs. Prisma transitioned throughout the years from a GraphQL-only solution to a more SQL-oriented ORM, but note that it’s rather heavy and can increase server times considerably if left unchecked.

Storage

Debating the best storage solution is a no-man's land of technology: NoSQL, SQL, caching, object storage, and so many other terms that it's like a full-fledged word war. Honestly, I don’t like NoSQL, document databases like Mongo, or “scalable” proprietary solutions like Firebase.

Great platforms to spin up databases ASAP

Database

I'm an SQL boomer who prefers simple storage, such as MySQL or Postgres, depending on whether I need map-related features or not. Where I host those databases, well, that’s another story.

You won't find me connecting cables in my backyard Raspberry PI farm nor building Amazon-hosted services from the ground up.

I love all the platforms that provide beautiful developer experiences and unreal performances without having to hire a DevOps engineer with 17 certificates and 3 cats.

Database hosting

For MySQL, I go with PlanetScale, which offers instant scaling, smooth branching, and easy integration with something like Prisma.

For Postgres, it comes down to whether I’m lazy and don’t want to own auth so I go with Supabase, otherwise, it’s Railway with their insane value proposition (go there and create a container without even being authenticated, it’s crazy).

Caching

The enigma of caching is solved as always by adding Redis cache layer to any application including in this stack, the speed of a key-value store is hardly ever rivaled. I’d look into Upstash since they offer a serverless solution to Redis so setting up is as trivial as possible.

Object storage

The only component for which I would consider AWS from the start is object storage. S3 is way too cheap not to use, and presigned URLs make uploading for users a piece of cake. The one place where I don’t use S3 is blog images, I have a Cloudflare Images subscription, and it’s blazingly fast and optimized.

3rd Party

The tools I listed below can be excessive for most MVPs since they are more of a long-term, scalable solution for a small-medium start-up with no DevOps or Infra team and a preference for JavaScript tooling.

Don’t be afraid of the 3rd party

Analytics

Tracking user behaviour in application isn’t only about big tech collecting data to sell to brokers for unethical forms of marketing but also for improving the features of an application as well as logging potential bugs. I wouldn’t start with something heavy like Google Analytics since it’s a bit harder to configure.

Splitbee is a bright new analytics solution, recently acquired by Vercel, that enables GDPR & EPR friendly analytics with light <4kb JS bundle. The JS SDK allows recording custom events, funnels, and even creating notification automations in a non-convoluted UI (looking at you GA).

Payments

Payments. It’s all about money in the end, right? How can you provide the best payment experience from a UI and UX standpoint? Nowadays Stripe is the clear winner for that, if the sneezy gradient animation on the landing page didn’t win you over when you try the SDK you’ll certainly fall for it.

Real time updates, insane customization and beautiful DX are some of the features Stripe has. To be honest this sounds too much like utopic propaganda, my experience with Stripe was amazing but biased since I haven’t tried any other solution so take it with a grain of salt.

Mails/Newsletter

Since the day of old mails have gained a sort of reputation for being largely despised yet rather effective for marketing and connecting with your user base. Sending notifications covering updates to the product or even keeping a newsletter can get expensive.

Platforms like Mailchimp and Mailjet are known in the field as rather expensive, Sendinblue has the best free plan I found so far with 300 e-mails a day limit, more than enough to get to a sustaining revenue.

Error logging

Even the giants of the field have errors, since such systems are built by humans and errors are humane. That’s why we need to implement methods to log those errors so we can understand and fix them.

Axiom is my favorite so far as it’s focused on the server compared to others like Honeybadger or Sentry, a beautiful interface and let’s not forget, 0.5 TB! of FREE log storage, if you need an upgrade from that plan you better be looking for new developers.

Support

Expensive AI-powered chat bot solutions for instant support and collection of feedback from users. Let me rephrase that, insanely annoying, often useless AI support instead of a clear customer support hotline with REAL humans.

Prompt: “a Renaissance era oil painting depicting modern artificial intelligence replacing customer support call centers”

With that description out of the way, I won’t be paying the base price tier of $1100! a month for Integromat and would look into something like Chatwoot (open-source) or just building a feedback widget myself similar to the underrated, yet marvelous tutorial by Mahmoud at Next Conf.

I said “I” so many times in this article yet I must mention this tech stack is highly opinionated and subjective, none of the components (other than TypeScript and probably Vercel) are mandatory and everything else is interchangeable.

Do you have any questions or suggestions? Feel free to reach out! 🚀. If you want to stay updated on my future writings follow me on Medium or Twitter.

JavaScript
Startup
Technology
Programming
Nextjs
Recommended from ReadMedium