Server-side rendering (SSR) is a critical concept in web development that is gaining popularity again after Client-side rendering (CSR), especially with frameworks like Next.js. Its is also known as dynamic rendering that generates HTML on the server for each request. We can use SSR in pages where data changes based on user-specific information and each time we get the updated page based on each request.
Evolution of Server Side Rendering-:
1) Static HTML Pages (1990s)
In the early days of the internet, known as Web 1.0, most web pages were static. Developers would manually write HTML pages or use tools to generate them. These pages were then served using web servers like Apache or nginx. This can be considered the earliest form of a static site generation (SSG).
2) Dynamic HTML Pages (Late 1990s to 2010s)
During a period when websites were becoming more interactive, technologies such as CGI, PHP, and ASP were introduced. These allowed webpages to serve data dynamically based on user inputs and forms.
At that time, server-side rendering was dominant. This involved serving dynamically generated HTML pages to browsers with preprocessed data. This was achieved by running PHP scripts that access the database and execute backend logic to serve HTML pages.
3) Single Page Applications(SPA) or Client Side Rendering (CSR) (2010s)
With the advent of modern JavaScript libraries and frameworks such as React.js, Vue.js, and Angular, there has been a shift towards Client-Side Rendering (CSR). This means that instead of the backend server handling all the computation and generating a page for each request, it now sends raw HTML pages and their JavaScript files to the client machines. The logic then runs on the client machines, making API calls to the backend servers and updating the UI dynamically.
Drawbacks of Client Side Rendering (CSR):-
Let’s understand with the help of diagram below. We can see couple of problems:
1) Blank Page : When a user requests a webpage, they see a white flash before the page renders.
2) Waterfall problem : As shown in the diagram, multiple fetch requests are invoked in a sequential manner, and the data is received one after another, not in parallel.
3) Not SEO-optimized : If the content is generated and rendered on the client side, it may be difficult for web crawlers to index the website. However, this may not be true for modern web crawlers that have the ability to run JavaScript and wait for the HTML page to generate content.
Importance and Benefits of Server-Side Rendering(SSR):
The introduction of SSR in the modern React framework, Next.js, addresses the issues encountered with CSR and offers the benefits of server-side rendering. This makes developers lives easier by allowing them to write components and server-side logic within the same application due to its full-stack framework environment.
1) Enhanced User Experience: SSR significantly reduces the initial page loading time by generating and delivering HTML pages from the server. This results in a more responsive webpage that is ready to use without waiting for content to appear that is no blank screens or loading spinner, thus enriching the user experience.
2) SEO Friendly: When web crawlers request a page, they receive fully structured HTML pages with all the data. This is preferred for SEO optimizations and makes it easier for search engine bots to search for meaningful keywords to index your pages.
3) Improved Performance: SSR reduces the time to first byte (TTFB), resulting in faster page loads and eliminating the waterfall problem. This also improves the performance of our application, particularly for users with slow network connections or less powerful devices.
In Next.js, there is a built-in functionality to implement SSR to our app, thanks to app-based routing system. When a user requests for any page, the request goes to the app and it starts generating the HTML page on the server itlsef and starts running the server-side logic and making the API calls(if any) and gives back the fully rendered HTML page with all the neccessary content. This helps to reduce loading time and making user interactivity much faster.
To learn more about what happens when client gets Server side generated HTML page from server and how browser responds or what is hydration,you can read it from here.
Static Site Generation (SSG)
Static site generation is the process of creating web pages at build time. When we use “npm run build” to create the build in Next.js, it generates pre-rendered HTML pages with or without data, depending on the requirements.
Static site generation is useful when the data doesn’t change very often. These pages can also be cached by CDNs, leading to faster page loads and reduced server load. This is in contrast to server-side rendering, where the page is generated at the server with each request, resulting in higher server costs.
SSG is easier to scale than SSR because of its caching. In Next.js, the page is pre-rendered will always be updated on each request, making it slower. This is because pages in SSR cannot be cached by CDNs.
Conclusion
Next.js’s Server-Side Rendering provides a number of advantages, including enhanced SEO and performance as well as a more stable and manageable codebase. Through comprehension of SSR’s operation and use of its potential, developers can design web apps that provide an enhanced user experience. As you learn more about Next.js, think about using SSR in your projects to take advantage of its benefits and make your apps run faster.
170 Comments
Thanks so much for the blog.Much thanks again. Cool.
I am now not positive where you’re getting your info, but great topic. I needs to spend some time studying much more or understanding more. Thanks for magnificent info I was looking for this info for my mission.
Generally I don’t read post on blogs, but I would like to say that this write-up verypressured me to try and do so! Your writing taste has been amazed me.Thanks, very nice article.Check out my blog post :: caradaftarayams128.com
I blog often and I seriously appreciate your content. The article has truly peaked my interest. I am going to bookmark your blog and keep checking for new information about once per week. I subscribed to your RSS feed too.
media is a impressive source of information.
already knew that but we kept trying, now. We even got a friend who
I appreciate you sharing this blog post. Great.
Im obliged for the post.Really looking forward to read more. Really Great.
Im grateful for the blog post.Really looking forward to read more. Want more.
Appreciate you sharing, great post.Really looking forward to read more. Really Cool.
examples of dissertation dissertation example
I think this is a real great post.Really thank you! Really Great.
Thanks for the blog.Really thank you! Fantastic.
Awesome issues here. I’m very happy to see your post. Thanks so much andI am looking forward to touch you. Will you kindly drop mea e-mail?
Hello.This article was extremely interesting, particularly since I was looking for thoughts on this issue last Saturday.
This is a topic that’s near to my heart…Best wishes! Exactly where are your contact details though?
I was recommended this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks!
Hi my friend! I wish to say that this post is amazing, nice written and include almost all important infos. I would like to see more posts like this.
Farmacia online miglior prezzo: Farma Prodotti – farmaci senza ricetta elenco
comprare farmaci online con ricetta
I really liked your blog article.Really looking forward to read more. Fantastic.
Hi there, yup this post is really nice and I have learned lot of things fromit on the topic of blogging. thanks.
п»їFarmacia online migliore http://farmaprodotti.com/# п»їFarmacia online migliore
farmacie online autorizzate elenco
п»їFarmacia online migliore: Tadalafil generico migliore – farmacia online senza ricetta
farmacie online sicure Cialis generico farmacia comprare farmaci online con ricetta
http://taya365.art/# Casino visits are a popular tourist attraction.
Casino visits are a popular tourist attraction.
The poker community is very active here.: phmacao casino – phmacao com
Players enjoy a variety of table games.: phtaya – phtaya casino
https://winchile.pro/# Los casinos son lugares de reuniГіn social.
The casino scene is constantly evolving.
winchile win chile Hay casinos en Santiago y ViГ±a del Mar.
A variety of gaming options cater to everyone.: phtaya – phtaya.tech
The Philippines has a vibrant nightlife scene.: taya777 register login – taya777 register login
https://phmacao.life/# Security measures ensure a safe environment.
Resorts provide both gaming and relaxation options.
The Philippines has a vibrant nightlife scene.: taya777.icu – taya777 app
La pasiГіn por el juego une a personas.: winchile – winchile casino
The poker community is very active here.: taya365 login – taya365.art
The Philippines offers a rich gaming culture. http://winchile.pro/# Los juegos de mesa son clГЎsicos eternos.
http://jugabet.xyz/# Los torneos de poker generan gran interГ©s.
Players often share tips and strategies.
Players must be at least 21 years old.: taya365.art – taya365 com login
Gambling can be a social activity here. http://taya777.icu/# Manila is home to many large casinos.
winchile casino win chile Los casinos organizan noches de trivia divertidas.
https://taya777.icu/# Many casinos host charity events and fundraisers.
Most casinos offer convenient transportation options.
Players enjoy both fun and excitement in casinos.: taya365 com login – taya365
Slot machines attract players with big jackpots. https://taya365.art/# Live dealer games enhance the casino experience.
The Philippines offers a rich gaming culture.: taya777.icu – taya777
Los bonos de bienvenida son generosos.: winchile.pro – winchile.pro
Many casinos host charity events and fundraisers. https://taya777.icu/# Most casinos offer convenient transportation options.
http://jugabet.xyz/# Algunos casinos tienen programas de recompensas.
The ambiance is designed to excite players.
The casino atmosphere is thrilling and energetic. http://jugabet.xyz/# Algunos casinos tienen programas de recompensas.
https://jugabet.xyz/# La competencia entre casinos beneficia a los jugadores.
Slot tournaments create friendly competitions among players.
taya777 taya777.icu The Philippines offers a rich gaming culture.
Visitors come from around the world to play.: taya365 com login – taya365 com login
High rollers receive exclusive treatment and bonuses.: taya777 register login – taya777 login
Cashless gaming options are becoming popular. http://taya777.icu/# Online gaming is also growing in popularity.
http://taya777.icu/# Gambling regulations are strictly enforced in casinos.
Slot tournaments create friendly competitions among players.
http://jugabet.xyz/# La adrenalina es parte del juego.
The casino scene is constantly evolving.
The casino scene is constantly evolving.: phmacao casino – phmacao casino
Many casinos host charity events and fundraisers. https://phtaya.tech/# Casino promotions draw in new players frequently.
Slot machines attract players with big jackpots.: phmacao com – phmacao com login
Los jugadores disfrutan del pГіker en lГnea.: winchile casino – win chile
Los jugadores deben conocer las reglas.: jugabet chile – jugabet
win chile winchile.pro Los casinos celebran festivales de juego anualmente.
http://phmacao.life/# The casino scene is constantly evolving.
The casino scene is constantly evolving.
Las ganancias son una gran motivaciГіn.: jugabet casino – jugabet
http://taya365.art/# The thrill of winning keeps players engaged.
The Philippines offers a rich gaming culture.
Slot machines attract players with big jackpots.: taya365 – taya365
The thrill of winning keeps players engaged.: taya777 app – taya777 app
http://phmacao.life/# Gambling can be a social activity here.
Live dealer games enhance the casino experience.
Es comГєn ver jugadores sociales en mesas.: jugabet – jugabet chile
phtaya login phtaya login Players often share tips and strategies.
Los casinos celebran festivales de juego anualmente.: win chile – winchile casino
https://jugabet.xyz/# Los jugadores deben conocer las reglas.
The casino industry supports local economies significantly.
La pasiГіn por el juego une a personas.: win chile – winchile casino
Casino visits are a popular tourist attraction.: taya365 login – taya365 login
http://jugabet.xyz/# Los jugadores deben jugar con responsabilidad.
Entertainment shows are common in casinos.
Visitors come from around the world to play. http://taya777.icu/# Loyalty programs reward regular customers generously.
Players often share tips and strategies.: taya365.art – taya365.art
Resorts provide both gaming and relaxation options.: phmacao com login – phmacao com login
I appreciate you sharing this blog.Thanks Again. Keep writing.
Once I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a remark is added I get 4 emails with the same comment. Is there any way you’ll be able to take away me from that service? Thanks!
http://winchile.pro/# Las promociones de fin de semana son populares.
п»їCasinos in the Philippines are highly popular.
Los croupiers son amables y profesionales.: winchile casino – win chile
Many casinos have beautiful ocean views.: taya365 login – taya365 com login
http://phtaya.tech/# Some casinos feature themed gaming areas.
Many casinos host charity events and fundraisers.
Slot tournaments create friendly competitions among players. https://taya365.art/# Gambling can be a social activity here.
Casino promotions draw in new players frequently.: taya365 com login – taya365 login
https://winchile.pro/# Los torneos de poker generan gran interГ©s.
Some casinos feature themed gaming areas.
Many casinos host charity events and fundraisers.: taya365 – taya365.art
Many casinos have beautiful ocean views.: taya365 – taya365.art
http://phtaya.tech/# Players can enjoy high-stakes betting options.
Visitors come from around the world to play.
winchile casino winchile.pro Es comГєn ver jugadores sociales en mesas.
Players can enjoy high-stakes betting options.: taya777 – taya777 app
buying prescription drugs from canada http://easycanadianpharm.com/# canadian world pharmacy
Major thankies for the blog post.Really looking forward to read more. Will read on…
Best online pharmacy: online pharmacy delivery usa – Cheapest online pharmacy
best no prescription pharmacy https://megaindiapharm.shop/# Mega India Pharm
online pharmacy no prescription https://discountdrugmart.pro/# online pharmacy no prescription
discount drug mart pharmacy drugmart discount drug mart pharmacy
purple pharmacy mexico price list: xxl mexican pharm – reputable mexican pharmacies online
canadian neighbor pharmacy: easy canadian pharm – reputable canadian online pharmacy
cheapest pharmacy for prescription drugs http://familypharmacy.company/# Online pharmacy USA
online pharmacy non prescription drugs http://discountdrugmart.pro/# drugmart
MegaIndiaPharm: Mega India Pharm – Mega India Pharm
canadian pharmacy no prescription https://xxlmexicanpharm.shop/# mexican pharmaceuticals online
xxl mexican pharm: pharmacies in mexico that ship to usa – xxl mexican pharm
cheapest pharmacy to fill prescriptions with insurance http://megaindiapharm.com/# MegaIndiaPharm
buying prescription drugs from canada https://easycanadianpharm.shop/# canadian pharmacy meds review
Mega India Pharm: Mega India Pharm – buy medicines online in india
MegaIndiaPharm: Mega India Pharm – MegaIndiaPharm
And also the way, do possess to the application developers with a mobile status? How rigid is the ROI that can adhere to these selections? Windows Recuperation Surroundings been specifically up-to-date.
online pharmacy no prescription needed http://familypharmacy.company/# family pharmacy
MegaIndiaPharm: MegaIndiaPharm – MegaIndiaPharm
xxl mexican pharm: medicine in mexico pharmacies – xxl mexican pharm
easy canadian pharm my canadian pharmacy easy canadian pharm
canadian pharmacy no prescription http://discountdrugmart.pro/# online pharmacy prescription
cheapest online pharmacy india: indian pharmacy – MegaIndiaPharm
online pharmacy discount code https://megaindiapharm.com/# best online pharmacy india
legal online pharmacy coupon code https://familypharmacy.company/# Best online pharmacy
xxl mexican pharm: best online pharmacies in mexico – mexican drugstore online
legit non prescription pharmacies discount drugs discount drugs
drug mart: discount drug mart – drugmart
us pharmacy no prescription https://megaindiapharm.shop/# п»їlegitimate online pharmacies india
online pharmacy no prescription https://xxlmexicanpharm.shop/# buying prescription drugs in mexico online
mexico pharmacies prescription drugs: purple pharmacy mexico price list – п»їbest mexican online pharmacies
mail order prescription drugs from canada https://familypharmacy.company/# Online pharmacy USA
canadian pharmacy no prescription needed: online pharmacy delivery usa – online pharmacy non prescription drugs
pharmacy coupons https://discountdrugmart.pro/# drugmart
drug mart: drugmart – discount drug pharmacy
easy canadian pharm easy canadian pharm canadian pharmacy ltd
pharmacy coupons https://xxlmexicanpharm.shop/# mexican mail order pharmacies
Thank you for any other great article. Where else could anybody get that kind of info in such an ideal method of writing? I have a presentation subsequent week, and I am at the search for such info.
canadian pharmacy world coupon https://easycanadianpharm.com/# easy canadian pharm
reputable mexican pharmacies online: mexican online pharmacies prescription drugs – п»їbest mexican online pharmacies
There are many ways to do this comparable to providing unique
canadian pharmacy coupon code https://xxlmexicanpharm.com/# buying prescription drugs in mexico
us pharmacy no prescription https://megaindiapharm.shop/# indianpharmacy com
prescription drugs online https://easycanadianpharm.com/# my canadian pharmacy reviews
maple leaf pharmacy in canada: easy canadian pharm – best canadian pharmacy to buy from
discount drug mart pharmacy discount drugs drugmart
promo code for canadian pharmacy meds http://megaindiapharm.com/# indian pharmacies safe
canadian pharmacy coupon code https://easycanadianpharm.com/# pharmacy canadian
xxl mexican pharm: reputable mexican pharmacies online – xxl mexican pharm
xxl mexican pharm: xxl mexican pharm – xxl mexican pharm
canada pharmacy not requiring prescription http://discountdrugmart.pro/# canadian online pharmacy no prescription
Very nice post. I just stumbled upon your blog and wished to say that I have really enjoyed surfing around your blog posts.In any case I’ll be subscribing to your feed and I hope you writeagain soon!
rx pharmacy coupons https://easycanadianpharm.shop/# easy canadian pharm
discount drug mart pharmacy: drug mart – discount drug mart pharmacy
family pharmacy: Cheapest online pharmacy – Best online pharmacy
Best online pharmacy cheapest pharmacy prescription drugs Online pharmacy USA
rx pharmacy no prescription https://discountdrugmart.pro/# online pharmacy no prescription needed
canada pharmacy coupon https://megaindiapharm.com/# MegaIndiaPharm
easy canadian pharm canadian pharmacy king reviews canada pharmacy 24h
canadian pharmacy king: adderall canadian pharmacy – legit canadian pharmacy online
discount drug mart pharmacy: discount drugs – drugmart
cheapest pharmacy for prescription drugs https://xxlmexicanpharm.shop/# xxl mexican pharm
prescription free canadian pharmacy https://discountdrugmart.pro/# discount drug mart
family pharmacy: Best online pharmacy – family pharmacy
pharmacy online 365 discount code: discount drugs – drug mart
online pharmacy non prescription drugs https://easycanadianpharm.com/# easy canadian pharm
drugmart discount drug pharmacy discount drugs
best online pharmacy india: MegaIndiaPharm – MegaIndiaPharm
online pharmacy prescription https://xxlmexicanpharm.shop/# mexico drug stores pharmacies
pharmacy canadian superstore: easy canadian pharm – easy canadian pharm
online pharmacy without prescription https://megaindiapharm.shop/# Mega India Pharm
no prescription needed pharmacy https://xxlmexicanpharm.com/# xxl mexican pharm
rx pharmacy coupons http://xxlmexicanpharm.com/# medicine in mexico pharmacies
Hi, of course this post is actually good and I have learnedlot of things from it about blogging. thanks.
MegaIndiaPharm world pharmacy india india online pharmacy
canadian online pharmacy no prescription https://discountdrugmart.pro/# discount drug pharmacy
Mega India Pharm: MegaIndiaPharm – Mega India Pharm
legit non prescription pharmacies https://megaindiapharm.com/# MegaIndiaPharm