Next.js hosting

React framework for production web applications. Deploy to a dedicated VPS in seconds — database auto-created, SSL installed, firewall locked down from the first boot.

Latest

Versions

PostgreSQL

Database

MERN

Category

SSL included
Firewall locked
DB auto-created
Live in minutes
Overview

What is Next.js?

Next.js is a React framework for building production web applications. It provides routing, rendering, data fetching, optimization and deployment features on top of React.

Next.js supports multiple rendering strategies, including static rendering, server-side rendering and dynamic rendering. Applications can choose the approach that best fits each page or route.

Next.js applications can be used to build websites, SaaS platforms, dashboards, e-commerce applications, content platforms, APIs and full-stack web applications.

SharkCluster provides the server environment around your Next.js application, including application deployment, runtime configuration, process management, domain configuration and HTTPS.

Quick facts

Version
Latest
Database
PostgreSQL
Category
MERN
  • SSL included
  • Firewall locked
  • DB auto-created
  • Live in minutes
Why SharkCluster

Why Next.js on SharkCluster?

React framework for production

Build production-ready React applications with routing, rendering, optimization and deployment capabilities provided by the Next.js framework.

Multiple rendering strategies

Choose static, dynamic or server-rendered approaches depending on the application's performance, SEO and data requirements.

File-based routing

Create application routes using Next.js routing conventions instead of manually configuring a separate routing system.

Full-stack applications

Build frontend interfaces and server-side functionality within the same Next.js application when the project architecture requires it.

TypeScript support

Next.js provides first-class support for TypeScript-based application development.

Production optimization

Next.js provides features for optimizing application output, images, fonts, scripts and other web resources.

API and backend support

Next.js applications can implement server-side functionality and API endpoints where supported by the selected routing architecture.

Modern React development

Use modern React capabilities and Next.js application patterns to build scalable web applications.

Features

What you get with Next.js

  • Latest Next.js version

  • React application support

  • App Router support

  • Server-side rendering

  • Static rendering

  • Dynamic rendering

  • Server Components

  • Client Components

  • TypeScript support

  • JavaScript support

  • File-based routing

  • API endpoint support

  • Environment variable configuration

  • Production build support

  • Hot reload during development

  • Image optimization

  • Font optimization

  • Automatic code splitting

  • Custom domain support

  • nginx reverse proxy

  • HTTPS with a free SSL certificate

  • Process manager configuration

  • Application logs

  • Database connection support

  • Git-based deployment

Use cases

What Next.js is built for

SaaS applications

Build dashboards, authentication systems, subscription platforms and other web applications using React and Next.js.

Business websites

Create fast, SEO-friendly business websites with static or dynamically rendered pages.

E-commerce

Build storefronts and commerce applications that require dynamic product data, server-side functionality and optimized page delivery.

Content platforms

Build blogs, documentation platforms, publishing systems and content-heavy websites with static or dynamic rendering.

Admin dashboards

Create authenticated dashboards and internal applications with interactive React interfaces.

Full-stack applications

Combine React user interfaces with server-side application logic in a single Next.js project.

API-powered applications

Build web applications that consume external APIs or expose application-specific backend endpoints.

Marketing websites

Build optimized marketing pages with static generation, metadata, image optimization and modern React features.

System requirements

Server specs for
Next.js

Not sure which plan to pick? The panel warns you before you deploy so you can choose the right size the first time.

  • Minimum specs shown before deploy
  • Panel blocks deploy if server is undersized
  • Upgrade path available inside the panel
Next.js
Use a currently supported Next.js version.
Node.js
Node.js 22+ or a version supported by the selected Next.js release.
Operating system
Linux recommended for production deployments.
Web server
nginx recommended as a reverse proxy.
Database
PostgreSQL, MySQL, MongoDB, SQLite, or another supported database.
Memory
2 GB RAM minimum; 4 GB+ recommended for production.
CPU
1–2 vCPU minimum; 2+ vCPU recommended for production.
Storage
10 GB+ SSD recommended, depending on application and data.
Architecture

How Next.js fits together

1

Domain

Your domain or subdomain points to the SharkCluster server through DNS.

2

nginx

nginx receives public HTTP/HTTPS traffic and reverse-proxies requests to the Next.js application.

3

Next.js application

