Deploy with Docker
For self-hosted deployments, NextGenKit can be containerized with a multi-stage Dockerfile.
1. Enable Standalone Output
Add to next.config.mjs:
const nextConfig = {
output: "standalone",
}
2. Create a Dockerfile
FROM node:20-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest --activate
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]
3. Build and Run
docker build -t nextgenkit .
docker run -p 3000:3000 --env-file .env.local nextgenkit
4. Update Webhook URLs
Replace your ngrok/local webhook endpoints with your deployed server URL:
- Clerk:
https://your-domain.com/api/webhooks/clerk - Stripe:
https://your-domain.com/api/webhooks/stripe
Notes
- The standalone output produces a minimal
server.jsthat runs withoutnode_modules - Make sure
DATABASE_URLpoints to a PostgreSQL instance accessible from your container - Run
pnpm db:deployto apply migrations to your production database before starting