Demo Example: Deploy Next.js Dashboard on Dokploy
Deploy a demo app to Hostinger VPS using Dokploy with a Git-based Docker build.
- The recommended path is: make the repo Docker-ready for Next.js production, validate locally, then configure Dokploy (domain + HTTPS + env vars) and verify end-to-end.
Steps
- Phase 1 - Repo readiness.
- Add a production multi-stage Dockerfile at repo root for Next.js.
- Update next.config.ts to use standalone output for a smaller runtime image.
- Add a root .dockerignore to exclude node_modules, build caches, logs, git metadata, and local env artifacts.
- Add a root .env.example documenting NEXT_PUBLIC_JSON_SERVER_URL.
- Phase 2 - Pre-deploy validation (depends on Phase 1).
- Run local app checks: install, lint, build.
- Build Docker image locally and run it on port 3000 with production env values.
- Verify both routes load: / and /admin.
- Verify admin login behavior still works (current auth accepts any username and stores session in localStorage).
- Phase 3 - Dokploy setup on VPS (depends on Phase 2).
- Ensure DNS points to VPS and ports 80/443 are open.
- In Dokploy, create app from Git repo using Dockerfile build mode.
- Configure container internal port to 3000 and set restart policy.
- Add runtime variables in Dokploy: NEXT_PUBLIC_JSON_SERVER_URL and NODE_ENV=production.
- Attach your domain/subdomain and enable Dokploy-managed TLS.
- Trigger first deployment and monitor build/runtime logs.
- Phase 4 - Post-deploy verification (depends on Phase 3).
- Validate HTTPS access to / and /admin and confirm no client/SSR routing issues.
- Verify posts/users data loads from JSONPlaceholder in the admin UI.
- Document operational runbook (redeploy, rollback, logs) in README.md.
Relevant files
- package.json - build/start scripts baseline.
- next.config.ts - standalone build optimization.
- .env - current env source for API URL.
- dataProvider.ts - uses NEXT_PUBLIC_JSON_SERVER_URL.
- page.tsx - admin client-only dynamic loading.
- authProvider.ts - auth behavior for production verification.
- README.md - deployment/runbook documentation target.
Verification
- Local checks: npm ci, npm run lint, npm run build.
- Container checks: image builds and serves on port 3000.
- Dokploy checks: app healthy, logs clean, restart works.
- Public checks: HTTPS valid and both / and /admin return successfully.
- Functional checks: admin login works and data loads from JSONPlaceholder.
Decisions
- Git-based Dokploy deployment.
- Public HTTPS domain via Dokploy reverse proxy.
- Production demo keeps JSONPlaceholder.
- Expose whole app (/ and /admin).
Aligned to repo and domain
Dokploy configuration for your setup.
-
Finalize and push the last patch first.
-
Updated Dockerfile to accept NEXT_PUBLIC_JSON_SERVER_URL at build time.
-
Updated README.md to match this.
-
Run: git add Dockerfile README.md git commit -m “Dokploy: support build-time NEXT_PUBLIC env” git push origin main
-
Dokploy app creation values.
-
Provider: Git
-
Repository: https://github.com/lussino/vms-dashboard.git
-
Branch: main
-
Build method: Dockerfile
-
Dockerfile path: Dockerfile
-
Build context: .
-
Internal app port: 3000
-
Health check path: /
-
Restart policy: Always
-
Auto deploy on push: Enabled
-
Dokploy build arguments.
-
NEXT_PUBLIC_JSON_SERVER_URL = https://jsonplaceholder.typicode.com
-
Dokploy runtime environment variables.
-
NODE_ENV = production
-
NEXT_PUBLIC_JSON_SERVER_URL = https://jsonplaceholder.typicode.com
-
Domain and TLS.
-
Domain: app.chalvien.eu
-
Enable automatic SSL certificate
-
Enable force HTTPS redirect
-
DNS requirement.
-
Create or verify A record: Host: app Value: your Hostinger VPS public IP
-
If using Cloudflare proxy, set DNS to DNS only during first certificate issuance, then you can re-enable proxy.
-
Deploy and verify.
-
Click Deploy in Dokploy.
-
Wait for healthy status.
-
Test: https://app.chalvien.eu/ https://app.chalvien.eu/admin
-
Expected successful log signs.
-
Next.js startup on 0.0.0.0:3000
-
No crash loop after health checks
Note: Last updated on March 10, 2026