Skip to content

Latest commit

 

History

History
210 lines (158 loc) · 6.11 KB

File metadata and controls

210 lines (158 loc) · 6.11 KB

Native Cookbook

Status: current 0.x examples and recipes. This cookbook links to existing examples and reference pages instead of repeating the full learning path.

Run repository commands from the repository root unless a recipe says to cd into an example directory.

Pages And Routes

Build a static page and component:

go run ./cmd/gowdk build --out /tmp/gowdk-build \
  examples/pages/home.page.gwdk \
  examples/pages/hero.cmp.gwdk

Build a dynamic SPA route declared with paths {}:

go run ./cmd/gowdk build --out /tmp/gowdk-dynamic-build \
  examples/pages/blog-post.page.gwdk

Use routing, language blocks, and examples/pages for the source contract.

Components, Client State, And WASM Islands

Build source-level base components:

go run ./cmd/gowdk build --out /tmp/gowdk-base-components \
  examples/components/base/*.gwdk

Build the component WASM island ABI example:

go run ./cmd/gowdk build --out /tmp/gowdk-wasm-island \
  examples/components/wasm/*.gwdk

Build the persisted page-store example:

go run ./cmd/gowdk build --out /tmp/gowdk-store-persist \
  examples/store-persist/shop.page.gwdk \
  examples/store-persist/add-button.cmp.gwdk \
  examples/store-persist/cart-badge.cmp.gwdk

Use components, markup, examples/components, and examples/store-persist for supported component, client, and page-store behavior.

Actions, APIs, And Fragments

Build the endpoint cookbook:

cd examples/endpoints
make check
make routes
make build

Use actions, APIs, partials, and examples/endpoints for action redirects, validation fragments, JSON APIs, webhooks, and standalone fragments.

SSR, Hybrid Pages, And Guards

Build a simple generated SSR page:

go run ./cmd/gowdk build --ssr \
  --out /tmp/gowdk-ssr-build \
  --app /tmp/gowdk-ssr-app \
  --bin /tmp/gowdk-ssr-site \
  examples/ssr/simple-ssr.page.gwdk

Build the auth guard example:

cd examples/auth-guard
make check
make routes
make build

Use SSR, hybrid pages, guards, and examples/auth-guard for request-time page and route-gate behavior. Backend resource authorization remains app-owned Go code.

Go Interop And Contracts

Build a page that calls imported Go from build {}:

go run ./cmd/gowdk build --out /tmp/gowdk-go-interop \
  examples/go-interop/imported-build.page.gwdk

Build the command/query contract example:

go run ./cmd/gowdk build \
  --config examples/contracts/gowdk.config.go \
  --out /tmp/gowdk-contracts-build \
  --app /tmp/gowdk-contracts-app \
  --bin /tmp/gowdk-contracts-site \
  examples/contracts/patients.page.gwdk

Use Go interop, contracts, realtime, and examples/contracts for handler and contract registration patterns.

CSS, Assets, SEO, And Images

Build a configured stylesheet example:

go run ./cmd/gowdk build \
  --config examples/css/gowdk.config.go \
  --out /tmp/gowdk-css-build \
  examples/css/styled.page.gwdk

Build the SEO addon example:

go run ./cmd/gowdk build \
  --config examples/seo/gowdk.config.go \
  --out /tmp/gowdk-seo-build \
  examples/seo/*.gwdk

Use CSS, images, SEO, and manifest for asset and metadata behavior.

Deployment, Testing, And Operations

Build a one-binary generated app:

go run ./cmd/gowdk build \
  --out /tmp/gowdk-embed-build \
  --app /tmp/gowdk-embed-app \
  --bin /tmp/gowdk-embed-site \
  examples/embed/site.page.gwdk

Emit optional deployment recipe starters:

go run ./cmd/gowdk build \
  --out /tmp/gowdk-build \
  --app /tmp/gowdk-app \
  --bin /tmp/gowdk-site \
  --deploy-recipe systemd,caddy \
  examples/pages/home.page.gwdk \
  examples/pages/hero.cmp.gwdk

Use deployment, testing, dev server, and security for current operations guidance.

Playground Export

Export an ordinary source project archive:

gowdk playground export --dir . --out /tmp/gowdk-project.zip

Use playground onboarding and sandboxing for hosted execution constraints and export rules.

Coverage And Ownership

Use this table to find the maintained source for a recipe or gap. Current capability status belongs in product requirements, not in issue-state summaries inside the cookbook.

Area Owning source
Runnable recipes This cookbook and the focused example directory
Example inventory and verification commands Examples Index
Accepted language syntax and semantics Language Index and Conformance Corpus
Commands, config, routing, runtime, and integrations Reference Index
Compiler pipeline and generated artifacts Compiler Index
Current capability maturity Product Requirements
Dependency-aware future work Product Roadmap
Architecture and implementation plans Engineering Index
Production hardening and app-owned responsibilities Security and Operations
Documentation rendering and authoring rules Documentation Style

When a recipe falls behind implementation, update the recipe, its example, and the owning contract in the same change. Issue links may provide traceability, but they must not be the only description of current behavior or remaining work.