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
Updatepackage.json to use port 80:
package.json
Building Your Project
Build the production output:.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
Prepare Your Files
Ensure you have:
- All source files (
pages/,app/,components/, etc.) package.json.shardcloudnext.config.js(if applicable)
Upload to Shard Cloud
Go to Shard Cloud Dashboard and upload.
Additional Resources
Visit the official Next.js documentation for more information.Troubleshooting
Build fails with memory errors
Build fails with memory errors
Increase
MEMORY in your .shardcloud configuration to at least 1024MB.Page not found (404) errors
Page not found (404) errors
- Verify your pages are in the correct directory (
pages/orapp/) - Check that dynamic routes are properly configured
API routes not working
API routes not working
Ensure API routes are in
pages/api/ or app/api/ directory.