Skip to content

docs(repo): add a shop example workspace - #28

Merged
fr3shw3b merged 3 commits into
mainfrom
feat/example-shop
Nov 17, 2026
Merged

fr3shw3b merged 3 commits into
mainfrom
feat/example-shop

Conversation

@fr3shw3b

Copy link
Copy Markdown
Contributor

Summary

Base: feat/agent-mode (#27). Retarget to main once the earlier PRs merge. It depends on #22 for init tasks that block their layer.

Adds examples/shop, a ready-to-run workspace for the quick start:

postgres (infra.compose.yaml)
   └─ migrate (init task) ─ seed (init task) ─ api ─ web
  • Postgres comes from an ordinary Compose file with a health check, published on host port 54329 so it doesn't clash with a local Postgres.
  • migrate installs the API's dependencies and creates the table; seed truncates and inserts, so lo1 restart seed resets the data.
  • The API (node:http + pg) has a /health readiness probe; the web app reads LO1_SERVICE_API_PROXY_URL to call the API from the browser.
  • Served over HTTPS on api.shop.local and web.shop.local.
  • The README covers npx degit newstack-cloud/lo1/examples/shop shop, lo1 up and commands to try.
  • A CLI test loads every examples/*/lo1.yaml and builds its dependency graph, so CI catches an example that stops validating.

Testing

Ran the example against Docker with the built CLI (hosts and CA steps stubbed to avoid touching /etc/hosts). It was ready in 4.1s (infrastructure 2.4s · services 1.7s), and the API returned the seeded products over HTTPS through the proxy. lo1 status reported healthy (exit 0). After deleting a row, lo1 restart seed restored all three products, and lo1 down left no containers.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f517424d-2e64-46a2-8503-df46c5992513
Commits

Reviewing files that changed from the base of the PR and between 6d89aa0 and 944e7a1.

Files ignored due to path filters: 1

  • examples/shop/api/package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 37

  • examples/shop/.gitignore
  • examples/shop/README.md
  • examples/shop/api/package.json
  • examples/shop/api/src/app.js
  • examples/shop/api/src/config.js
  • examples/shop/api/src/db.js
  • examples/shop/api/src/health/routes.js
  • examples/shop/api/src/http/router.js
  • examples/shop/api/src/migrate.js
  • examples/shop/api/src/migrations/001-create-products.js
  • examples/shop/api/src/migrations/index.js
  • examples/shop/api/src/migrations/run.js
  • examples/shop/api/src/products/repository.js
  • examples/shop/api/src/products/routes.js
  • examples/shop/api/src/products/seed-data.js
  • examples/shop/api/src/seed.js
  • examples/shop/api/src/server.js
  • examples/shop/api/src/transaction.js
  • examples/shop/api/test/api.test.js
  • examples/shop/api/test/compose.yaml
  • examples/shop/api/test/migrations.test.js
  • examples/shop/api/test/products.test.js
  • examples/shop/api/test/router.test.js
  • examples/shop/api/test/support/database.js
  • examples/shop/api/test/support/http.js
  • examples/shop/infra.compose.yaml
  • examples/shop/lo1.yaml
  • examples/shop/web/package.json
  • examples/shop/web/public/app.js
  • examples/shop/web/public/index.html
  • examples/shop/web/public/styles.css
  • examples/shop/web/src/config.js
  • examples/shop/web/src/handler.js
  • examples/shop/web/src/server.js
  • examples/shop/web/test/handler.test.js
  • packages/cli/tests/config/examples.test.ts
  • sonar-project.properties
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@fr3shw3b
fr3shw3b force-pushed the feat/example-shop branch 2 times, most recently from aa761fa to db77f88 Compare November 16, 2026 23:24
@fr3shw3b
fr3shw3b force-pushed the feat/agent-mode branch 2 times, most recently from 97be611 to b5ab71b Compare November 17, 2026 08:17
@fr3shw3b
fr3shw3b force-pushed the feat/example-shop branch 2 times, most recently from 571e105 to 3b23163 Compare November 17, 2026 09:00
@fr3shw3b
fr3shw3b force-pushed the feat/example-shop branch 3 times, most recently from 26774b1 to a48cc95 Compare November 17, 2026 09:36
Base automatically changed from feat/agent-mode to main November 17, 2026 09:40
examples/shop runs Postgres, a migrate init task, a seed init task, an
API and a web app, served over HTTPS on *.shop.local. It shows init
tasks in a dependency chain, an extraCompose file with a health check,
readiness probes and service discovery through LO1_SERVICE_*_PROXY_URL.
The seed truncates before inserting, so `lo1 restart seed` resets the
data. A CLI test validates every example's lo1.yaml and dependency graph.
@sonarqubecloud

Copy link
Copy Markdown

Each module now has one job and is given its dependencies: config is read
once, a router dispatches from a table of routes, a repository holds all
the product SQL, migrations are numbered and recorded so each runs once,
and the server files only wire things together. The web app serves static
files with a content security policy and renders with textContent.

The API is tested against a throwaway Postgres started from
api/test/compose.yaml, each test file in its own schema, and both services'
tests go over real HTTP.
@fr3shw3b
fr3shw3b merged commit 80f9789 into main Nov 17, 2026
2 of 3 checks passed
@fr3shw3b
fr3shw3b deleted the feat/example-shop branch November 17, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant