Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- name: Build every demo's offline kit
run: |
set -euo pipefail
for app in apps/*/; do
for app in demos/*/; do
[ -d "${app}cmd/kit" ] || { echo "${app} has no cmd/kit (every demo needs an offline kit)"; exit 1; }
echo "Building ${app}cmd/kit..."
go build -o /dev/null "./${app}cmd/kit"
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
- name: Check the binary serves the built UI
run: |
set -euo pipefail
go build -o "$RUNNER_TEMP/kit" "./apps/$APP/cmd/kit"
go build -o "$RUNNER_TEMP/kit" "./demos/$APP/cmd/kit"
"$RUNNER_TEMP/kit" serve --addr 127.0.0.1:18080 --state "$RUNNER_TEMP/state.json" &
pid=$!
trap 'kill $pid' EXIT
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ node_modules/
**/routeTree.gen.ts

# The web build writes the compiled UI here; only the placeholder is tracked
apps/*/internal/ui/assets/*
!apps/*/internal/ui/assets/placeholder.html
demos/*/internal/ui/assets/*
!demos/*/internal/ui/assets/placeholder.html

# Local state
*.db
Expand Down
2 changes: 1 addition & 1 deletion .no-mistakes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# checks run only where `pnpm install` has been run in web/.
commands:
test: 'set -e; for m in $(go list -m); do go test -count=1 "$m/..."; done; if [ -d web/node_modules ]; then pnpm --dir web test; fi'
lint: 'set -e; for m in $(go list -m); do go vet "$m/..."; done; for a in apps/*/; do [ -d "${a}cmd/kit" ] || { echo "$a has no cmd/kit"; exit 1; }; done; (cd shared && go run ./cmd/check-samples ../samples); test -z "$(gofmt -l .)" || { echo "unformatted files (run gofmt -w .):"; gofmt -l .; exit 1; }; if [ -d web/node_modules ]; then pnpm --dir web lint && pnpm --dir web type-check; fi'
lint: 'set -e; for m in $(go list -m); do go vet "$m/..."; done; for a in demos/*/; do [ -d "${a}cmd/kit" ] || { echo "$a has no cmd/kit"; exit 1; }; done; (cd shared && go run ./cmd/check-samples ../samples); test -z "$(gofmt -l .)" || { echo "unformatted files (run gofmt -w .):"; gofmt -l .; exit 1; }; if [ -d web/node_modules ]; then pnpm --dir web lint && pnpm --dir web type-check; fi'
format: "gofmt -w ."
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Every module in the Go workspace is built, vetted and tested. In a workspace,
# ./... from the root matches only the root module, so each module is listed.

# Builds every entry point under apps/<demo>/cmd/<name> to bin/<demo>-<name>.
# Builds every entry point under demos/<demo>/cmd/<name> to bin/<demo>-<name>.
build:
mkdir -p bin
set -e; for d in apps/*/cmd/*/; do \
set -e; for d in demos/*/cmd/*/; do \
cmd=$$(basename "$$d"); app=$$(basename "$$(dirname "$$(dirname "$$d")")"); \
go build -o "bin/$$app-$$cmd" "./$$d"; \
done
Expand All @@ -19,7 +19,7 @@ test:

# Every demo ships an offline kit.
check-kits:
set -e; for a in apps/*/; do [ -d "$${a}cmd/kit" ] || { echo "$$a has no cmd/kit (every demo needs an offline kit)"; exit 1; }; done
set -e; for a in demos/*/; do [ -d "$${a}cmd/kit" ] || { echo "$$a has no cmd/kit (every demo needs an offline kit)"; exit 1; }; done

# Every sample app's descriptor is well formed, and no sample holds app code.
check-samples:
Expand All @@ -31,8 +31,8 @@ check-samples:
web:
pnpm --dir web install --frozen-lockfile
pnpm --dir web --filter @localstack-app-emulators/$(APP) build
find apps/$(APP)/internal/ui/assets -mindepth 1 ! -name placeholder.html -delete
cp -R web/apps/$(APP)/dist/. apps/$(APP)/internal/ui/assets/
find demos/$(APP)/internal/ui/assets -mindepth 1 ! -name placeholder.html -delete
cp -R web/demos/$(APP)/dist/. demos/$(APP)/internal/ui/assets/

# make kit APP=acme-commerce-lenders ARGS=seed
kit: build
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Status: In Development

ACME Commerce Lenders is a fictional working-capital lender for ecommerce companies. A merchant applies for working capital, and the lender reads their sales from Stripe and their bank data from Plaid to make an offer. When the merchant accepts, the lender funds the advance through Stripe Connect into the bank account the merchant verified with Plaid, and the settlement appears in the merchant's Xero books. Every third-party system is an app emulator, so the whole flow runs locally, resets in one click, and needs no vendor sandbox or real account.

Code and docs: [apps/acme-commerce-lenders](apps/acme-commerce-lenders)
Code and docs: [demos/acme-commerce-lenders](demos/acme-commerce-lenders)

#### Demo Scenarios

Expand All @@ -26,11 +26,11 @@ Each demo is one Go binary, `cmd/kit`, that serves the demo's UI and runs its lo

## Repo layout

Each demo is a Go app under `apps/`. The repo is a Go workspace (`go.work`), so every app and the shared module build together. Adding a demo adds a directory under `apps/` and one line to `go.work`.
Each demo is a Go app under `demos/`. The repo is a Go workspace (`go.work`), so every app and the shared module build together. Adding a demo adds a directory under `demos/` and one line to `go.work`.

| Path | What it holds |
|---|---|
| `apps/<demo>/` | One demo: its Go code, its docs and its embedded UI |
| `demos/<demo>/` | One demo: its Go code, its docs and its embedded UI |
| `shared/` | Code every demo uses: the recording proxy for vendor calls, vendor base URL config, and a launcher for running app emulators without LocalStack |
| `samples/<sample>/` | One sample: a descriptor of the open source app and the output of runs, never the app's code |
| `web/` | pnpm workspace for the demo UIs, built as static assets that the Go binaries embed |
Expand All @@ -42,7 +42,7 @@ Each demo is a Go app under `apps/`. The repo is a Go workspace (`go.work`), so
make vet # go vet for every module
make test # go test for every module
make web APP=<demo> # builds that demo's UI into its binary (needs Node 22 and pnpm)
make build # builds every apps/<demo>/cmd/<name> to bin/<demo>-<name>
make build # builds every demos/<demo>/cmd/<name> to bin/<demo>-<name>
make kit APP=<demo> # builds, then runs that demo's binary
make check-kits # fails if a demo has no cmd/kit
make check-samples # fails if a sample's descriptor is malformed or a sample holds app code
Expand Down
3 changes: 0 additions & 3 deletions apps/acme-commerce-lenders/go.mod

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"context"
"os"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/internal/cli"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/internal/cli"
)

func main() {
Expand Down
3 changes: 3 additions & 0 deletions demos/acme-commerce-lenders/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders

go 1.26
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"errors"
"net/http"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"strconv"
"sync"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"testing"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/internal/fakevendors"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/internal/fakevendors"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"strings"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/internal/api"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/internal/ui"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/internal/api"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/internal/ui"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/lender"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"sync/atomic"
"testing"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/internal/fakevendors"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/internal/fakevendors"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

func run(t *testing.T, env map[string]string, args ...string) (code int, out, errOut string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"strconv"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// Funding is how an accepted advance reached the merchant. Each field is filled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// signalsFromTheWorld is what the lender reads from the seeded merchant, worked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/http"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// PlaidSignals is what the lender learns from the merchant's bank connection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"testing"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strconv"
"sync"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// Status is how far an application has got.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"errors"
"testing"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"net/http"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// The advance is a loan to the merchant, so it is booked as money received
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/url"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// StripeSignals is what the lender learns from the merchant's Stripe account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package lender

import (
"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/world"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/world"
)

// XeroSignals is what the lender learns from the merchant's books.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

"github.com/localstack-samples/localstack-app-emulators/apps/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/demos/acme-commerce-lenders/core"
"github.com/localstack-samples/localstack-app-emulators/shared/seed"
"github.com/localstack-samples/localstack-app-emulators/shared/wire"
)
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
go 1.26

use (
./apps/acme-commerce-lenders
./demos/acme-commerce-lenders
./shared
)
2 changes: 1 addition & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Samples

A sample is an open source app, written by someone else for real users, that is run against the app emulators. It has the use cases and edge cases real customers hit, and its own tests, which we did not invent. The demos in `apps/` are different: they are staged to show well, and they are ours.
A sample is an open source app, written by someone else for real users, that is run against the app emulators. It has the use cases and edge cases real customers hit, and its own tests, which we did not invent. The demos in `demos/` are different: they are staged to show well, and they are ours.

This directory records which app was run and how. It never holds the app's code. The code stays in its own repo under its own license, and a run fetches the commit named here.

Expand Down
2 changes: 1 addition & 1 deletion web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pnpm workspace for the demo UIs, set up the same way as `wondertwin-web`.
| Path | What it holds |
|---|---|
| `packages/brand` | LocalStack's colors, logos, typeface and the `cva` button and badge variants, which every demo UI imports |
| `apps/<demo>` | One demo's UI, such as `apps/acme-commerce-lenders` |
| `demos/<demo>` | One demo's UI, such as `demos/acme-commerce-lenders` |

## Commands

Expand Down
4 changes: 2 additions & 2 deletions web/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"files": {
"ignoreUnknown": true,
"includes": [
"apps/*/src/**",
"demos/*/src/**",
"packages/*/src/**",
"*.json",
"*.ts",
"*.tsx",
"!apps/*/src/routeTree.gen.ts"
"!demos/*/src/routeTree.gen.ts"
]
},
"formatter": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// These mirror the JSON the Go API returns (apps/acme-commerce-lenders/lender
// These mirror the JSON the Go API returns (demos/acme-commerce-lenders/lender
// and internal/api). Amounts are US cents.

export type ApplicationStatus =
Expand Down
2 changes: 1 addition & 1 deletion web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- 'apps/*'
- 'demos/*'
- 'packages/*'

# Supply-chain policy. Semgrep's package_managers.pnpm rules block the build
Expand Down
Loading