# Next.js

Source : https://webgune.cloud/en-us/docs/web-nextjs · Mis à jour le 2026-10-27

# Next.js

The presence of `next.config.js` or `next.config.ts` is enough to trigger Next.js detection.

## What the auto builder runs

```bash
npm install
npm run build      # next build
npm start          # next start -p $PORT
```

## Standalone mode

If your config enables `output: 'standalone'`, the build artifact no longer contains the same files and `next start` fails. Adjust the start command:

```bash
node .next/standalone/server.js
```

See [Custom start command](/docs/commande-demarrage) to configure it.

## Environment variables

```bash
# Available server-side only
DATABASE_URL=postgresql://user:pass@host:5432/db
API_SECRET=super-secret

# Exposed to the browser — prefix required
NEXT_PUBLIC_API_URL=https://api.mon-domaine.com
```

> A variable without the `NEXT_PUBLIC_` prefix stays invisible on the client, even after a rebuild. This is Next.js behavior, not a Webgune limitation.

## API Routes and Server Actions

API routes (`app/api/*`) and Server Actions work as they are. They run in the same pod as the rest of the application, so a separate service is only needed if you want to isolate the load.