The Next.js server handles application routes, rendering, server-side functionality and requests according to the project's configuration.

4

React

React provides the component-based user interface used by the Next.js application.

5

Node.js runtime

Next.js server applications run on a supported Node.js runtime.

6

Process manager

A process manager such as PM2 can keep the Next.js production process running and restart it when required.

7

Database

The application can connect to PostgreSQL, MySQL, MongoDB or other compatible data stores depending on the application's architecture.

8

Environment configuration

Environment variables provide configuration such as database URLs, API endpoints and application-specific settings.

Next.js compatibility

Match your stack to Next.js

Use a supported Next.js release

For production applications, use a Next.js version that is actively supported and compatible with the project's React and Node.js versions.

Node.js compatibility

The required Node.js version depends on the selected Next.js release. Verify the official Next.js version requirements before changing the runtime.

React compatibility

Next.js versions are tied to specific React versions and features. Avoid independently upgrading React without checking Next.js compatibility.

Dependency compatibility

Before upgrading Next.js, verify compatibility of UI libraries, authentication packages, database clients, build tools and other application dependencies.

Test before production

Build and test the application with the target Next.js and Node.js versions in a staging environment before upgrading production.

Get started

After your Next.js deploy

  1. 1

    Choose a server

    Select a server size based on expected traffic, application complexity, build requirements, server-side rendering and database workload.

  2. 2

    Select the runtime

    Use a Node.js version compatible with the selected Next.js version and preferably choose a supported LTS release.

  3. 3

    Deploy the project

    Clone the Next.js project from Git or upload the application source files to the server.

  4. 4

    Install dependencies

    Install the dependencies specified by package.json using the project's package manager and lockfile.

  5. 5

    Configure environment variables

    Configure production variables such as database URLs, API endpoints, authentication settings and other application configuration.

  6. 6

    Build the application

    Run the production Next.js build command before starting the application.

  7. 7

    Configure start command

    Configure the production start command defined by the application, normally using the project's Next.js start script.

  8. 8

    Configure process manager

    Run the production application under a process manager such as PM2 so it remains available after terminal sessions end.

  9. 9

    Configure domain

    Point the application domain or subdomain to the SharkCluster server.

  10. 10

    Enable HTTPS

    Configure the SSL certificate and verify HTTPS access through the configured domain.

  11. 11

    Test the application

    Verify pages, API routes, authentication, database connectivity, forms, image handling and important application workflows.

Deployment

Ship Next.js your way

Select compatible versions

Select a supported Next.js release and a compatible Node.js runtime.

Deploy source

Clone the project from Git or upload the Next.js application source.

Install dependencies

Install dependencies using the appropriate package manager and lockfile.

Configure environment

Set production environment variables required by the application.

Run production build

Execute the project's production build command and resolve any build-time errors before starting the application.

Start Next.js

Start the application using the configured production start command.

Configure application port

Run the Next.js server on an internal application port and expose it publicly through the reverse proxy.

Configure process manager

Use a process manager such as PM2 for long-running production applications.

Configure reverse proxy

Configure nginx to forward requests from the public domain to the Next.js application.

Enable HTTPS

Enable SSL and verify secure access to the application.

Verify production mode

Ensure the application is running with production configuration rather than the development server.

Test deployment

Test server-rendered pages, static pages, dynamic routes, API functionality, database access and authentication.

Performance

Keeping Next.js fast

Use appropriate rendering

Choose static, dynamic or server rendering based on the actual data and freshness requirements of each page.

Optimize database queries

Use efficient queries, appropriate indexes and connection management for database-backed pages and APIs.

Optimize images

Use Next.js image optimization capabilities where appropriate and avoid unnecessarily large image assets.

Use caching appropriately

Cache data and responses where application requirements allow it, while ensuring users do not receive stale or private data.

Minimize client-side JavaScript

Keep components server-rendered where appropriate and avoid sending unnecessary JavaScript to the browser.

Optimize dependencies

Remove unused packages and review large client-side dependencies that increase build or browser payload size.

Use a reverse proxy

Use nginx or another production reverse proxy for TLS termination, routing and controlled application exposure.

Scale application processes

Applications with suitable architecture can use multiple processes or instances to handle higher workloads.

Monitor resources

Monitor CPU, memory, response times, errors and application processes to identify production bottlenecks.

Deployment checklist

Before you go live

  • Supported Next.js version selected

  • Compatible Node.js version selected

  • Application source deployed

  • package.json is present

  • Lockfile is present

  • Dependencies installed

  • Production environment variables configured

  • Production build completed

  • Start command verified

  • Application port configured

  • Process manager configured

  • Application process running

  • nginx reverse proxy configured

  • DNS points to the server

  • HTTPS certificate is active

  • Database connection tested where applicable

  • Application logs are accessible

  • Authentication tested

  • API routes tested

  • Important application pages tested

  • Production build tested

Production checklist

Ready your Next.js for launch

  • Use a supported Next.js version

  • Use a supported Node.js LTS release

  • Keep dependencies updated

  • Use a lockfile

  • Run a production build

  • Run the production start command

  • Keep secrets out of source control

  • Configure environment variables securely

  • Use a dedicated application user

  • Run behind nginx or another reverse proxy

  • Enable HTTPS

  • Configure process management

  • Configure automatic restart

  • Monitor application logs

  • Monitor CPU and memory

  • Monitor application errors

  • Use secure database credentials

  • Restrict database access

  • Configure backups where required

  • Test restore procedures

  • Review authentication and authorization

  • Configure appropriate security headers

  • Use appropriate API rate limiting

  • Keep the operating system updated

Useful commands

Working with Next.js

Check Node.js version

Display the installed Node.js version.

bash
node -v

Check npm version

Display the installed npm version.

bash
npm -v

Install dependencies

Install project dependencies.

bash
npm install

Clean production install

Install dependencies exactly from the package-lock.json lockfile.

bash
npm ci

Production build

Build the Next.js application for production.

bash
npm run build

Start production server

Start the built Next.js application in production mode.

bash
npm run start

Development server

Start the Next.js development server with development features such as hot reload.

bash
npm run dev

Check outdated packages

Check project dependencies for available updates.

bash
npm outdated

Audit dependencies

Check npm dependencies for reported security vulnerabilities.

bash
npm audit

List PM2 processes

Display applications managed by PM2.

bash
pm2 list

View PM2 logs

Display logs from PM2-managed applications.

bash
pm2 logs

Restart application

Restart a PM2-managed Next.js application.

bash
pm2 restart <app-name>

Check listening ports

Display TCP ports currently listening on the server.

bash
ss -lntp
Troubleshooting

Common Next.js issues & fixes

502 Bad Gateway

Cause
nginx cannot connect to the Next.js application.
Solution
Check whether the Next.js process is running, verify the configured application port and inspect nginx and application logs.

Application exits after deployment

Cause
The production build may be missing, the start command may be incorrect or required environment variables may be unavailable.
Solution
Run the production build and start command manually, inspect logs and verify the production environment configuration.

Build fails

Cause
A dependency, Node.js version, TypeScript error, environment variable or application configuration may be incompatible.
Solution
Review the build output, verify Node.js and Next.js compatibility and check dependencies and environment variables.

Database connection fails

Cause
The database URL, credentials, database server or network access may be incorrect.
Solution
Verify the database service, connection string, credentials, network access and database client configuration.

Environment variable is undefined

Cause
The variable may not have been configured in the production environment or the application may be using the wrong variable name.
Solution
Verify the production environment configuration and restart/redeploy the application after changing runtime variables.

Static assets return 404

Cause
The deployment may be missing build output or assets may be referenced using incorrect paths.
Solution
Run a fresh production build, verify asset paths and inspect the application and reverse-proxy configuration.

Application works locally but not in production

Cause
Production may use different Node.js versions, environment variables, dependencies, filesystem paths or network configuration.
Solution
Compare the local and production runtime, environment variables, dependency versions, build output and external service configuration.

High memory usage

Cause
Large builds, server-side rendering, memory-intensive application logic, caching or excessive concurrent workloads may consume significant memory.
Solution
Monitor memory usage, inspect application behavior and optimize rendering, caching, dependencies and server-side workloads.

Slow server-rendered pages

Cause
Slow database queries, external API calls, expensive server-side processing or inefficient rendering may delay responses.
Solution
Profile server-side operations, optimize database queries, reduce external request latency and use appropriate caching.

API route returns an error

