Syntax Video
Full Stack React without Next.js
Intro
love it or hate it nextjs is a Mainstay in the world of react however there are alternatives and in this video I'm going to show you 11 different options for building fullstack applications with react so let's dive in my name is CJ welcome to [Music] syntax now I have broken this list down into three separate sections we have production ready experimental and bleeding edge and then also build your own framework and first up in the list our production ready framework so these are Frameworks that have stable releases really good documentation and you can trust that if you use these in production you're not going to run into too many issues first up on the list is Blitz JS now I did say alternatives to nextjs and Blitz JS is actually built on top of nextjs but it provides a lot of the things that nextjs is missing and they call themselves The Missing fullstack toolkit for nextjs and they provide things like authentication built right in you don't have to install a
Types of Frameworks
Production Ready Frameworks
Blitzjs
separate Library so there's Blitz off for that they also have their own RPC Library that's built in that allows you to have full stack type safety for all of your requests from the client and server they also have built-in utilities for working with Prisma they also have a built-in CLI tool with lots of commands for generating and creating the various types of things that you do on a regular basis when working on a full stack react app so definitely check out Blitz JS if you want a more full featured way to work with nextjs next on the list is remix they've been around for a while they're from the same people that brought you react router and remix is probably most well known for being able to do nested routing really well they also do parallel data loading of assets and uh they're pretty sweet so definitely check them out and if you check out their docs they have a 5-minute quick start so you can just learn how they do things there's also a more in-depth 30-minute tutorial and one of the things I like about remix is how they handle data loading between the client and the server so if you check out full stack data flow here under discussion topics they have the idea of loaders components and actions so your
Remix
component actually exports three things it has a loader component and action the loader is something that's going to run on the server side and can do things like database lookups and stuff like that you then have your component which is the actual UI and they have this built-in cook called use loader data where you specifically pass in the type of that loader and then you're able to call that from either the client or the server and then they also have actions which are kind of like for mutation so basically you can do things in response to like a post request from a form and those actions can do things on the server handle form data that kind of thing so they definitely have a fresh look on this whole full stack data flow now you might have heard that remix is actually getting renamed to react router and merging with react router but that actually won't change how you write things essentially all that's going to change when this happens is instead of importing from remix you're going to be importing directly from react router so if you decide to use remix you won't have to worry too much about that change it's really just going to be a change of an import next on the list is Astro now you may think of Astro as just for Content based websites or like just for
Astro
static site generation however they have come a long way and they have a lot of things built in so if you check their docs they actually have this section called ond demand rendering so essentially you can have an astro app where parts of it are server rendered and in your config you basically just say that the output is server this will then generate files that can be deployed to like cloudflare workers or versell or be exported to run inside of nodejs and this will give you SSR and Astro has a ton of stuff built in for like data fetching they also have their own database Library built in so it's definitely worth checking out to see if what they provide will will fit your full stack needs now last on the list of production ready Frameworks is Redwood JS now Redwood JS is a little bit different from these others because it's kind of an assemblage of various battle tested and production ready libraries with a lot of opinions and conventions thrown in so essentially your application will be a client rendered react app that talks to a graphql API that uses Prisma to talk to the database it's all typescript it uses J for testing and also storybook for UI component testing uh but like I said it
RedwoodJS
has a lot of opinions and conventions so it's not just a matter of installing these libraries they have examples and ways of working with all of these libraries in a more streamlined way so if that interests you definitely check out their tutorial here next up we have Frameworks that are either experimental or bleeding edge so these are things that aren't necessarily production ready they may be like sub version one and you're basically taking some risks if you decide to start building with these now but for some people that might be okay depending on what you're trying to build and first in the list is Redwood JS now I talked about R Redwood JS as production ready but they are working on a release called Big Horn that's going to introduce a lot of the things that people have been wanting from Redwood that make it more in line with the kind of things that nextjs does like server side rendering static site generation that kind of thing and so you can take a look at their road map you can see some stuff is still in progress some stuff is planned so that will be coming soon but they do have a repo that you can clone down to kind of try out some of these features in the latest version of Redwood next on
Experimental / Bleeding Edge Frameworks
RedwoodJS Bighorn
rakkas
the list is rakus JS they label themselves as a bleeding edge react framework they have servers side rendering static side generation apil list data fetching file based routing they have all the stuff that you would expect in a full stack framework but it is more bleeding edge one of the things that caught my attention is how they do data loading so if you take a look at this Ed serers side query hook essentially it allows you to have serers side code inside of a hook but actually use that hook inside of what you would call like a client side component so this is very different from like react server components where you're calling the stuff like at the top of a server component this lets you make your datab B lookups or whatever server code you would want inside this hook and when it gets built and bundled all of that is only going to be run on the server and it's going to get turned into like an API call um so this is super interesting it's an interesting take on how we can basically combine server side and client side code in a more streamlined way next up is a framework called waku and they call themselves the minimal react framework and the whole idea here is what if we had a framework that from the
Waku
start was using react server components and so when you look at the docs it'll look very similar to nextjs but it uses uses react server components by default and so a lot of this stuff will seem super familiar to you if you've used nextjs but one of the things I like is this idea of shared components and so when I've been working inside of nextjs one of the most cumbersome things is having to jump back and forth between client and server components or going in and relabeling a component as a client component if I need it in a specific spot but with waku they have this idea where if a component meets all of the rules of server and client components it can be imported in either and so a lot of times you might have let's say just really like a presentational component it accepts some props and then renders out some jsx this could run on the client or the server there's nothing server or client specific about this so inside of waku you don't have to label this as a client component or a server component you can just use it in either place so that's really cool the other interesting thing is this idea of weaving patterns so you can have specific components that get
pre-rendered as just static pages but then you can also have pages that get server rendered so you can mark them as Dynamic and then this code is always going to run on the server so it's definitely early days for waku uh but it's worth checking out so you can look at their road map you can see they're a little bit ways from V1 Alpha uh but it's pretty awesome and you might have noticed the Creator is daishi so daishi is also the one who brought you zand and joai so they're definitely well respected in the world of react and have some battle tested production ready libraries that many apps use in the react ecosystem as well next up we have vik they call themselves the vbase front and framework but they do support static site generation serers side rendering so they really are kind of like a full stack framework and uh they also work with View and solid but they have a a starter template for react and if you check out their guides they have all kinds of information on integrating with various types of things like data loading so for instance you could integrate with trpc or graphql or grpc
Vike
and specifically their preferred way of doing it is with Tel aunk so this is a library built by the same maintainers that is essentially an RPC Library where you can Define some functions in your server side code call those functions directly in your client side code and when the code gets built that actually gets turned into like API requests or RPC calls uh so that's pretty cool as well uh if you want to compare it to nextjs they actually have a table on their site that says what's built into vik versus how you do those same things inside of nextjs so definitely give vik a look last in this list is a plugin for vit called SSR boost and so you can add this to an existing react and V application and it will allow you to do server side rendering specifically with react router now if you take a look at their docs you can see that it is literally just a plugin that you then add to your vit configuration so this is actually just a really nice onramp if you have an existing client rendered react app with vit and you want to start to add some serers side rendering to it so you just add the plug-in you're then going to have two entry points your
Vite SSR Boost
client entry point and your server entry point update your scripts in your package.json and you're good to go from there like I said this does integrate with react router so essentially you're taking a a client rendered react and react router app and turning it into a serers side rendered app now these last few I am labeling as build your own framework because essentially they kind of provide the building blocks but you would actually have to add a lot more config and a lot more things to get a more full-featured nextjs style framework and the first in this list is Vinci now you might have heard of Vinci because this is actually used under the hood for solid start so that is the full stack framework used with solid JS but if you look in the Vinci docs they actually have examples for doing server components and serers side rendering and it can essentially be used as either a vit Plugin or a full-on replacement for vit to give you these features now the best way to get started is to kind of take a look at their examples to see how they do these various things so if you go into the react folder they have an example of RSC they also have SSR and
Build Your Own Framework
vinxi
Vinci is is based on this idea of routers so you might have like a static router a single page application router a serers side router and then it brings those all together so let's look at the basic SSR example here and then look at our app config so we're pulling in create app from Vinci and essentially that replaces the defined config that comes from vit and then we Define all of our routers so we have a static router that serves up the files in our public folder we have a client router that's going to do client side routing uh in this specific example they also integrate like websockets but then we also have a serers side rendering router as well uh but if you look at the code it is a lot more involved because like I said they provide the basic utilities but it's still up to you to kind of bring it all together so for for example if we look at the piece that gives us serers side rendering we're actually bringing in render to pipeable stream directly from reactdom and then using that in conjunction with some of their other helper libraries to help us like add in assets that need to be rendered out but ultimately we're kind of still
handling the incoming event on our own and we can set headers and everything else so it's a bit lower level but highly customizable because you have full control but then for example if we look at the client entry point this is bringing in like hydrate root which comes from reacton but then we're combining that with their helper functions like create assets and get manifests that basically allow us to load in dynamically loaded client side files and different things like that into our application that might be rendering completely on the client or might be hydrating a server rendered app as the Dom kicks in when a page is loaded so Vinci is definitely worth looking at if you kind of have some ideas of your own and maybe you don't like how some of these other Frameworks are doing it you can kind of build from the ground up now the last in this list is ssrx so it's a essentially a v plugin but they have a lot of built-in utility functions that make it a lot easier to get up and going so if we take a look at this renderer package we can see how we can get up and going with a serers side
ssrx
rendered streamed react app so we have our app. TSX specifically it uses this create app from ssrx but it gives us back our client Handler and server Handler so these are the the two handlers that are used specifically when the app is behaving as like a single page application that is what the client Handler would be used for but then when it's being handled in a server environment for serers side rendering the server Handler would be used so you define your app in this way you could actually like import a react component and riter it out there and then you have your client entry point this is specifically the code that's going to be running on the client so it's using hydrate root from reactdom so you could have like a server rendered page and then this would get called to kind of have all of the JavaScript and interactivity kick in and then you also have your server entry point which is specifically using that server Handler you define so it's just as easy as having these three files to get your own server rendered single page application hybrid rendered app all all up and going but the beauty of ssrx is they also have plugins so if you take a look down here
they have plugins for like react router and trpc and a few of the other things that you might want to integrate in your full stack app so that's it for this list of nextjs Alternatives now if you'd like to see me dive deeper into any one of these let me know down in the comments and if you've tried any of these I'd like to know your experience as well let me know in the comments but that's all I have for now we'll see you in the next one [Music]
Thanks!
Quote it with credit and a link. Quoting Syntax