Skip to Content
chalvien 1.0 is released
DocumentationGuidesNextjsDeploy a Dashboard Demo

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

  1. Phase 1 - Repo readiness.
  2. Add a production multi-stage Dockerfile at repo root for Next.js.
  3. Update next.config.ts to use standalone output for a smaller runtime image.
  4. Add a root .dockerignore to exclude node_modules, build caches, logs, git metadata, and local env artifacts.
  5. Add a root .env.example documenting NEXT_PUBLIC_JSON_SERVER_URL.
  6. Phase 2 - Pre-deploy validation (depends on Phase 1).
  7. Run local app checks: install, lint, build.
  8. Build Docker image locally and run it on port 3000 with production env values.
  9. Verify both routes load: / and /admin.
  10. Verify admin login behavior still works (current auth accepts any username and stores session in localStorage).
  11. Phase 3 - Dokploy setup on VPS (depends on Phase 2).
  12. Ensure DNS points to VPS and ports 80/443 are open.
  13. In Dokploy, create app from Git repo using Dockerfile build mode.
  14. Configure container internal port to 3000 and set restart policy.
  15. Add runtime variables in Dokploy: NEXT_PUBLIC_JSON_SERVER_URL and NODE_ENV=production.
  16. Attach your domain/subdomain and enable Dokploy-managed TLS.
  17. Trigger first deployment and monitor build/runtime logs.
  18. Phase 4 - Post-deploy verification (depends on Phase 3).
  19. Validate HTTPS access to / and /admin and confirm no client/SSR routing issues.
  20. Verify posts/users data loads from JSONPlaceholder in the admin UI.
  21. Document operational runbook (redeploy, rollback, logs) in README.md.

Relevant files

  1. package.json - build/start scripts baseline.
  2. next.config.ts - standalone build optimization.
  3. .env - current env source for API URL.
  4. dataProvider.ts - uses NEXT_PUBLIC_JSON_SERVER_URL.
  5. page.tsx - admin client-only dynamic loading.
  6. authProvider.ts - auth behavior for production verification.
  7. README.md - deployment/runbook documentation target.

Verification

  1. Local checks: npm ci, npm run lint, npm run build.
  2. Container checks: image builds and serves on port 3000.
  3. Dokploy checks: app healthy, logs clean, restart works.
  4. Public checks: HTTPS valid and both / and /admin return successfully.
  5. Functional checks: admin login works and data loads from JSONPlaceholder.

Decisions

  1. Git-based Dokploy deployment.
  2. Public HTTPS domain via Dokploy reverse proxy.
  3. Production demo keeps JSONPlaceholder.
  4. Expose whole app (/ and /admin).

Aligned to repo and domain

Dokploy configuration for your setup.

  1. Finalize and push the last patch first.

  2. Updated Dockerfile to accept NEXT_PUBLIC_JSON_SERVER_URL at build time.

  3. Updated README.md to match this.

  4. Run: git add Dockerfile README.md git commit -m “Dokploy: support build-time NEXT_PUBLIC env” git push origin main

  5. Dokploy app creation values.

  6. Provider: Git

  7. Repository: https://github.com/lussino/vms-dashboard.git 

  8. Branch: main

  9. Build method: Dockerfile

  10. Dockerfile path: Dockerfile

  11. Build context: .

  12. Internal app port: 3000

  13. Health check path: /

  14. Restart policy: Always

  15. Auto deploy on push: Enabled

  16. Dokploy build arguments.

  17. NEXT_PUBLIC_JSON_SERVER_URL = https://jsonplaceholder.typicode.com 

  18. Dokploy runtime environment variables.

  19. NODE_ENV = production

  20. NEXT_PUBLIC_JSON_SERVER_URL = https://jsonplaceholder.typicode.com 

  21. Domain and TLS.

  22. Domain: app.chalvien.eu

  23. Enable automatic SSL certificate

  24. Enable force HTTPS redirect

  25. DNS requirement.

  26. Create or verify A record: Host: app Value: your Hostinger VPS public IP

  27. If using Cloudflare proxy, set DNS to DNS only during first certificate issuance, then you can re-enable proxy.

  28. Deploy and verify.

  29. Click Deploy in Dokploy.

  30. Wait for healthy status.

  31. Test: https://app.chalvien.eu/  https://app.chalvien.eu/admin 

  32. Expected successful log signs.

  33. Next.js startup on 0.0.0.0:3000

  34. No crash loop after health checks

Note: Last updated on March 10, 2026