Cause
The route may have incorrect server configuration, missing environment variables, authentication problems or application-level errors.
Solution
Inspect application logs, verify the route configuration and test the API endpoint directly.

Port already in use

Cause
Another process is already listening on the configured Next.js port.
Solution
Identify the process using the port and either stop it or configure the Next.js application to use another available port.
Security config

Hardened before your first request

Every deploy is locked down from boot — closed firewall, valid SSL, and restricted access by default.

  • Use a supported Next.js release.

  • Use a supported Node.js LTS release.

  • Keep npm dependencies updated.

  • Review dependency security advisories.

  • Do not commit secrets to Git.

  • Store sensitive configuration in environment variables or an appropriate secret-management system.

  • Run the application under a dedicated non-root user.

  • Use HTTPS for public applications.

  • Keep the application behind a reverse proxy where appropriate.

  • Use secure database credentials.

  • Restrict database network access.

  • Validate and sanitize untrusted input.

  • Implement authentication and authorization correctly.

  • Configure CORS only where required.

  • Apply rate limiting to sensitive public endpoints where appropriate.

  • Keep the operating system and server packages updated.

  • Use a firewall.

  • Monitor application and authentication logs.

  • Remove unused dependencies.

Database

The data layer behind Next.js

Next.js does not require PostgreSQL

Next.js is a web framework and does not require a specific database. PostgreSQL can be used when the application needs relational data storage.

PostgreSQL

PostgreSQL is a strong choice for Next.js applications that require relational data, transactions, structured schemas and complex queries.

MySQL

Next.js applications can connect to MySQL using compatible database drivers, ORMs or application libraries.

MongoDB

MongoDB can be used for Next.js applications that require document-oriented data storage.

SQLite

SQLite can be appropriate for small applications, development environments and workloads where a separate database server is unnecessary.

ORM support

Next.js applications can use database tools and ORMs such as Prisma, Drizzle and other compatible libraries.

Connection management

Production applications should manage database connections efficiently and avoid creating unnecessary connections for every request.

Database backups

Production database data should be backed up according to the application's recovery and availability requirements.

Environment

Next.js environment configuration

Production mode

Run the built Next.js application with the production start command instead of exposing the development server.

Environment variables

Configure production environment variables securely and never commit private credentials to source control.

Public variables

Only variables intentionally exposed to browser-side code should use the appropriate public environment-variable convention.

Build-time configuration

Some environment values may be consumed during the build process, so verify whether a variable is required at build time or runtime.

Logging

Monitor application and process-manager logs for build, startup, request and runtime errors.

Graceful shutdown

Production deployments should allow the application to terminate cleanly and release resources where the application's architecture requires it.

Health checks

Use an appropriate health-check endpoint or monitoring mechanism to verify that the production application is responding correctly.

Cron jobs

Automations that run on schedule

Scheduled tasks

Next.js applications can use server-level cron jobs, external schedulers, queues or application-level scheduling systems for recurring tasks.

API-based scheduled jobs

A scheduled service can call a protected application endpoint when the application architecture uses HTTP-triggered jobs.

Background processing

Long-running or resource-intensive work should generally be handled by dedicated workers or job-processing systems rather than blocking web requests.

Avoid duplicate execution

When multiple Next.js instances are running, scheduled tasks should use appropriate locking or centralized scheduling if duplicate execution would cause problems.

Security checklist

Lock down Next.js from day one

  • Supported Next.js version

  • Supported Node.js LTS version

  • Dependencies regularly updated

  • Dependency security audit performed

  • Secrets excluded from source control

  • Production environment variables secured

  • Application runs as non-root user

  • HTTPS enabled

  • Database access restricted

  • Secure authentication configured

  • Authorization rules verified

  • Input validation implemented

  • CORS configured appropriately

  • Rate limiting configured where appropriate

  • Firewall configured

  • Operating system updated

  • Application logs monitored

  • Unused dependencies removed

  • Backups configured

Upgrade safely

