Skip to main content

Introduction

This guide covers deploying Next.js applications on Shard Cloud. Next.js is a React framework for production-grade applications with server-side rendering and static site generation.

Creating Your Project

Ensure you have Node.js and npm installed.

Creating a New Next.js Project

Configuring Port 80

Update package.json to use port 80:
package.json

Building Your Project

Build the production output:
This creates the .next folder with optimized production files.

Shard Cloud Configuration

Create a .shardcloud file:
.shardcloud
Next.js applications typically require at least 512MB-1024MB of memory for the build process.

Deploying

1

Build Locally (Optional)

Run npm run build to verify your build works.
2

Prepare Your Files

Ensure you have:
  • All source files (pages/, app/, components/, etc.)
  • package.json
  • .shardcloud
  • next.config.js (if applicable)
3

Exclude Unnecessary Files

Remove:
  • node_modules/
  • .next/cache/
  • package-lock.json
4

Create ZIP Archive

Compress your project folder.
5

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Additional Resources

Visit the official Next.js documentation for more information.

Troubleshooting

Increase MEMORY in your .shardcloud configuration to at least 1024MB.
  • Verify your pages are in the correct directory (pages/ or app/)
  • Check that dynamic routes are properly configured
Ensure API routes are in pages/api/ or app/api/ directory.