- Performance
- SEO (Search Engine Optimization)
- UX - SPA (Single Page Application)
- react, angular, vue
- routing between pages +
- The app feels more responsive and users do not see the flash between page navigations due to full-page refreshes.
- Fewer HTTP requests are made to the server, as the same assets do not have to be downloaded again for each page load.
- An application has a very complex UI with many pages/features
- An application has large and dynamic data
- Write preference of the site is more than reading
- The focus is on rich sites and a huge number of users
- nextjs, php, nuxtjs
- The initial page of the website load is faster as there are fewer codes to render.
- Good for minimal and static sites.
- Search engines can crawl the site for better SEO.
- An application has a very simple UI with fewer pages/features
- An application has less dynamic data
- Read preference of the site is more than write
- The focus is not on rich sites and has few users
The main difference between these two rendering approaches is in the algorithms of their operation. CSR shows an empty page before loading, while SSR displays a fully-rendered HTML page on the first load.
If you want to improve your Google visibility and rank high in the search engine results pages (SERPs), server-side rendering is the number one choice.
E-learning websites, online marketplaces, and applications with a straightforward user interface with fewer pages, features, and dynamic data all benefit from this type of rendering.
Client-side rendering is usually paired with dynamic web apps like social networks or online messengers. This is because these apps’ information constantly changes and must deal with large and dynamic data to perform fast updates to meet user demand.
The focus here is on a rich site with many users, prioritizing the user experience over SEO.
If your site’s content doesn’t require much user interaction, then SSR is more effective. It positively influences accessibility, page load times, SEO, and social media support.
On the other hand, CSR is excellent for providing cost-effective rendering for web applications, and it’s easier to build and maintain
System Requirements:
- Node.js 18.17 or later.
- macOS, Windows (including WSL), and Linux are supported. Automatic Installation We recommend starting a new Next.js app using create-next-app, which sets up everything automatically for you. To create a project, run:
npx create-next-app What is your project named? my-app Would you like to use TypeScript? No / Yes Would you like to use ESLint? No / Yes Would you like to use Tailwind CSS? No / Yes Would you like to use `src/` directory? No / Yes Would you like to use App Router? (recommended) No / Yes Would you like to customize the default import alias (@/*)? No / Yes What import alias would you like configured? @/* - Run
npm run devto start the development server. - Visit
http://localhost:3000to view your application. - Edit
app/page.tsx(orpages/index.tsx) file and save it to see the updated result in your browser.
This page provides an overview of the project structure of a Next.js application. It covers top-level files and folders, configuration files, and routing conventions within the app and pages directories.
Click the file and folder names to learn more about each convention.
appApp RouterpagesPages RouterpublicStatic assets to be servedsrcOptional application source folder
Top-level files are used to configure your application, manage dependencies, run middleware, integrate monitoring tools, and define environment variables.
next.config.jsConfiguration file for Next.jspackage.jsonProject dependencies and scriptsinstrumentation.tsOpenTelemetry and Instrumentation filemiddleware.tsNext.js request middleware.envEnvironment variables.env.localLocal environment variables.env.productionProduction environment variables.env.developmentDevelopment environment variables.eslintrc.jsonConfiguration file for ESLint.gitignoreGit files and folders to ignorenext-env.d.tsTypeScript declaration file for Next.jstsconfig.jsonConfiguration file for TypeScriptjsconfig.jsonConfiguration file for JavaScript
layout---.js.jsx.tsx--- Layoutpage---.js.jsx.tsx--- Pageloading---.js.jsx.tsx--- Loading UInot-found---.js.jsx.tsx--- Not found UIerror---.js.jsx.tsx--- Error UIglobal-error---.js.jsx.tsx--- Global error UIroute---.js.ts--- API endpointtemplate---.js.jsx.tsx--- Re-rendered layoutdefault---.js.jsx.tsx--- Parallel route fallback page
[folder]Dynamic route segment[...folder]Catch-all route segment[[...folder]]Optional catch-all route segment
_app---.js.jsx.tsx--- Custom App_document---.js.jsx.tsx--- Custom Document_error---.js.jsx.tsx--- Custom Error Page404---.js.jsx.tsx--- 404 Error Page500---.js.jsx.tsx--- 500 Error Page