A safe Next.js upgrade path

  1. 1

    Check current versions

    Record the current Next.js, React, Node.js and dependency versions before beginning an upgrade.

  2. 2

    Review release compatibility

    Check the official Next.js upgrade documentation and verify compatibility between Next.js, React, Node.js and application dependencies.

  3. 3

    Back up application data

    Back up the database, application configuration and important uploaded files before a production upgrade.

  4. 4

    Test in staging

    Deploy the upgraded Next.js and Node.js versions to staging and test important application workflows.

  5. 5

    Run production build

    Complete a clean production build and resolve build warnings or errors before deploying.

  6. 6

    Check third-party libraries

    Verify authentication, database, UI, payment, analytics and other third-party libraries against the new framework version.

  7. 7

    Deploy gradually

    Use a controlled deployment process and monitor logs and application health after the upgrade.

  8. 8

    Rollback

    Keep the previous application build and runtime configuration available so the deployment can be rolled back if a critical issue occurs.

Take a snapshot before every upgrade so a bad release can be rolled back in minutes.

Who owns what

We manage the server, you own the store

SharkCluster manages

  • VPS infrastructure
  • Node.js runtime
  • Application deployment environment
  • nginx reverse proxy
  • Process manager
  • SSL
  • Firewall
  • Server-level cron
  • Server monitoring
  • Backups where enabled

You manage

  • Next.js application code
  • React components
  • package.json
  • Application dependencies
  • Environment variables
  • Application configuration
  • Database schema
  • API logic
  • Authentication and authorization
  • Business logic
  • Third-party integrations

Everything below the application line — from nginx to backups — is infrastructure. Your code, content and store configuration are always yours, and you keep full SSH and root access.

FAQ

Frequently Asked Questions

The questions we hear most from people deploying Next.js on SharkCluster.

Contact support

Next.js is a React framework for building production web applications. It provides routing, rendering, server-side functionality and optimization features around React.

Server-side Next.js applications require a compatible Node.js runtime. The exact Node.js requirement depends on the selected Next.js version.

No. Next.js does not require PostgreSQL or any other specific database. PostgreSQL is one database option that can be used by a Next.js application.

Yes. PostgreSQL is commonly used with Next.js applications through database drivers, ORMs or application libraries.

Yes. Next.js applications can connect to MySQL using compatible drivers, ORMs and database libraries.

Yes. MongoDB can be used with Next.js applications through the MongoDB driver or compatible libraries.

Yes. Next.js supports server-side rendering and other server and static rendering strategies depending on the application architecture.

Yes. Next.js supports statically rendered pages and applications where content can be generated without requiring a server request for every page.

Yes. Next.js has built-in support for TypeScript-based application development.

Yes. A Next.js application can run on a VPS using a compatible Node.js runtime, a production build, a process manager and a reverse proxy such as nginx.

Yes. PM2 can manage a production Next.js server process and provide process restart and log management.

No. Hot reload is primarily a development feature. Production deployments should use a built Next.js application and the production start command.

A 502 error commonly means nginx cannot connect to the Next.js process. Check the process status, application port, reverse-proxy configuration and application logs.

Common causes include an incompatible Node.js version, dependency problems, TypeScript errors, missing environment variables or application configuration issues.

Yes, but the selected Node.js version must be compatible with your Next.js release and application dependencies. Test the change before applying it to production.

Yes. Multiple applications can run on different internal ports and use separate domains or subdomains through nginx.

Usually no. The Next.js server can listen on an internal port while nginx handles public HTTPS traffic and proxies requests to the application.

Yes. Next.js supports server-side application functionality and API endpoints depending on the routing architecture and version being used.

Yes. Next.js applications can connect to PostgreSQL, MySQL, MongoDB, SQLite and other databases through appropriate drivers or ORMs.

Check the Next.js, React and Node.js compatibility requirements, back up application data, test the upgrade in staging, run a production build and verify the application's important workflows before deploying.

One-click setup

From deploy to live in minutes

Stack configured

Runtime, process manager and config files set up for you.

PostgreSQL wired

Database created with a user and credentials in your config.

SSL + firewall

Free Let's Encrypt certificate and closed-by-default UFW rules.

Deploy anytime

Push with Git, or use the built-in file manager and ZIP upload.

Start your journey today

How do you start
with SharkCluster?

To start with SharkCluster, create an account and your first server on DigitalOcean, Contabo or OVHcloud — no credit card or lock-in contract is needed. Every account includes free self-hosted business apps, free local backups, unlimited migrations and a dedicated DevOps manager.

No lock-in contracts
No credit card required
Dedicated DevOps manager