# Architecture practices: client portal using Next.js

A client portal blueprint for architecture practices built with Next.js on Ample. Domain schema:

- **client_entities** (name, entity_type, site_address): clients and project sites;  
- **projects** (client_entity_id, project_name, stage, period_start, period_end): engagement periods by RIBA/AIA-style stage;  
- **drawing_sets** (project_id, set_name, revision, object_key, issued_at): versioned drawing issues;  
- **approvals** (project_id, drawing_set_id, approver_role, decided_at, decision): client sign-offs per issue;  
- **document_access** (document_id, principal_reference, role, granted_at): who may read which document.

Public information: portfolio and services, team and accreditations, studio locations. Kept out of scope until handling is reviewed: unreleased drawings and site surveys, planning submissions before filing, client contact details. Drawings and surveys are client-confidential until issued; the portal models per-project authorization only. Technical basis verified on Next.js: a role-to-document access model with negative tests (401 without identity, 403 for the wrong role) and a private-bucket round-trip for the allowed role (private=ok).

## Representative Queries
- Architecture practices: client portal using Next.js  
- Where can I host Architecture practices: Client portal built with Next.js?  
- I need a genuinely specialized client portal workflow covering project phases, drawing versions and reviewer access.

## Framework
- Next.js

## Workload
- Client portal

## Industry
- Architecture practices

## Release Status
- Published

## Support Status
- Verified

## Execution Status
- Ready

### Prerequisites
- A Next.js project (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template)  
- A PostgreSQL driver reading DATABASE_URL (auto-provisioned when omitted)  
- Bucket credentials from `ample bucket create` passed as encrypted S3_* environment variables  
- A review of which architecture practices data classes may be handled at all; this blueprint models public information only

## Tested Configuration
- **Template**: node-22  
- **Runtime**: node  
- **Size**: s-1vcpu-1gb  
- **Install**: npm install  
- **Build**: npm run build --if-present  
- **Start**: npm run start

## Workflow Steps
1. **Model the architecture practices domain**: Create the tables client_entities, projects, drawing_sets, approvals, document_access. Clients and project sites live in client_entities; keep the sensitive classes (unreleased drawings and site surveys, planning submissions before filing, client contact details) out of this schema.
2. **Workflow step 1**: Model client entities and engagement periods; every document belongs to one engagement.  
3. **Workflow step 2**: Authorize by client entity and role before any storage access (401 without identity, 403 for the wrong client).  
4. **Workflow step 3**: Store documents in the private bucket and stream them through the app.  
5. **Workflow step 4**: Deploy and verify the negative authorization tests and an authorized download.  
6. **Deploy**: Run the synchronous deploy once and read the result. Re-running with no change is a no-op.  
7. **Verify**: Run the pattern self-test(s) from the example (/p/private-document-library) and your own acceptance checks for the architecture practices workflow.

## Examples
- **Next.js pattern fixture**: Verified private document library basis for this blueprint.

## Success Checks
- App responds on its public URL: `/` should expect `ample canary next js patterns`  
- Private-document-library self-test from the example: `/p/private-document-library` should expect `see the pattern fixture checks`

## Limitations
- The technical basis (private document library on Next.js) was verified with the pattern fixture; the architecture practices 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. Drawings and surveys are client-confidential until issued; the portal models per-project authorization only.  
- Public content and synthetic examples only until actual data-handling requirements have been reviewed.  
- Verified on the node-22 template at s-1vcpu-1gb; region, request-duration limits and other sizes are unknown or unverified.  
- Managed PostgreSQL 16 only; extensions, connection limits and backup or restore procedures are not verified.  
- PutObject and GetObject with path-style addressing are verified; other S3 operations and CDN cache rules are not.
  
## 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, quantity=1.0, monthlyAmount=5.0  
  - Managed PostgreSQL database: size=s-1vcpu-1gb, quantity=1.0, monthlyAmount=5.0  
- **Note**: Always-on monthly price of the tested sizes; apps and databases auto-pause when idle. Buckets are allocation-priced per quota and not included.

## Evidence Summary
- **Canary Run**: Next.js pattern fixture deployed on Ample (next build then next start -H 0.0.0.0 -p $PORT on the node-22 template); the private document library checks passed: a role-to-document access model with negative tests (401 without identity, 403 for the wrong role) and a private-bucket round-trip for the allowed role (private=ok). The blueprint's Architecture practices schema and workflow below build on that verified basis and were not separately executed.
  - **Observed At**: 2026-09-21T02:34:39Z  
  - **Implementation Revision**: 1d28ae0-dirty (CLI 0.1.21)  
  - **Expires At**: 2027-03-20T02:34:39Z

## Next Actions
- **Browse the catalog index**: GET `/v1/catalog`  
- **Search published recipes by intent, stack and constraints**: POST `/v1/catalog/search` with body `{"limit":5,"query":"Architecture practices: client portal using Next.js"}`  
- **Prepare a side-effect-free deployment plan for an authorized project**: POST `/v1/catalog/plan` with body `{"inputs":{},"projectId":"","recipeId":"page:blueprints:architecture-practices:client-portal:next-js","recipeRevision":"r1"}`  
- **Read the existing agent authentication setup**: GET `/mcp/setup`  
- **Browse Architecture practices**: GET `/v1/catalog/nodes/industry%3Aarchitecture-practices`  
- **Browse Client portal**: GET `/v1/catalog/nodes/workload%3Aclient-portal`  
- **Browse Next.js**: GET `/v1/catalog/nodes/stack%3Aframework-next-js`  
- **Browse Deploy web app**: GET `/v1/catalog/nodes/intent%3Adeploy-web-app`
