Is Next.js Worth It?Sun Aug 30 2020 - by Kirill Zubovsky
Whether you are an experienced React developer, coming from other frameworks like Vue.js or Gatsby, or you have spent most of your time in other languages like Python, PHP or Ruby, you will inevitably wonder if working with Next is worth it.
There is only so much time in the day, and there are only so many people willing to spend it exploring projects that might wither and die. Should you put energy into Next, or wait for something better?
Personally, I think the time it will take you to start is well worth the returns, and here are the top-3 advantages that I believe make starting with Next on Vercel are definite no-brainer.
Blazingly fast page rendering & deployment.
Really cool advantage of Next.js is it's ability to server-side render files, while also allowing for all the magic of react components. When a page loads, it loads HTML first and gives the user something to see before waiting to download JS elements. It's pretty smart, pretty simple, but extremely powerful. If you are curious, here is a blog post comparing server-side speed of Next.js performance to that of a typical client-side React App.
Now deployment, Next is a whole another game. What I am used to is Ruby on Rails, where an app deployment can take from a minute, to minutes. Next on the other hand takes between seconds, and some small multiple of those seconds.
Of course, while in Rails I have an app with 10,000+ pages, in Next I haven't tried anything remotely as difficult yet. I might be curious enough, and crazy enough, to move my largest app to Next and see what happens!
Used by the best and yet does not cost anything to run it
Next is a framework developed by the Vercel team to run specifically on the Vercel infrastructure. It's their clever hook, and you know what, it's working! So far, deploying on Vercel does not cost anything - here is Vercel pricing chart. As you can see, Hobby accounts are free forever, while they make most of their money from Teams and Enterprise.
Who is using Next.js in production?
According to Vercel website, companies like Airbnb, Auth0, Github, Twilio, Coinbase, Hulu, Washington Post and dozens others are using Vercel to host their content. While not all of those customers are using Next yet, a quick glance on the Next Showcase lists these companies: Netflix, TikTok, Fortnite, Nike, Hulu, Ticketmaster, Uber, Audible, Typeform, Hilton, Staples, inVision, Ferrari, Vogue, and of course SuddenSchools.
Personally, I am less impressed by the list of clients and more by the way they are charging. Giving a product for free to developers and hobbies while making the money back on the enterprise seems a win-win.
While most of us are not going to have huge traffic that costs a lot, we will be testing the framework and their service day in and day out, making incremental improvements with bug reports, and maybe even occasional PRs. As a thank you for these improvements, enterprise clients then pay a little extra. Why doesn't more software run on this model?
Getting started is a no brainer
Personally, I am a sucker for simplicity. I find it beautiful, and Next delivers.
If Node/React is your thing, you are already familiar with everything that you need to get started. On the other hand, if you are coming from other languages, you will not have any problems getting familiar. The patterns are straight forward.
All you really need to know about is:
- Components: A folder that holds reusable components of your application (otherwise known as partials in Rails).
- API.js: This is where you'd write methods to get data loaded into your application. You can pull from a database, a folder with text files, or just render a local array.
- Pages: This is where you put all the pages in your application, whether dedicated hand-coded pages, or templates for automatically generated ones.
- Public: A place for your static assets, like fonts, and images.
That's it, that's all you need to start. Isn't that marvelous?
Still need more help?
Sure, I did too, and they have thoughtfully provided a few dozen different examples, be that a simple blog, or something more sophisticated like login, analytics, or even a Dockerized instance.
Although I have outlined above why Next.js is a great choice for me, and I have previously explained how it was a very smooth shift for a Rails developer, the decision to use Next should be yours, and yours alone. I recommend giving it a try though. The time spent learning and experimenting will pay back in dividents if you choose to use it, and if you do not, the knowledge of how it works and what it is capable of is worth it in itself.
Good luck, and of course if you have any question, feel free to reach out and ask.