Choose wisely how to start your new React application.
Creating a new react application is not a simple task.
Not just because you’ll have to work hard, but mainly because you have some key decisions to make that will affect your ability to scale, collaborate, and make this app work with the tools and needs you use today — and in the future. The decision on how to create a new react application need to be made in light of your end goal — are you building a full-blown web product? A marketing site? Will there be heavy engagement with the server? How many developers will be working on this app? Should it contain components you already have in other applications and want to use? How will it be built and deployed? and so on.
The more scalable and rich your application should be in technology, integrations, features, and people working on it — the more important it is to choose a foundation that will not just let you start easily, but will serve your needs down the road and allow your application to grow.
In this article I’ve rounded up some of the best ways, frameworks and tools for creating a new react application. Some of them serve a small website and optimize for fast ramp-up, some are for global scale, and some are both.
I hope it will help you on your journey to build a React application that will make you happy, and save time and mistakes in the process. Please feel free to comment and ask or suggest anything below. Enjoy.
You can simply create a new react app without anything else.
Since React is a library and not a framework like Angular, you will naturally have to add the tools and solution you need to build a full-blown production ready application. There will be a lot of boilerplating and configs to make, but since you’re the one doing it you can make it fit your exact use case and needs.
The greatest benefit of Bit is in composability and scalability.
With Bit, your app is composable — which means it’s built in a modular way with independent (reusable) components that you can easily create, update, deploy and share. You can quickly add and integrate any new tech or tool into your app’s toolchain and workflow, and thanks to modularity you will be able to keep your system’s development fast and flexible even as you scale.
In your app, ever component and even the app component itself are developed, versioned, managed, published, developed, tested and built separately and all dependencies are managed. This is infact a full-blown monorepo experience, while each module is independent.
Every single component you make (i.e. unit of code, from a UI elements to an entire page or feature and even NodeJS or just plain js code) can be used in many different apps (via bit.cloud which is free except for enterprises), and many different developers can enjoy decoupled development and build together. It makes most of the pains of scaling app development go away and makes it easy to collaborate and keep development consistent at scale too.
Bit has built-in support and predefined templates for React apps, reusable components, express apps, node modules and more. It provides everything out of the box: nested routing with react-router, SSR, composable styling with themes, and everything else.
Bit can be used to power monorepo and polyrepo architectures, as the Bit workspace makes it easy to develop, version, test, build and release in a modular way regardless of repo architecture.
Bit comes with native support for just about any tool in the react ecosystem, including for example react-router and pre-rendering or TypeScript support, and can be easily extended to support more tools and workflows to develop, build, test, and deploy your applications any way you want.
Setting up a new react app is easy, and you get a local development UI that makes it easy to visualize and see your app development live as you build.
You can start a new react app or fork an existing example here:
For example, you can build a modular e-commerce React frontend app, creating reusable and customizable components for anything from UI and design all the way to full experiences and even authentication. You can then quickly build and manage many different e-commerce apps, which can all connect to your backend, cms, and different tools of choice.
This makes Bit the best option for apps that will need to scale, when there are many apps that share components/features and design, and where there are many applications/components/developers working together. This makes Bit a popular choice for large or growing organizations that need to work fast and consistently together at scale.
You can check out a few of quick examples:
Bit’s community and open-source website on bit.dev which is a React app built with Bit (the component highlighter to help you explore):
Bit’s blog, located on the bit.cloud website, which is also a full-blown deployed React app, and which shares components with bit.dev:
A few examples of different apps such as a basic react app, a wiki app and more:
Next.js is a popular and lightweight framework for static and server-rendered applications built with React. It includes styling and routing solutions out of the box, and assumes that you’re using Node.js as the server environment.
Next comes equipped with all the ins and outs you need for a modern React application, such as hot reloading, routing, hybrid static & server rendering, TypeScript support, smart bundling, route pre-fetching, and more.
Next puts an emphasis on communication with the server (it can also generate a static site), which makes it more scalable than similar non-composable solutions when you need a website that supports both SSR and SSG optimization. It is optimized for performance and SEO.
While nextjs is a highly optimized tool that is great for ramping up a new website and allowing a healthy interaction with the server, it is a “monolithic” framework that does not allows much composability and don’t work out of the box with modular development concepts (e.g. the entire project is a single unit with one codebase, version, deploy etc and there’s no native integration with module federation and no composability by design).
Where everyone’s fast, remix aims to be faster. It has cool stuff like nested routing (thanks to react-router) and native support for error boundries.
With Remix everything is SSR. It also allows you to modify things before rendering the page. Built on the Web Fetch API (instead of Node) it can run anywhere, for example on Cloudflare Workers, and supports serverless and traditional Node.js environments.
And here’e a nice XRay of what it means to start with Remix:
Gatsby is all about speed: well-optimized websites with great SEO and performance and great ramp-up speed to build the app. It’s essentially a React-based framework for creating fast websites. It’s all about performance, SEO, and works well with markdown as well.
Gatsby generates static HTML in advance, which can subsequently be stored on CDNs (Content Delivery Network) across the globe to facilitate quicker access. It combines tools like GraphQL, React, and react-router that lets you ramp up quickly to a well-optimized website.
Gatsby comes with hundreds of plugins that let you add different functionality, integrations, and customizations:
Gatsby also takes pride in efficient Webpack configuration and
This one is the most commonly used tool on the list, but probably the last choice for a real-world production application.
To create a project, run:
npx create-react-app my-app cd my-app npm start
Create React App doesn’t handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want.
Under the hood, it uses Babel and webpack, but you don’t need to know anything about them. When you’re ready to deploy to production, running npm run build will create an optimized build of your app in the build folder.
Besides providing something that works out-of-the-box, this has the added benefit of providing a consistent structure for React apps that you will recognize as you move between React projects. It also provides an out-of-the-box build script and development server.
Get started here:
NX is a build system for a monorepo which can work on top of a react application. As such, it can be used in addition to some other frameworks like Nextjs. If you have a Bit workspace, your app is already a multi-package monorepo by design (each component and the app etc are versioned, managed, published, developed, tested, built separately and all dependencies are managed) and everything including builds will be run for only what changed, and dependencies and configs are managed for the app monorepo — so you don’t have to add NX. So adding NX is a choice you can also make down the road.
In NX the monorepo usalluy has multiple apps and libraries. Each app in a package, making somewhat of a monolith inside a larger monolith.
Though it’s not really a foundation for a react app and the necessary features. NX’s highly optimized monorepo builds solution (only build what’s changed) will let you optimize build times for your app, and will integrate to most of the tools in the ecosystem — which makes it a good tool to check out when creating a new react app. It also has a VSCode plugin and native integration, and on top it offers “NX Cloud” to run commands across multiple machines, giving you a consolidated view of the command as if it ran locally.