ecommerce

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 0 Imported by: 0

README

ShopFront — the declaration-driven flagship

This is the largest example in the repo and the proof of the framework's thesis: a complete storefront described once in gofastr.yml — 5 related entities (categories, products, orders, order_items, reviews), a themed 8-screen UI, custom endpoints, seed data, middleware, and a plugin — emitted as runnable Go by a single command. Nothing under gen/ is hand-written.

What it proves

One blueprint fans out into every surface: auto-migrated SQL schema, REST CRUD with validation and cursor pagination, OpenAPI, 25 MCP tools for agents, and a server-rendered themed storefront. All of it is asserted live by flagship_test.go, which regenerates gen/ from the blueprint, builds the binary, boots it, and hits each surface — so the proof never depends on a stale checkout.

Secure by default

The blueprint ships with auth enabled (app.auth.enabled: true) and the customer-PII entities — orders and order_items — owner-scoped via owner_field: user_id. The framework stamps the owner on create and scopes every list/get/update/delete (REST and MCP) to the requesting user, failing closed with 401 when no owner can be derived. TestOrdersOwnerScoped pins this. The full story of how the first cut shipped insecure and how it was fixed is in BUILD_JOURNAL.md.

Regenerate and run

cd examples/ecommerce
gofastr generate --from=gofastr.yml   # re-emits gen/ from the blueprint
go run ./gen                          # serves on localhost:8080

gen/ is gitignored — generated code is regenerated, not committed.

  • BUILD_JOURNAL.md — the build narrative: what the declaration contains, every surface it produces, the security fix, and the honest gaps (stubs the generator emits but does not wire).
  • flagship_test.go — the end-to-end proof.
  • gofastr.yml — the entire input.

Documentation

Overview

Package ecommerce is GoFastr's declaration-driven flagship example: a complete storefront — five related entities, screens, navigation, custom endpoints, seed data, and a theme — declared once in gofastr.yml and emitted as runnable Go by the CLI:

gofastr generate --from=gofastr.yml

The generated app lives under gen/ (gitignored — regenerate with the command above; flagship_test.go regenerates it on every run) and is the proof of the framework's thesis: one blueprint produces a SQL schema, REST CRUD, an OpenAPI spec, a typed MCP tool surface, and a server-rendered UI — none of it hand-written. See BUILD_JOURNAL.md for the full trail and flagship_test.go for the end-to-end surface check.

The scaffolded, owned app lives in the app/ subpackage (output_dir: app); run it directly:

go run ./examples/ecommerce/app

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL