This folder is a Coder template that spins up a ready-to-code cloud workspace for this app. Each workspace gives you:
- VS Code in the browser (code-server) to write code
- The app cloned and
npm install-ed for you - PostgreSQL running inside the workspace (no separate DB to manage)
- The running app reachable from your laptop at http://localhost:5173
You don't need to know Terraform to use it. Follow the steps below.
- Docker — installed and running. (Get Docker) Workspaces run as Docker containers, so the Docker daemon must be up.
- That's it — the next step installs Coder itself.
macOS / Linux:
curl -fsSL https://coder.com/install.sh | sh(Windows and other options: https://coder.com/docs/install.)
Verify it's installed:
coder versionIn its own terminal (leave it running):
coder serverThe first time, it prints a URL like http://localhost:3000 and walks you through
creating the first admin user in your browser. Keep this terminal open — it is
your Coder server.
Already have a Coder server? Skip this step and just point
coder loginat it.
coder login http://localhost:3000This opens a browser to grab a session token; paste it back at the prompt.
From the repository root (the folder that contains this coder/ directory):
coder templates push docker-nodejs-sample -d ./coder -yThis uploads the template and validates it. You only do this once (and again whenever the template files change).
coder create dev1 --template docker-nodejs-sampledev1 is just a name — call it whatever you like. The build takes a couple of
minutes the first time (it builds the workspace image, starts Postgres, clones the
repo, and runs npm install).
By default it clones https://github.com/BrandonDenham/docker-nodejs-sample-coder.
To use a different repo or branch, add
--parameter "repo_url=<url>" --parameter "repo_branch=<branch>".
-
Open the workspace in the Coder dashboard (the URL from step 2) and click code-server to get VS Code in your browser.
-
In code-server's terminal, start the dev server:
cd ~/docker-nodejs-sample npm run dev
-
On your own machine, open http://localhost:5173.
That's the live app, with hot-reload. The frontend talks to the API on port 3000 and to PostgreSQL — all inside the workspace — automatically.
| Piece | Where it runs | How you reach it |
|---|---|---|
| code-server (IDE) | workspace container, port 13337 | code-server button in the dashboard |
| Vite dev server (frontend) | workspace container, port 5173 | http://localhost:5173 on your machine |
| Express API | workspace container, port 3000 | internal — Vite proxies /api to it |
| PostgreSQL | workspace container, port 5432 | internal — the app connects automatically |
Your code, installed dependencies, and the database all live on a persistent volume, so they survive stopping and restarting the workspace.
coder list # see your workspaces
coder ssh dev1 # shell into the workspace
coder stop dev1 # stop (saves resources; data persists)
coder start dev1 # start it back up
coder delete dev1 # remove the workspace
coder port-forward dev1 --tcp 5173:5173 # alternative way to reach the app- Use a different repo / branch: change the
--parametervalues in step 5, or edit the defaults incoder/main.tf(repo_url,repo_branch). - Port 5173 already in use on your machine? Only one running workspace can bind
it at a time. Stop the other workspace, or use the
coder port-forwardcommand above to map to a different local port.
localhost:5173works because the workspace publishes its Vite port straight to your host. Coder's normal subdomain-based app proxy needs a wildcard DNS domain, which a locallocalhostserver can't provide — so we expose the port directly.- For production-style serving instead of the dev server, you can build and run
inside the workspace with
npm run build && npm start(serves on port 3000).