Profiles and tags
A small shop as an npm workspace: three Hono APIs, two server-rendered web apps, a mailer worker and an on-demand docs site. Tags and templates group the services, and each profile starts a different set of them.
Requirements
Section titled “Requirements”- devlanes, with
devlanes setuprun once - Node 22 or later
Run it
Section titled “Run it”cd workflows-profiles-tagsdevlanes startdevlanes start --no-ui prints the start as text:
example-profiles-tags@0 · main✓ services 4 of 4 ready ✓ accounts-api https://accounts.example-profiles-tags.localhost ✓ catalog-api https://catalog.example-profiles-tags.localhost ✓ shop-web https://example-profiles-tags.localhost ✓ mailer http://127.0.0.1:20565Open https://example-profiles-tags.localhost. The shop page shows lane 0 of example-profiles-tags and, for each API it calls, the URL it uses, the lane that answered and the data file that API reads.
During a start
Section titled “During a start”- The first start of a lane runs the
installtask. Onenpm installat the root installs every workspace. - With nothing to bring back, the start runs the
defaultprofile,[+essential]: accounts-api, catalog-api, shop-web and mailer. billing-api, admin-web and docs stay stopped. - Each service runs the
devscript of its own package. The script istsx watch --tsconfig ../../tsconfig.base.json --conditions=development, which loadspackages/sharedfrom its source, so an edit there restarts every app that uses it. - The APIs answer on
accounts.,catalog.andbilling.example-profiles-tags.localhost. Theapitemplate setsDATA_FILEto<lane data folder>/<service>.json, and each API seeds that file on first read. - shop-web (
example-profiles-tags.localhost) and admin-web (admin.example-profiles-tags.localhost) fetch the APIs server-side fromservices.<api>.url. An API that is not running showsECONNREFUSEDon the page. - mailer has no port. The start waits for its
worker ready:line (ready.log), then mailer polls accounts-api every 3 seconds and logs a welcome mail for each new user.keep_awake: truekeeps the lane from being throttled or frozen while the mailer runs.
docs has autostart: false and name: Component docs, which the TUI and devlanes status show instead of the key. A service takes the colour of its first tag that has one, so each service lists its category tag first. In the TUI the APIs are cyan, the web apps green, the mailer magenta and docs yellow.
Try next
Section titled “Try next”devlanes stop, thendevlanes start --profile backend --no-ui. Only+apiand+workerstart, and https://example-profiles-tags.localhost answers 503 because shop-web is stopped:example-profiles-tags@0 · main✓ services 4 of 4 ready✓ accounts-api https://accounts.example-profiles-tags.localhost✓ billing-api https://billing.example-profiles-tags.localhost✓ catalog-api https://catalog.example-profiles-tags.localhost✓ mailer http://127.0.0.1:20565devlanes restartstartsbackendagain.devlanes stopforgets it, so the next plaindevlanes startrunsdefault.In the TUI that
devlanes startopens, presspon the lane. The picker lists every profile with what it selects (attachis markedno infra) and checks the one the lane runs. Move tobackend, press space, then Enter. billing-api starts next to the default profile and the lane’s details showprofile default, backend.devlanes start docsstarts the on-demand service on https://docs.example-profiles-tags.localhost. While it is stopped, the proxy’s 503 page for that hostname namesdevlanes start example-profiles-tags@0:docs.devlanes start --profile allstarts every other service except the mailer (exclude: [+worker]) and leaves docs out, since*skipsautostart: false.devlanes debug freezeon the default profile refuses witherror: lane example-profiles-tags@0 runs keep_awake services (mailer), so it stays awake.Press “Add a user” on the shop page, then
devlanes stopanddevlanes start --profile test. The profile setsDATA_FILEto<lane data folder>/test/<service>.json, so the page shows paths undertest/and only the two seed users, and the mailer sends their welcome mails again from its own log.devlanes stopanddevlanes startbring back the dev files with the user you added.Start a second lane whose web apps use lane 0’s APIs:
git worktree add ../examples-checkout -b feat/checkout, thencd ../examples-checkout/workflows-profiles-tags && devlanes start --profile attach. The new worktree is lane 1 and runs only shop-web and admin-web. The page at https://example-profiles-tags1.localhost saysThis is lane 1 of example-profiles-tags., links tohttps://catalog.example-profiles-tags.localhost, saysanswered by lane 0 mainand lists lane 0’s data files. A user added there shows up on lane 0’s page and lane 0’s mailer sends the mail. admin-web’s billing card showsECONNREFUSEDwhile lane 0 does not run billing-api.Without a second worktree,
devlanes lane new --name example-profiles-tags-review --startadds lane 1 in this folder with its own data.devlanes stop --lane example-profiles-tags-reviewanddevlanes start --lane example-profiles-tags-review --profile attachthen give the same result.devlanes lane clean example-profiles-tags-review --yesanddevlanes lane clean 0 --yesstop both lanes and delete their data folders. In the second worktree,devlanes lane clean 1 --yesdoes the same for its lane.
devlanes.yaml: the tags, thenode,server,api,webandworkertemplates, the services and the profiles.apps/accounts-api,apps/billing-api,apps/catalog-api: the APIs, each with a module that keeps its records inDATA_FILE.apps/shop-web,apps/admin-web: the web apps.apps/mailer/src/index.ts: the worker loop and its shutdown handler.apps/docs: the on-demand docs page.packages/shared/src: the code every app uses:env.ts,lane.ts, the JSON file store and the API client.