sota.io

Deploy Next.js

Deploy a Next.js application to sota.io with automatic framework detection.

Auto-Detection

sota.io automatically detects Next.js projects by looking for:

  • next.config.js or next.config.ts in the project root
  • next in package.json dependencies

No configuration required -- just deploy.

Quick Deploy

cd my-nextjs-app
sota deploy

What Happens

  1. sota.io detects the Next.js framework
  2. Runs npm install and npm run build
  3. Creates a Docker image with the built application
  4. Starts the container on port 8080
  5. Your app is live at https://{slug}.sota.io

Environment Variables

Your app receives the PORT=8080 environment variable automatically. Make sure your Next.js app listens on process.env.PORT:

// next.config.js
module.exports = {
  // Next.js uses PORT automatically
}

For additional env vars, use the CLI:

sota env set NEXT_PUBLIC_API_URL=https://api.example.com
sota env set DATABASE_URL=postgres://...

Note: NEXT_PUBLIC_* variables need to be available at build time. Set them before deploying.

For optimal deployment, add output: 'standalone' to your Next.js config:

// next.config.js
module.exports = {
  output: 'standalone',
}

This creates a minimal production build that includes only the files needed to run.

Example Project Structure

my-nextjs-app/
  src/
    app/
      page.tsx
      layout.tsx
  public/
  package.json
  next.config.js
  .gitignore

Troubleshooting

Build fails with out-of-memory error

Next.js builds can require significant memory. The free tier provides 256MB RAM, which may not be enough for large projects. Consider upgrading to the Pro tier (512MB) for production Next.js apps.

Static assets not loading

Make sure your public/ directory is included in the archive. Check your .sotaignore or .gitignore files.