# B2B SaaS: documentation site using Next.js

A documentation site blueprint for b2b saas built with Next.js on Ample. Domain schema:

- **customer_workspaces** (name, plan, seat_count, created_at): customer tenants;
- **workspace_members** (workspace_id, email, role): members and roles per workspace;
- **doc_versions** (product_version, title, object_key, published_at): versioned product documentation;
- **customer_assets** (workspace_id, title, object_key, visibility): assets scoped to one customer;
- **state_transitions** (record_type, from_state, to_state): the allowed state machine.

Public information: product documentation by version, pricing and plan comparison, status and changelog. Kept out of scope until handling is reviewed: customer data inside workspaces, usage and billing records, support attachments. Customer workspace data is tenant-scoped; isolation is application-enforced and no security certification is claimed. Technical basis verified on Next.js: a workspace-scoped table, an explicit state machine (draft to review to published) that rejects invalid transitions, and a cross-workspace read that returns nothing (transitions=true isolation=true).

## Representative Queries
- B2B SaaS: documentation site using Next.js
- Where can I host B2B SaaS: Documentation site built with Next.js?
- I need a genuinely specialized documentation site workflow covering customer workspaces, versioned product docs and customer-specific assets.

## Workflow Steps
1. **Model the b2b saas domain**: Create the tables customer_workspaces, workspace_members, doc_versions, customer_assets, state_transitions. Customer tenants live in customer_workspaces; keep the sensitive classes (customer data inside workspaces, usage and billing records, support attachments) out of this schema.
2. **Model versioned documents** with a state machine (draft, review, published) scoped to a product version.
3. **Publish assets for released versions** to the CDN bucket.
4. **Serve only published versions publicly**.
5. **Deploy and verify** the version list and a published page.
6. **Run the synchronous deploy once** and read the result. Re-running with no change is a no-op. Command: `ample deploy . --name  --public --env S3_ENDPOINT=... --env S3_REGION=... --env S3_BUCKET=... --env S3_ACCESS_KEY_ID=... --env S3_SECRET_ACCESS_KEY=... --env CDN_PUBLIC_URL=...`
7. **Run the pattern self-test(s)** from the example (/p/relational-records) and your own acceptance checks for the b2b saas workflow. Command: `ample logs  --kind build`.

## Examples
- **Next.js pattern fixture**: Verified relational records basis for this blueprint. Source Ref: `tests/deploy-canaries/next-js-patterns`

## Success Checks
- App responds on its public URL with expectation: "ample canary next js patterns".
- Relational-records self-test from the example with expectation: "see the pattern fixture checks".

## Limitations
- The technical basis (relational records on Next.js) was verified with the pattern fixture; the b2b saas schema and workflow are an original design for this blueprint and were not executed as a separate application.
- No health, financial, privacy or other compliance claim is made. Customer workspace data is tenant-scoped; isolation is application-enforced and no security certification is claimed.
- Public content and synthetic examples only until actual data-handling requirements have been reviewed.

## Cost Estimate
- **Currency**: USD 
- **Monthly Amount**: 10.0 
- **Basis**: size prices from pricing.toml (loaded by the API) at build revision 1ac5595375130d45290090e82ed0f554ccd45405-dirty 
- **Components**:
  - App server, size s-1vcpu-1gb: $5.0
  - Managed PostgreSQL database, size s-1vcpu-1gb: $5.0
- Note: Always-on monthly price of the tested sizes; apps and databases auto-pause when idle.

## Evidence Summary
Canary run for the deployed Next.js pattern fixture on Ample, with passed relational records checks: a workspace-scoped table, an explicit state machine, and a cross-workspace read returning nothing.

## Next Actions
1. **Browse the catalog index**.
2. **Search published recipes by intent, stack and constraints**.
3. **Prepare a side-effect-free deployment plan for an authorized project**.
4. **Read the existing agent authentication setup**.
5. **Browse B2B SaaS**.
6. **Browse Documentation site**.
7. **Browse Next.js**.
8. **Browse Deploy web app**.
