# Developer flow

Source: https://gortexa.sheng.page/en/examples/workflow/

## 01 scaffold-smoke — the full developer loop

Proves create → gen → build → test runs end to end and still holds after adding a second API. This is a scaffold transport smoke test; `create` deliberately leaves the placeholder secret in place, so a real secret must be injected into the runtime environment before the server will start.

```bash
gortexa create myapp --module github.com/me/myapp
cd myapp
make gen                        # buf lint → breaking → generate
go build ./... && go test ./...
gortexa gen shop/v1 Product     # add a second API
make gen && go build ./... && go test ./...
```

Key assertions: `proto/myapp/shop/v1/product.proto` (package `myapp.shop.v1` — `gen` reads the project namespace from `.gortexa/project.json`) and `internal/logic/product.go` are generated, `cmd/server/main.go` is wired for product, and `etc/config.yaml` still carries `dev-only-insecure-secret-change-me-please`, which the server refuses to boot with until `GORTEXA_AUTH__JWT_SECRET` is set. That only proves local startup; before Git or Docker, move to external secret injection and replace the in-memory logic with a real data layer.

## 02 multi-protocol-e2e — one entity across three protocols

On a single h2c port (`:18080`), an entity created over gRPC is fetchable over HTTP, and one created over MCP shows up in the list — all three share one store. `$TOK` is a dev token, `$SCHEMA` is the descriptor from `buf build`.

Create over gRPC:

```bash
buf curl --protocol grpc --http2-prior-knowledge --schema $SCHEMA \
  -H "authorization: Bearer $TOK" \
  -d '{"resource":{"name":"grpc-entity","owner":"owner-e2e"}}' \
  http://localhost:18080/myapp.resource.v1.ResourceService/CreateResource
```

Fetch the same id over the HTTP gateway, then create a third over MCP `tools/call`:

```bash
curl -H "authorization: Bearer $TOK" http://localhost:18080/v1/resources/$RID   # 200, same entity

curl -XPOST http://localhost:18080/mcp -H 'Content-Type: application/json' \
  -H "authorization: Bearer $TOK" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call",
       "params":{"name":"create_resource",
                 "arguments":{"resource":{"name":"mcp-entity","owner":"owner-e2e"}}}}'
```

Listing `owner-e2e` at the end shows the entities created over gRPC, HTTP and MCP together — proof the three surfaces sit on one store.
