create-nextblock 0.15.5 → 0.15.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +50 -26
- package/templates/nextblock-template/app/api/cron/reset-sandbox/route.ts +14 -0
- package/templates/nextblock-template/app/layout.tsx +7 -3
- package/templates/nextblock-template/app/lib/seo.ts +319 -311
- package/templates/nextblock-template/docs/05-DEVELOPER-GUIDE.md +25 -19
- package/templates/nextblock-template/docs/06-CLI-AND-SCAFFOLDING.md +1 -1
- package/templates/nextblock-template/docs/08-NEXTBLOCK-CORTEX-AI-ARCHITECTURE.md +2 -2
- package/templates/nextblock-template/docs/12-VERCEL-DEPLOYMENT.md +32 -9
- package/templates/nextblock-template/docs/TECHNICAL_SPECIFICATION.md +540 -542
- package/templates/nextblock-template/docs/assets/lighthouse-scores.png +0 -0
- package/templates/nextblock-template/package.json +14 -1
- package/templates/nextblock-template/public/assets/nextblock-banner.jpg +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
### 1.1.1 Project Overview
|
|
8
8
|
|
|
9
|
-
NextBlock CMS is an AI-Native, Open-Core Content Management System purpose-built for Next.js 16, distributed as an Nx
|
|
9
|
+
NextBlock CMS is an AI-Native, Open-Core Content Management System purpose-built for Next.js 16, distributed as an Nx monorepo that unifies a public-facing website, an authenticated CMS, a collaborative block editor, shared database utilities, a design system, an optional premium e-commerce module, and a command-line scaffolding tool into a single coherent workspace. The project is published under the workspace package identifier `nextblock` and is licensed under AGPLv3, with premium modules distributed under a source-available, license-gated model.
|
|
10
10
|
|
|
11
11
|
The system's central value proposition — "Speed. Scalability. AI-Readiness (coming soon)." — is encoded directly in its architectural decisions: a Next.js 16 App Router application (`apps/nextblock`) backed by Supabase, leveraging React Server Components, edge caching, and an image-optimization pipeline targeting a default 100/100 Lighthouse Performance score. Users bootstrap new projects in under thirty seconds via the `npm create nextblock@latest` CLI, which produces a standalone, production-ready Next.js application.
|
|
12
12
|
|
|
@@ -67,7 +67,7 @@ NextBlock CMS occupies the "sweet spot" between block-editor flexibility (WordPr
|
|
|
67
67
|
|
|
68
68
|
1. **Open-Core Core** — All foundational libraries (`libs/ui`, `libs/utils`, `libs/db`, `libs/editor`, `libs/sdk`) are tagged `scope:public` in their Nx project configurations and published under AGPLv3.
|
|
69
69
|
2. **Premium Source-Available Extensions** — The `libs/ecommerce` library is tagged `scope:premium` in `libs/ecommerce/project.json` and activated via a license-key-gated installation path (`@nextblock-cms/ecommerce@npm:@nextblock-cms/ecom@latest`).
|
|
70
|
-
3. **CLI-Driven Scaffolding** — The `apps/create-nextblock` package
|
|
70
|
+
3. **CLI-Driven Scaffolding** — The `apps/create-nextblock` package provides the `create` (default) and `activate` commands for respectively bootstrapping a new project and installing premium modules post-scaffold.
|
|
71
71
|
|
|
72
72
|
#### 1.2.1.2 Current System Limitations Addressed
|
|
73
73
|
|
|
@@ -75,16 +75,16 @@ The project does not replace an existing in-house system; rather, it targets ext
|
|
|
75
75
|
|
|
76
76
|
#### 1.2.1.3 Integration with Existing Enterprise Landscape
|
|
77
77
|
|
|
78
|
-
NextBlock CMS integrates with a specific, opinionated set of external services whose environment requirements are declared in `libs/environment.d.ts` (augmenting `NodeJS.ProcessEnv`) and `.env.
|
|
78
|
+
NextBlock CMS integrates with a specific, opinionated set of external services whose environment requirements are declared in `libs/environment.d.ts` (augmenting `NodeJS.ProcessEnv`) and `.env.example`.
|
|
79
79
|
|
|
80
80
|
| Integration Domain | Provider(s) | Purpose |
|
|
81
81
|
|:--|:--|:--|
|
|
82
|
-
| Database & Authentication | Supabase (`@supabase/ssr
|
|
83
|
-
| Object Storage | Cloudflare R2 (S3-compatible via `@aws-sdk/client-s3`
|
|
84
|
-
| Physical Commerce | Stripe (`stripe
|
|
85
|
-
| Digital Commerce | Freemius (`@freemius/checkout
|
|
82
|
+
| Database & Authentication | Supabase (`@supabase/ssr`, `@supabase/supabase-js`) | Postgres storage, Row-Level Security, Auth |
|
|
83
|
+
| Object Storage | Cloudflare R2 (S3-compatible via `@aws-sdk/client-s3`) | Media assets, presigned uploads |
|
|
84
|
+
| Physical Commerce | Stripe (`stripe`, `@stripe/stripe-js`) | Checkout, payments, Stripe Tax |
|
|
85
|
+
| Digital Commerce | Freemius (`@freemius/checkout`, `@freemius/sdk`) | Digital-product checkout, licensing |
|
|
86
86
|
| FX Rates | `api.frankfurter.dev` (configurable via `FX_API_BASE_URL`) | Multi-currency rate synchronization |
|
|
87
|
-
| Analytics & Observability | `@vercel/speed-insights
|
|
87
|
+
| Analytics & Observability | `@vercel/speed-insights`, `@next/third-parties` (GTM) | Performance and behavior tracking |
|
|
88
88
|
| Hosting Platform | Vercel (cron jobs defined in `vercel.json`) | Edge delivery, scheduled jobs |
|
|
89
89
|
| Email Transport | SMTP (env-configured) | Transactional email |
|
|
90
90
|
|
|
@@ -116,8 +116,6 @@ The workspace is composed of two applications and six libraries, each with an in
|
|
|
116
116
|
| UI Design System | `libs/ui` | `@nextblock-cms/ui` |
|
|
117
117
|
| Utilities | `libs/utils` | `@nextblock-cms/utils` |
|
|
118
118
|
|
|
119
|
-
The current published versions are: `apps/nextblock` (private, `0.2.55`), `create-nextblock` (`0.2.78`), `@nextblock-cms/db` (`0.2.32`), `@nextblock-cms/editor` (`0.2.24`), `@nextblock-cms/ecom` (`0.0.10`), `@nextblock-cms/sdk` (`0.2.9`), `@nextblock-cms/ui` (`0.2.19`), `@nextblock-cms/utils` (`0.2.13`).
|
|
120
|
-
|
|
121
119
|
```mermaid
|
|
122
120
|
graph TB
|
|
123
121
|
subgraph Apps["Applications"]
|
|
@@ -168,46 +166,46 @@ The technical approach combines a React Server Components-first rendering model
|
|
|
168
166
|
|
|
169
167
|
**Core Framework Stack**
|
|
170
168
|
|
|
171
|
-
| Concern | Technology |
|
|
172
|
-
|
|
173
|
-
| Application Framework | Next.js (App Router) |
|
|
174
|
-
| UI Runtime | React / react-dom |
|
|
175
|
-
| Language | TypeScript (strict mode) |
|
|
176
|
-
| Monorepo Orchestration | Nx |
|
|
169
|
+
| Concern | Technology |
|
|
170
|
+
| :-- | :-- |
|
|
171
|
+
| Application Framework | Next.js (App Router) |
|
|
172
|
+
| UI Runtime | React / react-dom |
|
|
173
|
+
| Language | TypeScript (strict mode) |
|
|
174
|
+
| Monorepo Orchestration | Nx |
|
|
177
175
|
|
|
178
176
|
**Styling, UI, and Editor**
|
|
179
177
|
|
|
180
|
-
| Concern | Technology |
|
|
181
|
-
|
|
182
|
-
| Utility CSS | Tailwind CSS |
|
|
183
|
-
| Primitive Components | Radix UI (12+ primitives) |
|
|
184
|
-
| Icon System | lucide-react |
|
|
185
|
-
| Theme Management | next-themes (light/dark/vibrant/system) |
|
|
186
|
-
| Rich-Text Engine | Tiptap (40+ extensions) |
|
|
187
|
-
| Collaboration | Yjs / y-protocols / y-tiptap |
|
|
188
|
-
| Syntax Highlighting | lowlight |
|
|
189
|
-
| Mathematics | katex |
|
|
178
|
+
| Concern | Technology |
|
|
179
|
+
| :-- | :-- |
|
|
180
|
+
| Utility CSS | Tailwind CSS |
|
|
181
|
+
| Primitive Components | Radix UI (12+ primitives) |
|
|
182
|
+
| Icon System | lucide-react |
|
|
183
|
+
| Theme Management | next-themes (light/dark/vibrant/system) |
|
|
184
|
+
| Rich-Text Engine | Tiptap (40+ extensions) |
|
|
185
|
+
| Collaboration | Yjs / y-protocols / y-tiptap |
|
|
186
|
+
| Syntax Highlighting | lowlight |
|
|
187
|
+
| Mathematics | katex |
|
|
190
188
|
|
|
191
189
|
**State, Forms, and Validation**
|
|
192
190
|
|
|
193
|
-
| Concern | Technology |
|
|
194
|
-
|
|
195
|
-
| Client State | zustand |
|
|
196
|
-
| Schema Validation | zod |
|
|
197
|
-
| Form Management | react-hook-form |
|
|
198
|
-
| Form Resolvers | @hookform/resolvers |
|
|
191
|
+
| Concern | Technology |
|
|
192
|
+
| :-- | :-- |
|
|
193
|
+
| Client State | zustand |
|
|
194
|
+
| Schema Validation | zod |
|
|
195
|
+
| Form Management | react-hook-form |
|
|
196
|
+
| Form Resolvers | @hookform/resolvers |
|
|
199
197
|
|
|
200
198
|
**Media, Build, and Operations**
|
|
201
199
|
|
|
202
|
-
| Concern | Technology |
|
|
203
|
-
|
|
204
|
-
| Image Processing | sharp |
|
|
205
|
-
| Blur Placeholders | plaiceholder |
|
|
206
|
-
| Critical CSS | beasties |
|
|
207
|
-
| Bundle Analysis | @next/bundle-analyzer |
|
|
208
|
-
| Unit Testing | Vitest (in `libs/utils/tests`) |
|
|
209
|
-
| Library Build | Vite + vite-plugin-dts |
|
|
210
|
-
| Local Registry | Verdaccio (`.verdaccio/`) |
|
|
200
|
+
| Concern | Technology |
|
|
201
|
+
| :-- | :-- |
|
|
202
|
+
| Image Processing | sharp |
|
|
203
|
+
| Blur Placeholders | plaiceholder |
|
|
204
|
+
| Critical CSS | beasties |
|
|
205
|
+
| Bundle Analysis | @next/bundle-analyzer |
|
|
206
|
+
| Unit Testing | Vitest (in `libs/utils/tests`) |
|
|
207
|
+
| Library Build | Vite + vite-plugin-dts |
|
|
208
|
+
| Local Registry | Verdaccio (`.verdaccio/`) |
|
|
211
209
|
|
|
212
210
|
**Architectural Patterns**
|
|
213
211
|
|
|
@@ -267,7 +265,7 @@ The following architectural invariants are enforced at workspace level and must
|
|
|
267
265
|
| Content | `text`, `heading`, `image`, `button`, `video_embed`, `section`, `form`, `testimonial`, `posts_grid` |
|
|
268
266
|
| Commerce | `product_grid`, `featured_product`, `cart`, `checkout`, `product_details` |
|
|
269
267
|
|
|
270
|
-
**Editor Capabilities** — The `@nextblock-cms/editor` library
|
|
268
|
+
**Editor Capabilities** — The `@nextblock-cms/editor` library exports `Editor`, `NotionEditor`, `EditorToolbar`, `EditorBubbleMenu`, `EditorFloatingMenu`, `EnhancedFloatingMenu`, `SlashCommandList`, `DragHandle`, `HtmlContent`, and `editorExtensions`. Feature set includes Tiptap StarterKit rich text, syntax-highlighted code blocks, tables, task lists, slash commands, drag handles, image handling, character counting, typography, mathematics, emoji, mentions, inline alert and call-to-action widgets, and custom HTML-preserving extensions for `div`, `style`, `script`, `svg`, `span`, and catch-all attribute preservation. A media-picker bridge is exposed via `setOpenImagePicker()`.
|
|
271
269
|
|
|
272
270
|
**Translation & Localization** — The set of served locales is the active rows of the `languages` table (managed at `/cms/settings/languages`; the proxy reads them with a 60-second in-memory cache and only falls back to the hardcoded `FALLBACK_LOCALES` `en`/`fr` when the DB is unreadable), backed by `languages` and `translations` tables from migration `00000000000001_setup_cms_core.sql`. First-visit language detection is admin-configurable (see F-007): browser `Accept-Language`, IP-country via host geo headers, combined, or always-default — implemented in `apps/nextblock/lib/i18n/detection.ts` and stored in `site_settings.language_detection_settings`. Content revision history is stored as snapshot + JSON Patch diff (enum `revision_type: snapshot, diff`) per migration `00000000000002_setup_content_tables.sql`.
|
|
273
271
|
|
|
@@ -401,12 +399,12 @@ The system does not natively integrate with: alternative payment processors beyo
|
|
|
401
399
|
- `README.md` — Product value proposition, competitive positioning, feature list, and documentation index
|
|
402
400
|
- `package.json` — Root workspace metadata, dependency versions, build scripts, and release tooling
|
|
403
401
|
- `LICENSE.md` — AGPLv3 license text and copyright notice (`Copyright (C) 2025 NextBlock CMS`)
|
|
404
|
-
- `nx.json` — Nx
|
|
402
|
+
- `nx.json` — Nx workspace configuration, target defaults, and release settings
|
|
405
403
|
- `tsconfig.base.json` — Shared TypeScript strict-mode configuration and `@nextblock-cms/*` path aliases
|
|
406
404
|
- `components.json` — shadcn/ui configuration (Slate base, CSS variables, RSC)
|
|
407
405
|
- `tailwind.config.js` — Root Tailwind CSS theme tokens and dark-mode configuration
|
|
408
406
|
- `vercel.json` — Cron schedule definitions (reset-sandbox at 03:00 UTC, sync-currencies at 18:00 UTC)
|
|
409
|
-
- `.env.
|
|
407
|
+
- `.env.example` — Environment variable reference template
|
|
410
408
|
|
|
411
409
|
### 1.4.2 Documentation Hub (`docs/`)
|
|
412
410
|
|
|
@@ -421,7 +419,7 @@ The system does not natively integrate with: alternative payment processors beyo
|
|
|
421
419
|
|
|
422
420
|
### 1.4.3 Application Sources
|
|
423
421
|
|
|
424
|
-
- `apps/nextblock/package.json` — Primary application package metadata (`@nextblock-cms/template`
|
|
422
|
+
- `apps/nextblock/package.json` — Primary application package metadata (`@nextblock-cms/template`)
|
|
425
423
|
- `apps/nextblock/README.md` — Application-level contributor orientation
|
|
426
424
|
- `apps/nextblock/project.json` — Nx project tags `app:nextblock` and `scope:public`
|
|
427
425
|
- `apps/nextblock/next.config.js` — Next.js image optimization, CSP, and `transpilePackages` config
|
|
@@ -430,21 +428,21 @@ The system does not natively integrate with: alternative payment processors beyo
|
|
|
430
428
|
- `apps/nextblock/app/page.tsx` — Homepage locale resolution
|
|
431
429
|
- `apps/nextblock/app/providers.tsx` — Client provider composition order
|
|
432
430
|
- `apps/nextblock/app/api/cron/reset-sandbox/route.ts` — Sandbox reset endpoint
|
|
433
|
-
- `apps/create-nextblock/package.json` — CLI package metadata (`create-nextblock`
|
|
431
|
+
- `apps/create-nextblock/package.json` — CLI package metadata (`create-nextblock`)
|
|
434
432
|
- `apps/create-nextblock/bin/create-nextblock.js` — CLI command definitions
|
|
435
433
|
|
|
436
434
|
### 1.4.4 Library Sources
|
|
437
435
|
|
|
438
436
|
- `libs/environment.d.ts` — Global `NodeJS.ProcessEnv` augmentation
|
|
439
|
-
- `libs/ui/package.json` — `@nextblock-cms/ui`
|
|
440
|
-
- `libs/editor/package.json` — `@nextblock-cms/editor`
|
|
437
|
+
- `libs/ui/package.json` — `@nextblock-cms/ui`
|
|
438
|
+
- `libs/editor/package.json` — `@nextblock-cms/editor` (+ Tiptap extension manifest)
|
|
441
439
|
- `libs/editor/README.md` — Editor capability enumeration
|
|
442
|
-
- `libs/ecommerce/package.json` — `@nextblock-cms/ecom`
|
|
440
|
+
- `libs/ecommerce/package.json` — `@nextblock-cms/ecom`
|
|
443
441
|
- `libs/ecommerce/project.json` — `scope:premium` Nx tag
|
|
444
|
-
- `libs/db/package.json` — `@nextblock-cms/db`
|
|
442
|
+
- `libs/db/package.json` — `@nextblock-cms/db`
|
|
445
443
|
- `libs/db/src/lib/package-validation.ts` — Premium package activation check (60s cache)
|
|
446
|
-
- `libs/sdk/package.json` — `@nextblock-cms/sdk`
|
|
447
|
-
- `libs/utils/package.json` — `@nextblock-cms/utils`
|
|
444
|
+
- `libs/sdk/package.json` — `@nextblock-cms/sdk`
|
|
445
|
+
- `libs/utils/package.json` — `@nextblock-cms/utils`
|
|
448
446
|
|
|
449
447
|
### 1.4.5 Database Migrations
|
|
450
448
|
|
|
@@ -480,7 +478,7 @@ The system does not natively integrate with: alternative payment processors beyo
|
|
|
480
478
|
|
|
481
479
|
# 2. Product Requirements
|
|
482
480
|
|
|
483
|
-
This section decomposes NextBlock CMS into thirty discrete, testable features organized across content management, security and authorization, premium commerce, and developer/platform concerns. Each feature is traceable to specific source files, database migrations, and documentation artifacts enumerated in section `1.4 REFERENCES`. All requirements herein are grounded in observable repository evidence; no speculative capabilities are introduced. Requirements inherit the scope boundaries established in section `1.3 SCOPE` (including explicit exclusions in
|
|
481
|
+
This section decomposes NextBlock CMS into thirty discrete, testable features organized across content management, security and authorization, premium commerce, and developer/platform concerns. Each feature is traceable to specific source files, database migrations, and documentation artifacts enumerated in section `1.4 REFERENCES`. All requirements herein are grounded in observable repository evidence; no speculative capabilities are introduced. Requirements inherit the scope boundaries established in section `1.3 SCOPE` (including explicit exclusions in ).
|
|
484
482
|
|
|
485
483
|
## 2.1 FEATURE CATALOG
|
|
486
484
|
|
|
@@ -521,7 +519,7 @@ The public content delivery feature provides locale-aware rendering of marketing
|
|
|
521
519
|
|:--|:--|
|
|
522
520
|
| Prerequisite Features | F-002 (Auth session context), F-007 (Localization), F-009 (Navigation), F-012 (Proxy) |
|
|
523
521
|
| System Dependencies | Supabase (reads published content), Cloudflare R2 (media URLs) |
|
|
524
|
-
| External Dependencies | Next.js
|
|
522
|
+
| External Dependencies | Next.js, React, `@vercel/speed-insights` |
|
|
525
523
|
| Integration Requirements | Upstream `sharp` + `plaiceholder` media pipeline; `next-themes` for class-based theming |
|
|
526
524
|
|
|
527
525
|
#### 2.1.2.2 F-004: Block-Based Page Builder
|
|
@@ -548,7 +546,7 @@ The block-based page builder is implemented as a registry in `apps/nextblock/lib
|
|
|
548
546
|
|:--|:--|
|
|
549
547
|
| Prerequisite Features | F-005 (Editor — used by `text` and `product_details`), F-006 (Media — used by `image`, `section`), F-007 (Translations) |
|
|
550
548
|
| System Dependencies | `blocks` database table (from migration `00000000000002`) |
|
|
551
|
-
| External Dependencies | `zod`
|
|
549
|
+
| External Dependencies | `zod` for schema validation |
|
|
552
550
|
| Integration Requirements | Commerce blocks (`product_grid`, `featured_product`, `cart`, `checkout`, `product_details`) require `@nextblock-cms/ecommerce` via F-022 |
|
|
553
551
|
|
|
554
552
|
#### 2.1.2.3 F-005: Tiptap Rich Text Editor
|
|
@@ -565,7 +563,7 @@ The block-based page builder is implemented as a registry in `apps/nextblock/lib
|
|
|
565
563
|
|
|
566
564
|
**Description**
|
|
567
565
|
|
|
568
|
-
The editor is a standalone published library at `libs/editor`
|
|
566
|
+
The editor is a standalone published library at `libs/editor` exposing `Editor`, `NotionEditor`, `EditorToolbar`, `EditorBubbleMenu`, `EditorFloatingMenu`, `EnhancedFloatingMenu`, `SlashCommandList`, `DragHandle`, `HtmlContent`, and `editorExtensions`. It bundles Tiptap with 40+ extensions including StarterKit, syntax-highlighted code blocks (via `lowlight` and `CodeBlockLowlight`), tables, task lists, link handling, TextStyleKit, highlight, subscript/superscript, typography, character counting, slash commands, drag handles, image handling, KaTeX mathematics (`katex`), emoji, mentions, inline alert and call-to-action widgets, and custom HTML-preserving extensions for `div`, `style`, `script`, `svg`, `span`, and catch-all attribute preservation. Collaborative editing infrastructure is supplied by `yjs`, `y-protocols`, and `y-tiptap`.
|
|
569
567
|
|
|
570
568
|
**Business Value:** Eliminates the need for downstream adopters to build or license a separate rich-text editor. **User Benefits:** Notion-class writing experience with slash commands, drag handles, and live collaboration primitives. **Technical Context:** Extension kit assembled in `libs/editor/src/lib/kit.ts`; advanced features catalogued in `libs/editor/ADVANCED_FEATURES.md`.
|
|
571
569
|
|
|
@@ -575,7 +573,7 @@ The editor is a standalone published library at `libs/editor` (version `0.2.24`)
|
|
|
575
573
|
|:--|:--|
|
|
576
574
|
| Prerequisite Features | None (leaf library within `scope:public`) |
|
|
577
575
|
| System Dependencies | F-006 media-picker bridge (via `setOpenImagePicker()`) |
|
|
578
|
-
| External Dependencies | Tiptap
|
|
576
|
+
| External Dependencies | Tiptap extension ecosystem, `lowlight`, `katex`, Yjs stack |
|
|
579
577
|
| Integration Requirements | Consumed by F-004 for text-oriented block rendering |
|
|
580
578
|
|
|
581
579
|
#### 2.1.2.4 F-006: Media Management and Image Pipeline
|
|
@@ -592,9 +590,9 @@ The editor is a standalone published library at `libs/editor` (version `0.2.24`)
|
|
|
592
590
|
|
|
593
591
|
**Description**
|
|
594
592
|
|
|
595
|
-
Media management combines a Cloudflare R2-backed object store with an image-processing pipeline. Two upload mechanisms are supported: a presigned PUT URL path and a multipart proxy path, both exposed under `apps/nextblock/app/api/upload/`. Processing occurs through `apps/nextblock/app/api/process-image/` using `sharp`
|
|
593
|
+
Media management combines a Cloudflare R2-backed object store with an image-processing pipeline. Two upload mechanisms are supported: a presigned PUT URL path and a multipart proxy path, both exposed under `apps/nextblock/app/api/upload/`. Processing occurs through `apps/nextblock/app/api/process-image/` using `sharp` to generate AVIF derivatives and `plaiceholder` to produce blur placeholders. The `media` table in the Supabase schema stores `object_key`, `file_type`, `size_bytes`, `description`, `width`, `height`, `blur_data_url`, `variants` (JSONB), `folder`, and `file_path`. Upload recording is enforced to the `ADMIN` and `WRITER` roles via `recordMediaUpload` in `libs/db/src/lib/media-actions.ts`.
|
|
596
594
|
|
|
597
|
-
**Business Value:** Delivers production-grade media handling without requiring adopters to integrate a dedicated DAM. **User Benefits:** Automatic modern-format conversion, blur placeholders, and role-gated uploads. **Technical Context:** Uses `@aws-sdk/client-s3`
|
|
595
|
+
**Business Value:** Delivers production-grade media handling without requiring adopters to integrate a dedicated DAM. **User Benefits:** Automatic modern-format conversion, blur placeholders, and role-gated uploads. **Technical Context:** Uses `@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner` for S3-compatible R2 access.
|
|
598
596
|
|
|
599
597
|
**Dependencies**
|
|
600
598
|
|
|
@@ -650,7 +648,7 @@ Locale propagation uses the `NEXT_USER_LOCALE` cookie and the `X-User-Locale` re
|
|
|
650
648
|
|
|
651
649
|
**Description**
|
|
652
650
|
|
|
653
|
-
Revisions are implemented in the `page_revisions` and `post_revisions` tables defined in migration `00000000000002_setup_content_tables.sql`, using a hybrid snapshot/diff model. The `revision_type` enum (`snapshot`, `diff`) distinguishes between full snapshots and JSON Patch diffs (generated via `fast-json-patch`
|
|
651
|
+
Revisions are implemented in the `page_revisions` and `post_revisions` tables defined in migration `00000000000002_setup_content_tables.sql`, using a hybrid snapshot/diff model. The `revision_type` enum (`snapshot`, `diff`) distinguishes between full snapshots and JSON Patch diffs (generated via `fast-json-patch`). A UNIQUE constraint on `(page_id, version)` ensures monotonically increasing snapshot versions. The CMS surface resides under `apps/nextblock/app/cms/revisions/`.
|
|
654
652
|
|
|
655
653
|
**Business Value:** Provides audit trail and rollback capability for authored content. **User Benefits:** Authors can restore prior states; accidental deletions are recoverable. **Technical Context:** Diff generation reduces storage overhead for frequently-updated content.
|
|
656
654
|
|
|
@@ -660,7 +658,7 @@ Revisions are implemented in the `page_revisions` and `post_revisions` tables de
|
|
|
660
658
|
|:--|:--|
|
|
661
659
|
| Prerequisite Features | F-002 (Auth), F-003 (RBAC) |
|
|
662
660
|
| System Dependencies | `page_revisions`, `post_revisions` tables; `revision_type` enum |
|
|
663
|
-
| External Dependencies | `fast-json-patch`
|
|
661
|
+
| External Dependencies | `fast-json-patch` |
|
|
664
662
|
| Integration Requirements | Triggered on page/post write paths |
|
|
665
663
|
|
|
666
664
|
#### 2.1.2.7 F-009: Navigation Menus
|
|
@@ -704,7 +702,7 @@ Three menu locations are supported: `HEADER`, `FOOTER`, and `SIDEBAR`, encoded b
|
|
|
704
702
|
|
|
705
703
|
**Description**
|
|
706
704
|
|
|
707
|
-
Authentication is layered over Supabase Auth using `@supabase/ssr`
|
|
705
|
+
Authentication is layered over Supabase Auth using `@supabase/ssr` and `@supabase/supabase-js`. Server actions in `apps/nextblock/app/actions.ts` implement sign-in, sign-up, and forgot-password flows. The `app/auth/callback/route.ts` route exchanges authorization codes for sessions (used by the email-confirmation and recovery flows) (`supabase.auth.exchangeCodeForSession()`), loads the profile role, and redirects using `resolvePostAuthRedirect()`. Email templates for confirmation, email change, invitation, magic-link, reauthentication, and password recovery reside in `libs/db/src/supabase/templates/`. A `handle_new_user()` trigger function paired with the `on_auth_user_created` trigger on `auth.users` automatically provisions a `profiles` row on registration.
|
|
708
706
|
|
|
709
707
|
**Business Value:** Eliminates the need for adopters to integrate a separate identity provider. **User Benefits:** Multiple sign-in methods (email/password, magic link) with localized email templates. **Technical Context:** Supabase Auth session cookies are synchronized by the request proxy to Server Components.
|
|
710
708
|
|
|
@@ -714,7 +712,7 @@ Authentication is layered over Supabase Auth using `@supabase/ssr` 0.7.0 and `@s
|
|
|
714
712
|
|:--|:--|
|
|
715
713
|
| Prerequisite Features | F-012 (Proxy session sync) |
|
|
716
714
|
| System Dependencies | `auth.users` (Supabase-managed), `profiles` table |
|
|
717
|
-
| External Dependencies | `@supabase/ssr
|
|
715
|
+
| External Dependencies | `@supabase/ssr`, `@supabase/supabase-js`, `nodemailer` for SMTP |
|
|
718
716
|
| Integration Requirements | Supabase project env vars; SMTP env vars |
|
|
719
717
|
|
|
720
718
|
#### 2.1.3.2 F-003: Role-Based Access Control (RBAC)
|
|
@@ -893,7 +891,7 @@ The shopping cart is implemented with Zustand state management in `libs/ecommerc
|
|
|
893
891
|
|:--|:--|
|
|
894
892
|
| Prerequisite Features | F-013, F-018 (Multi-Currency), F-022, F-019 (Shipping), F-020 (Tax) |
|
|
895
893
|
| System Dependencies | `orders` table, `order_items` table |
|
|
896
|
-
| External Dependencies | `stripe
|
|
894
|
+
| External Dependencies | `stripe`, `@freemius/checkout` |
|
|
897
895
|
| Integration Requirements | Provider-specific handoff to F-016 or F-017 based on product type |
|
|
898
896
|
|
|
899
897
|
#### 2.1.4.4 F-016: Stripe Payment Integration
|
|
@@ -918,7 +916,7 @@ Stripe integration resides in `libs/ecommerce/src/lib/stripe/`. The `StripeProvi
|
|
|
918
916
|
|:--|:--|
|
|
919
917
|
| Prerequisite Features | F-013, F-014, F-018, F-019, F-020, F-021, F-022 |
|
|
920
918
|
| System Dependencies | Stripe account, webhook endpoint |
|
|
921
|
-
| External Dependencies | `stripe
|
|
919
|
+
| External Dependencies | `stripe`, `@stripe/stripe-js` |
|
|
922
920
|
| Integration Requirements | `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` env vars |
|
|
923
921
|
|
|
924
922
|
#### 2.1.4.5 F-017: Freemius Licensing and Digital Products
|
|
@@ -943,7 +941,7 @@ Freemius integration lives in `libs/ecommerce/src/lib/providers/` and supports d
|
|
|
943
941
|
|:--|:--|
|
|
944
942
|
| Prerequisite Features | F-013 (products with Freemius provider), F-022 |
|
|
945
943
|
| System Dependencies | `freemius_plans`, `freemius_pricing` tables |
|
|
946
|
-
| External Dependencies | `@freemius/checkout
|
|
944
|
+
| External Dependencies | `@freemius/checkout`, `@freemius/sdk` |
|
|
947
945
|
| Integration Requirements | `FREEMIUS_*` env vars |
|
|
948
946
|
|
|
949
947
|
#### 2.1.4.6 F-018: Multi-Currency Pricing
|
|
@@ -1087,7 +1085,7 @@ The `package_activations` table (migration `00000000000003_setup_catalog_and_lic
|
|
|
1087
1085
|
|
|
1088
1086
|
**Description**
|
|
1089
1087
|
|
|
1090
|
-
Four themes — `light`, `dark`, `vibrant`, and `system` — are provided via `next-themes`
|
|
1088
|
+
Four themes — `light`, `dark`, `vibrant`, and `system` — are provided via `next-themes` with class-based switching. The `ThemeProvider` is composed as the outermost wrapper in `apps/nextblock/app/providers.tsx` (line 61), and `components/theme-switcher.tsx` exposes the UI toggle.
|
|
1091
1089
|
|
|
1092
1090
|
**Dependencies**
|
|
1093
1091
|
|
|
@@ -1095,7 +1093,7 @@ Four themes — `light`, `dark`, `vibrant`, and `system` — are provided via `n
|
|
|
1095
1093
|
|:--|:--|
|
|
1096
1094
|
| Prerequisite Features | None |
|
|
1097
1095
|
| System Dependencies | None |
|
|
1098
|
-
| External Dependencies | `next-themes`
|
|
1096
|
+
| External Dependencies | `next-themes` |
|
|
1099
1097
|
| Integration Requirements | Tailwind CSS `dark:` variants |
|
|
1100
1098
|
|
|
1101
1099
|
#### 2.1.5.2 F-023: CLI Scaffolding Tool (`create-nextblock`)
|
|
@@ -1112,7 +1110,7 @@ Four themes — `light`, `dark`, `vibrant`, and `system` — are provided via `n
|
|
|
1112
1110
|
|
|
1113
1111
|
**Description**
|
|
1114
1112
|
|
|
1115
|
-
The CLI package `apps/create-nextblock`
|
|
1113
|
+
The CLI package `apps/create-nextblock` is published as `create-nextblock` on npm and invoked via `npm create nextblock@latest`. The CLI entry point at `apps/create-nextblock/bin/create-nextblock.js` exposes two commands. The default `create [project-directory]` command prompts for a project name, copies the `templates/nextblock-template` directory, applies client-component/provider adjustments, normalizes editor/UI imports, generates UI proxy modules, rewrites `package.json` to use published packages, writes `.npmrc`, optionally installs dependencies, optionally runs a setup wizard, and initializes git. The `activate [module]` command presently supports only `ecommerce`, installs it via the npm alias `@nextblock-cms/ecommerce@npm:@nextblock-cms/ecom@latest`, and injects route wrappers that call `verifyPackageOnline()` for `/cms/orders`, `/cms/products`, `/cms/payments`, `/checkout/success`, and `/api/checkout`. Package versions are resolved from local workspace `package.json` files.
|
|
1116
1114
|
|
|
1117
1115
|
**Dependencies**
|
|
1118
1116
|
|
|
@@ -1137,7 +1135,7 @@ The CLI package `apps/create-nextblock` (version `0.2.78`) is published as `crea
|
|
|
1137
1135
|
|
|
1138
1136
|
**Description**
|
|
1139
1137
|
|
|
1140
|
-
The SDK library at `libs/sdk`
|
|
1138
|
+
The SDK library at `libs/sdk` provides a typed contract for external block authoring. Main exports from `libs/sdk/src/lib/sdk.ts` include `BlockContentSchema`, `BlockData<TSchema>`, `BlockProps<TSchema>`, `BlockEditorProps<TSchema>`, `BlockConfig<TSchema>`, and `LucideIcon`. A compliant block configuration declares `type`, `label`, optional `icon`, `schema`, `initialContent`, `RendererComponent`, and `EditorComponent`. Renderer props expose `content`, optional `className`, `isInEditor`, and `languageKey`; editor props expose `content`, `block`, and `onChange`. Per `docs/07-BLOCK-SDK-AND-EXTENSIBILITY.md`, the SDK defines the reusable contract, while the built-in CMS implementation resides in `apps/nextblock/lib/blocks/blockRegistry.ts` (F-004).
|
|
1141
1139
|
|
|
1142
1140
|
**Dependencies**
|
|
1143
1141
|
|
|
@@ -1145,7 +1143,7 @@ The SDK library at `libs/sdk` (version `0.2.9`) provides a typed contract for ex
|
|
|
1145
1143
|
|:--|:--|
|
|
1146
1144
|
| Prerequisite Features | None |
|
|
1147
1145
|
| System Dependencies | None |
|
|
1148
|
-
| External Dependencies | `zod
|
|
1146
|
+
| External Dependencies | `zod`, `lucide-react` |
|
|
1149
1147
|
| Integration Requirements | Referenced by F-004 for conformant implementation |
|
|
1150
1148
|
|
|
1151
1149
|
#### 2.1.5.4 F-025: Scheduled Jobs (Cron Endpoints)
|
|
@@ -1237,7 +1235,7 @@ A secure webhook at `apps/nextblock/app/api/revalidate/` validates the shared se
|
|
|
1237
1235
|
|
|
1238
1236
|
**Description**
|
|
1239
1237
|
|
|
1240
|
-
The workspace is an Nx
|
|
1238
|
+
The workspace is an Nx monorepo whose ESLint configuration in `eslint.config.mjs` enables `@nx/enforce-module-boundaries`. Scope tags `scope:public` (applied to `libs/ui`, `libs/utils`, `libs/db`, `libs/editor`, `libs/sdk`) and `scope:premium` (applied to `libs/ecommerce`) differentiate license boundaries. Per `.agent/skills/project-architecture/SKILL.md`, three dependency rules are enforced: (1) `libs/*` may depend on other `libs/*`; (2) `apps/*` may depend on `libs/*`; (3) `libs/ui` MUST NOT depend on `apps/nextblock`. Published library versions are: `@nextblock-cms/ui`, `@nextblock-cms/utils`, `@nextblock-cms/db`, `@nextblock-cms/editor`, `@nextblock-cms/sdk`, and `@nextblock-cms/ecom`.
|
|
1241
1239
|
|
|
1242
1240
|
**Dependencies**
|
|
1243
1241
|
|
|
@@ -1245,7 +1243,7 @@ The workspace is an Nx 22.6.0 monorepo whose ESLint configuration in `eslint.con
|
|
|
1245
1243
|
|:--|:--|
|
|
1246
1244
|
| Prerequisite Features | None |
|
|
1247
1245
|
| System Dependencies | Nx CLI |
|
|
1248
|
-
| External Dependencies | Nx
|
|
1246
|
+
| External Dependencies | Nx, ESLint `@nx/enforce-module-boundaries` plugin |
|
|
1249
1247
|
| Integration Requirements | `nx.json`, individual `project.json` files |
|
|
1250
1248
|
|
|
1251
1249
|
#### 2.1.5.8 F-029: Feedback System
|
|
@@ -1270,7 +1268,7 @@ CMS users can submit feedback through the `FeedbackModal` component in `apps/nex
|
|
|
1270
1268
|
|:--|:--|
|
|
1271
1269
|
| Prerequisite Features | F-002 (Auth) |
|
|
1272
1270
|
| System Dependencies | SMTP transport |
|
|
1273
|
-
| External Dependencies | `nodemailer`
|
|
1271
|
+
| External Dependencies | `nodemailer` |
|
|
1274
1272
|
| Integration Requirements | SMTP env vars |
|
|
1275
1273
|
|
|
1276
1274
|
## 2.2 FUNCTIONAL REQUIREMENTS
|
|
@@ -1595,7 +1593,7 @@ The following matrix links features to the sections of the technical specificati
|
|
|
1595
1593
|
| F-023 | `apps/create-nextblock/bin/create-nextblock.js` | §1.2.1.1(3), §1.2.3.1 | Scaffolding |
|
|
1596
1594
|
| F-024 | `libs/sdk/src/lib/sdk.ts` | §1.2.2.2 | Extensibility contract |
|
|
1597
1595
|
| F-025 | `vercel.json`, cron route handlers | §1.2.3.3 (job health), §1.2.1.3 | Scheduled operations |
|
|
1598
|
-
| F-026 | `.env.
|
|
1596
|
+
| F-026 | `.env.example`, `SandboxBanner` | §1.1.1 (demo credentials) | Evaluator experience |
|
|
1599
1597
|
| F-027 | `app/api/revalidate/` | §1.2.3.3 (caching) | Cache invalidation |
|
|
1600
1598
|
| F-028 | `nx.json`, `.agent/skills/project-architecture/SKILL.md` | §1.2.2.2, §1.2.3.2(1)(2) | Architectural discipline |
|
|
1601
1599
|
| F-029 | `app/actions/feedback.ts`, `FeedbackModal.tsx` | (N/A) | Adopter signal |
|
|
@@ -1673,7 +1671,7 @@ The following matrix links features to the sections of the technical specificati
|
|
|
1673
1671
|
| Library releases | Each of the six libraries is independently versioned and published | F-004, F-005, F-024, F-028 |
|
|
1674
1672
|
| CLI release cadence | `apps/create-nextblock` version must track the template's consumed library versions | F-023 |
|
|
1675
1673
|
| Email templates | Six templates in `libs/db/src/supabase/templates/` must be kept in sync with Supabase Auth flow changes | F-002 |
|
|
1676
|
-
| Environment variable drift | Changes must be reflected in `.env.
|
|
1674
|
+
| Environment variable drift | Changes must be reflected in `.env.example` and `libs/environment.d.ts` `NodeJS.ProcessEnv` augmentation | All env-dependent features |
|
|
1677
1675
|
| CSP allowlist | Must be updated whenever new third-party origins are introduced | F-011 |
|
|
1678
1676
|
| Cron secrets | `CRON_SECRET` rotation requires coordinated env var update | F-025 |
|
|
1679
1677
|
| FX override | `FX_API_BASE_URL` toggle allows switching provider without code change | F-018 |
|
|
@@ -1687,23 +1685,23 @@ The following matrix links features to the sections of the technical specificati
|
|
|
1687
1685
|
|
|
1688
1686
|
| Category | Assumption or Constraint |
|
|
1689
1687
|
|:--|:--|
|
|
1690
|
-
| Deployment Target | Vercel (cron schedules declared in `vercel.json`; `@vercel/speed-insights`
|
|
1688
|
+
| Deployment Target | Vercel (cron schedules declared in `vercel.json`; `@vercel/speed-insights` integrated) |
|
|
1691
1689
|
| Infrastructure | Supabase + Cloudflare R2 + SMTP required for any deployment; Stripe + Freemius + Frankfurter required for premium commerce |
|
|
1692
1690
|
| First-User Rule | Exactly one `ADMIN` guaranteed at bootstrap; subsequent users default to `USER` (per §1.1.3) |
|
|
1693
1691
|
| License Model | Open core under AGPLv3; premium modules source-available and license-gated (per §1.1.1) |
|
|
1694
1692
|
| Version Alignment | Library versions are independent; CLI's generated template is pinned to specific published versions at scaffold time |
|
|
1695
1693
|
| Testability | All requirements in §2.2 are stated as MUST/SHOULD/COULD statements with observable acceptance criteria |
|
|
1696
|
-
| Requirement Versioning | Requirements herein correspond to the workspace state
|
|
1694
|
+
| Requirement Versioning | Requirements herein correspond to the current workspace state (per §1.1.1) |
|
|
1697
1695
|
|
|
1698
1696
|
## 2.5 REFERENCES
|
|
1699
1697
|
|
|
1700
1698
|
### 2.5.1 Files Examined
|
|
1701
1699
|
|
|
1702
1700
|
- `README.md` — Product value proposition, competitive positioning, Lighthouse and CLI claims
|
|
1703
|
-
- `package.json` — Workspace dependency versions (Next.js
|
|
1704
|
-
- `nx.json` — Nx
|
|
1701
|
+
- `package.json` — Workspace dependency versions (Next.js, React, TypeScript, Nx, Tailwind, Tiptap)
|
|
1702
|
+
- `nx.json` — Nx plugin and release configuration
|
|
1705
1703
|
- `vercel.json` — Cron schedule definitions (reset-sandbox 03:00 UTC; sync-currencies 18:00 UTC)
|
|
1706
|
-
- `.env.
|
|
1704
|
+
- `.env.example` — Environment variable reference template
|
|
1707
1705
|
- `eslint.config.mjs` — `@nx/enforce-module-boundaries` scope-tag rules (F-028)
|
|
1708
1706
|
- `apps/nextblock/next.config.js` — Image format/device-size config; CSP; `transpilePackages`
|
|
1709
1707
|
- `apps/nextblock/proxy.ts` — Auth proxy, RBAC gating, locale propagation, security headers, page-type signaling (F-002, F-003, F-007, F-011, F-012)
|
|
@@ -1788,7 +1786,7 @@ The following matrix links features to the sections of the technical specificati
|
|
|
1788
1786
|
|
|
1789
1787
|
# 3. Technology Stack
|
|
1790
1788
|
|
|
1791
|
-
The NextBlock CMS technology stack is a deliberately opinionated, TypeScript-first selection optimized for a Next.js 16 App Router runtime, a Supabase Postgres backend, and a Vercel-native deployment topology. Every technology choice documented below is traceable to a concrete file in the workspace at
|
|
1789
|
+
The NextBlock CMS technology stack is a deliberately opinionated, TypeScript-first selection optimized for a Next.js 16 App Router runtime, a Supabase Postgres backend, and a Vercel-native deployment topology. Every technology choice documented below is traceable to a concrete file in the workspace at `nextblock` version — there is no theoretical dependency in this catalog. The stack departs meaningfully from the default reference stack specified for this project (AWS, Docker, Terraform, GitHub Actions, Python/Flask, MongoDB, Auth0, Langchain, React-Native, Swift, Kotlin, Objective-C, ElectronJS); these deviations are enumerated explicitly in Section 3.7 along with the justifications for each divergence.
|
|
1792
1790
|
|
|
1793
1791
|
The selections align with the critical success factors defined in Section 1.2.3.2 — strict TypeScript compliance, open-core scope-tag discipline via Nx module boundaries, production nonce-based CSP coverage, premium license integrity via the `package_activations` table, the first-user ADMIN trigger guarantee, and role-gated CMS access.
|
|
1794
1792
|
|
|
@@ -1798,7 +1796,7 @@ The selections align with the critical success factors defined in Section 1.2.3.
|
|
|
1798
1796
|
|
|
1799
1797
|
| Language | Version / Dialect | Primary Usage | Evidence |
|
|
1800
1798
|
|:--|:--|:--|:--|
|
|
1801
|
-
| TypeScript |
|
|
1799
|
+
| TypeScript | (strict mode) | Application, library, editor, CLI, tooling source | `package.json`, `tsconfig.base.json` |
|
|
1802
1800
|
| JavaScript | ES2022 / ESM + CommonJS | Configuration files, tooling scripts, CLI entry | `next.config.js`, `tools/scripts/*` |
|
|
1803
1801
|
| SQL (PostgreSQL) | PostgreSQL dialect | Schema migrations, RLS policies, triggers, RPCs | `libs/db/src/supabase/migrations/` |
|
|
1804
1802
|
|
|
@@ -1830,7 +1828,7 @@ TypeScript's strict mode is enumerated as a **Critical Success Factor** in Secti
|
|
|
1830
1828
|
|
|
1831
1829
|
### 3.1.3 JavaScript — Tooling and Configuration
|
|
1832
1830
|
|
|
1833
|
-
JavaScript serves a narrow, well-defined role: configuration files consumed by the Node runtime (e.g., `next.config.js`, `postcss.config.js`, `tailwind.config.js`, `eslint.config.mjs`), the CLI entry point at `apps/create-nextblock/bin/create-nextblock.js` (which uses an ES module shebang to remain Node-native), and release automation scripts under `tools/scripts/` (a mix of `.js`, `.cjs`, `.mjs`, and `.ts` per the consuming execution context). The package manager is pinned via the `packageManager` field in the root `package.json` to `npm
|
|
1831
|
+
JavaScript serves a narrow, well-defined role: configuration files consumed by the Node runtime (e.g., `next.config.js`, `postcss.config.js`, `tailwind.config.js`, `eslint.config.mjs`), the CLI entry point at `apps/create-nextblock/bin/create-nextblock.js` (which uses an ES module shebang to remain Node-native), and release automation scripts under `tools/scripts/` (a mix of `.js`, `.cjs`, `.mjs`, and `.ts` per the consuming execution context). The package manager is pinned via the `packageManager` field in the root `package.json` to `npm`.
|
|
1834
1832
|
|
|
1835
1833
|
### 3.1.4 SQL — PostgreSQL Dialect
|
|
1836
1834
|
|
|
@@ -1840,12 +1838,12 @@ Eleven numbered migration files located in `libs/db/src/supabase/migrations/` (n
|
|
|
1840
1838
|
|
|
1841
1839
|
### 3.2.1 Core Application Framework Stack
|
|
1842
1840
|
|
|
1843
|
-
| Technology |
|
|
1844
|
-
|
|
1845
|
-
| Next.js (App Router) |
|
|
1846
|
-
| React / react-dom |
|
|
1847
|
-
| TypeScript |
|
|
1848
|
-
| Nx |
|
|
1841
|
+
| Technology | Purpose | Evidence |
|
|
1842
|
+
| :-- | :-- | :-- |
|
|
1843
|
+
| Next.js (App Router) | Full-stack React framework with RSC | `package.json` line 138 |
|
|
1844
|
+
| React / react-dom | UI runtime with Server Components | `package.json` lines 146, 149 |
|
|
1845
|
+
| TypeScript | Strict-mode language runtime | `package.json` line 157 |
|
|
1846
|
+
| Nx | Monorepo orchestration, task graph, caching | `package.json`, `nx.json` |
|
|
1849
1847
|
|
|
1850
1848
|
#### 3.2.1.1 Next.js 16 — Justification
|
|
1851
1849
|
|
|
@@ -1859,11 +1857,11 @@ The `transpilePackages` array in `apps/nextblock/next.config.js` lists `@nextblo
|
|
|
1859
1857
|
|
|
1860
1858
|
#### 3.2.1.2 React 19 — Justification
|
|
1861
1859
|
|
|
1862
|
-
React
|
|
1860
|
+
React is required by Next.js 16's App Router and provides Server Components, Server Actions, and the new `use()` hook semantics used by the provider chain composed in `apps/nextblock/app/providers.tsx` (`AuthProvider → LanguageProvider → CurrencyProvider → CurrentContentProvider → CartTranslator → TranslationBridge → TranslationsProvider → ThemeProvider`).
|
|
1863
1861
|
|
|
1864
1862
|
#### 3.2.1.3 Nx 22.6.0 — Justification
|
|
1865
1863
|
|
|
1866
|
-
Nx
|
|
1864
|
+
Nx is selected per the scope constraint in Section 1.3.3.5 ("no alternative monorepo orchestrators beyond Nx"). Its value proposition rests on three invariants enforced at the workspace level:
|
|
1867
1865
|
|
|
1868
1866
|
1. **Module boundary enforcement** via `@nx/enforce-module-boundaries` in `eslint.config.mjs`, which encodes the architectural rule that `libs/ui` MUST NOT depend on `apps/nextblock`.
|
|
1869
1867
|
2. **Scope-tag discipline** partitioning the workspace into `scope:public` libraries (AGPLv3) and `scope:premium` libraries (source-available, license-gated).
|
|
@@ -1873,20 +1871,20 @@ Nx 22.6.0 is selected per the scope constraint in Section 1.3.3.5 ("no alternati
|
|
|
1873
1871
|
|
|
1874
1872
|
The following Nx plugins are registered in `nx.json` and installed as devDependencies in the root `package.json`:
|
|
1875
1873
|
|
|
1876
|
-
| Plugin |
|
|
1877
|
-
|
|
1878
|
-
| `@nx/esbuild` |
|
|
1879
|
-
| `@nx/eslint` + `@nx/eslint-plugin` |
|
|
1880
|
-
| `@nx/js` |
|
|
1881
|
-
| `@nx/key` |
|
|
1882
|
-
| `@nx/next` |
|
|
1883
|
-
| `@nx/node` |
|
|
1884
|
-
| `@nx/powerpack-license` |
|
|
1885
|
-
| `@nx/react` |
|
|
1886
|
-
| `@nx/vite` |
|
|
1887
|
-
| `@nx/vitest` |
|
|
1888
|
-
| `@nx/web` |
|
|
1889
|
-
| `@nx/workspace` |
|
|
1874
|
+
| Plugin | Role |
|
|
1875
|
+
| :-- | :-- |
|
|
1876
|
+
| `@nx/esbuild` | esbuild-based compilation |
|
|
1877
|
+
| `@nx/eslint` + `@nx/eslint-plugin` | Linting integration |
|
|
1878
|
+
| `@nx/js` | TypeScript library builder |
|
|
1879
|
+
| `@nx/key` | Nx Powerpack license key |
|
|
1880
|
+
| `@nx/next` | Next.js app executor |
|
|
1881
|
+
| `@nx/node` | Node application support |
|
|
1882
|
+
| `@nx/powerpack-license` | Powerpack license enforcement |
|
|
1883
|
+
| `@nx/react` | React support |
|
|
1884
|
+
| `@nx/vite` | Vite executor for libraries |
|
|
1885
|
+
| `@nx/vitest` | Vitest test runner integration |
|
|
1886
|
+
| `@nx/web` | Web target support |
|
|
1887
|
+
| `@nx/workspace` | Workspace primitives |
|
|
1890
1888
|
|
|
1891
1889
|
### 3.2.2 Styling and Design System Libraries
|
|
1892
1890
|
|
|
@@ -1894,16 +1892,16 @@ Tailwind CSS 4 is the workspace's sole styling system, layered with Radix UI pri
|
|
|
1894
1892
|
|
|
1895
1893
|
#### 3.2.2.1 Utility CSS and Post-Processing
|
|
1896
1894
|
|
|
1897
|
-
| Library |
|
|
1898
|
-
|
|
1899
|
-
| `tailwindcss` |
|
|
1900
|
-
| `@tailwindcss/postcss` |
|
|
1901
|
-
| `postcss` |
|
|
1902
|
-
| `autoprefixer` |
|
|
1903
|
-
| `tailwindcss-animate` |
|
|
1904
|
-
| `tailwind-merge` |
|
|
1905
|
-
| `clsx` |
|
|
1906
|
-
| `class-variance-authority` |
|
|
1895
|
+
| Library | Purpose |
|
|
1896
|
+
| :-- | :-- |
|
|
1897
|
+
| `tailwindcss` | Utility-first CSS framework |
|
|
1898
|
+
| `@tailwindcss/postcss` | Tailwind 4 PostCSS integration |
|
|
1899
|
+
| `postcss` | CSS transformation pipeline |
|
|
1900
|
+
| `autoprefixer` | Vendor prefix generation |
|
|
1901
|
+
| `tailwindcss-animate` | Pre-built animation utilities |
|
|
1902
|
+
| `tailwind-merge` | Class-name conflict resolution |
|
|
1903
|
+
| `clsx` | Conditional class composition |
|
|
1904
|
+
| `class-variance-authority` | Variant-based styling primitives |
|
|
1907
1905
|
|
|
1908
1906
|
The root `tailwind.config.js` declares `darkMode: ['class']` for next-themes compatibility, content globs spanning `apps/**` and `libs/**`, HSL variable-based theme tokens (`primary`, `secondary`, `accent`, `muted`, `destructive`, `warning`, `popover`, `card`), and keyframe animations for accordion interactions.
|
|
1909
1907
|
|
|
@@ -1911,23 +1909,23 @@ The root `tailwind.config.js` declares `darkMode: ['class']` for next-themes com
|
|
|
1911
1909
|
|
|
1912
1910
|
The `components.json` file at the workspace root registers shadcn/ui with the `slate` base color palette, CSS variables-based theming, React Server Components support, and TSX component format. Twelve `@radix-ui/*` headless primitives supply the underlying accessibility-compliant behavior:
|
|
1913
1911
|
|
|
1914
|
-
| Primitive |
|
|
1915
|
-
|
|
1916
|
-
| `@radix-ui/react-avatar` |
|
|
1917
|
-
| `@radix-ui/react-checkbox` |
|
|
1918
|
-
| `@radix-ui/react-dialog` |
|
|
1919
|
-
| `@radix-ui/react-dropdown-menu` |
|
|
1920
|
-
| `@radix-ui/react-label` |
|
|
1921
|
-
| `@radix-ui/react-popover` |
|
|
1912
|
+
| Primitive | Primitive |
|
|
1913
|
+
| :-- | :-- |
|
|
1914
|
+
| `@radix-ui/react-avatar` | `@radix-ui/react-progress` |
|
|
1915
|
+
| `@radix-ui/react-checkbox` | `@radix-ui/react-radio-group` |
|
|
1916
|
+
| `@radix-ui/react-dialog` | `@radix-ui/react-select` |
|
|
1917
|
+
| `@radix-ui/react-dropdown-menu` | `@radix-ui/react-separator` |
|
|
1918
|
+
| `@radix-ui/react-label` | `@radix-ui/react-slot` |
|
|
1919
|
+
| `@radix-ui/react-popover` | `@radix-ui/react-tooltip` |
|
|
1922
1920
|
|
|
1923
1921
|
#### 3.2.2.3 Iconography and Theming
|
|
1924
1922
|
|
|
1925
|
-
- **lucide-react** —
|
|
1926
|
-
- **next-themes** —
|
|
1923
|
+
- **lucide-react** — used at the workspace level and in the published template package. Provides the typed icon set consumed by `@nextblock-cms/sdk` block configurations (F-024).
|
|
1924
|
+
- **next-themes** — enabling light/dark/vibrant/system theme switching (F-010) via class-based strategy, composed as the outermost provider in `apps/nextblock/app/providers.tsx`.
|
|
1927
1925
|
|
|
1928
1926
|
### 3.2.3 Rich-Text Editor Stack — `libs/editor`
|
|
1929
1927
|
|
|
1930
|
-
The `@nextblock-cms/editor` library
|
|
1928
|
+
The `@nextblock-cms/editor` library bundles Tiptap with more than 40 extensions and the Yjs collaboration stack. This is the substrate that powers the F-005 editor feature documented in Section 2.1.2.3.
|
|
1931
1929
|
|
|
1932
1930
|
#### 3.2.3.1 Tiptap Core and Extensions
|
|
1933
1931
|
|
|
@@ -1938,72 +1936,72 @@ The `@nextblock-cms/editor` library (version `0.2.24`) bundles Tiptap 3.22.4 wit
|
|
|
1938
1936
|
| Block Nodes | bullet-list, ordered-list, list-item, task-item, task-list, heading, code-block-lowlight, details, horizontal-rule, hard-break, table/-cell/-header/-row, image |
|
|
1939
1937
|
| Interactions | bubble-menu, floating-menu, drag-handle, drag-handle-react, focus, placeholder, character-count, dropcursor, gapcursor, emoji, mention, node-range, typography, history, mathematics, youtube |
|
|
1940
1938
|
|
|
1941
|
-
All extensions are pinned
|
|
1939
|
+
All extensions are pinned to (matching the Tiptap core release).
|
|
1942
1940
|
|
|
1943
1941
|
#### 3.2.3.2 Collaboration Layer
|
|
1944
1942
|
|
|
1945
|
-
| Library |
|
|
1946
|
-
|
|
1947
|
-
| `@tiptap/extension-collaboration` |
|
|
1948
|
-
| `@tiptap/y-tiptap` |
|
|
1949
|
-
| `yjs` |
|
|
1950
|
-
| `y-protocols` |
|
|
1943
|
+
| Library | Role |
|
|
1944
|
+
| :-- | :-- |
|
|
1945
|
+
| `@tiptap/extension-collaboration` | Tiptap collaboration plugin |
|
|
1946
|
+
| `@tiptap/y-tiptap` | Tiptap ↔ Yjs bridge |
|
|
1947
|
+
| `yjs` | CRDT backbone |
|
|
1948
|
+
| `y-protocols` | Awareness and sync protocols |
|
|
1951
1949
|
|
|
1952
1950
|
#### 3.2.3.3 Auxiliary Editor Dependencies
|
|
1953
1951
|
|
|
1954
|
-
- **lowlight**
|
|
1955
|
-
- **katex**
|
|
1952
|
+
- **lowlight** — Syntax highlighting engine used by `CodeBlockLowlight`.
|
|
1953
|
+
- **katex** — Mathematical notation rendering for the `@tiptap/extension-mathematics` extension.
|
|
1956
1954
|
|
|
1957
1955
|
### 3.2.4 Forms, Validation, and State Management
|
|
1958
1956
|
|
|
1959
|
-
| Library |
|
|
1960
|
-
|
|
1961
|
-
| `zod` |
|
|
1962
|
-
| `react-hook-form` |
|
|
1963
|
-
| `@hookform/resolvers` |
|
|
1964
|
-
| `zustand` |
|
|
1957
|
+
| Library | Role | Evidence |
|
|
1958
|
+
| :-- | :-- | :-- |
|
|
1959
|
+
| `zod` | Schema validation (block schemas, API validation, form resolvers) | F-004, F-024 |
|
|
1960
|
+
| `react-hook-form` | Form state management | Admin CMS forms |
|
|
1961
|
+
| `@hookform/resolvers` | Zod ↔ react-hook-form adapter | Admin CMS forms |
|
|
1962
|
+
| `zustand` | Client-side cart store (F-015) | `libs/ecommerce/src/lib/cart-store.ts` |
|
|
1965
1963
|
|
|
1966
1964
|
Zod is selected as the universal validation layer because it simultaneously satisfies the typed block-schema contract required by F-024 (`BlockContentSchema`) and provides server-action input validation in line with the "typed block schemas" mitigation for XSS enumerated in Section 2.4.4.
|
|
1967
1965
|
|
|
1968
1966
|
### 3.2.5 Interaction and UI Behavior Libraries
|
|
1969
1967
|
|
|
1970
|
-
| Library |
|
|
1971
|
-
|
|
1972
|
-
| `@dnd-kit/core` |
|
|
1973
|
-
| `@dnd-kit/sortable` |
|
|
1974
|
-
| `@dnd-kit/utilities` |
|
|
1975
|
-
| `@floating-ui/dom` |
|
|
1976
|
-
| `@floating-ui/react` |
|
|
1968
|
+
| Library | Purpose |
|
|
1969
|
+
| :-- | :-- |
|
|
1970
|
+
| `@dnd-kit/core` | Drag-and-drop primitives for block reordering |
|
|
1971
|
+
| `@dnd-kit/sortable` | Sortable list implementation |
|
|
1972
|
+
| `@dnd-kit/utilities` | DnD helpers |
|
|
1973
|
+
| `@floating-ui/dom` | Floating element positioning |
|
|
1974
|
+
| `@floating-ui/react` | React bindings for floating-ui |
|
|
1977
1975
|
|
|
1978
1976
|
### 3.2.6 Media and Performance Libraries
|
|
1979
1977
|
|
|
1980
|
-
| Library |
|
|
1981
|
-
|
|
1982
|
-
| `sharp` |
|
|
1983
|
-
| `plaiceholder` |
|
|
1984
|
-
| `beasties` |
|
|
1985
|
-
| `@next/bundle-analyzer` |
|
|
1986
|
-
| `@next/third-parties` |
|
|
1978
|
+
| Library | Purpose |
|
|
1979
|
+
| :-- | :-- |
|
|
1980
|
+
| `sharp` | AVIF/WebP derivative generation |
|
|
1981
|
+
| `plaiceholder` | Blur placeholder generation |
|
|
1982
|
+
| `beasties` | Critical CSS extraction |
|
|
1983
|
+
| `@next/bundle-analyzer` | Bundle size analysis |
|
|
1984
|
+
| `@next/third-parties` | Optimized third-party script loading (GTM) |
|
|
1987
1985
|
|
|
1988
1986
|
The `sharp` + `plaiceholder` combination underpins F-006 (Media Management) as documented in Section 2.1.2.4.
|
|
1989
1987
|
|
|
1990
1988
|
### 3.2.7 Supporting Libraries
|
|
1991
1989
|
|
|
1992
|
-
| Library |
|
|
1993
|
-
|
|
1994
|
-
| `date-fns` |
|
|
1995
|
-
| `html-react-parser` |
|
|
1996
|
-
| `react-hot-toast` |
|
|
1997
|
-
| `sonner` |
|
|
1998
|
-
| `react-transition-group` |
|
|
1999
|
-
| `react-color` |
|
|
2000
|
-
| `react-colorful` |
|
|
2001
|
-
| `react-day-picker` |
|
|
2002
|
-
| `fast-json-patch` |
|
|
2003
|
-
| `js-cookie` |
|
|
2004
|
-
| `lodash.debounce` |
|
|
2005
|
-
| `uuid` |
|
|
2006
|
-
| `server-only` |
|
|
1990
|
+
| Library | Purpose |
|
|
1991
|
+
| :-- | :-- |
|
|
1992
|
+
| `date-fns` | Date formatting |
|
|
1993
|
+
| `html-react-parser` | HTML-to-React parsing |
|
|
1994
|
+
| `react-hot-toast` | Toast notifications |
|
|
1995
|
+
| `sonner` | Alternative toast notifications |
|
|
1996
|
+
| `react-transition-group` | Transition animations |
|
|
1997
|
+
| `react-color` | Color-picker primitive |
|
|
1998
|
+
| `react-colorful` | Minimal color picker |
|
|
1999
|
+
| `react-day-picker` | Date-picker component |
|
|
2000
|
+
| `fast-json-patch` | JSON Patch generation for F-008 content revisions |
|
|
2001
|
+
| `js-cookie` | Cookie manipulation helper |
|
|
2002
|
+
| `lodash.debounce` | Debounced event handlers |
|
|
2003
|
+
| `uuid` | UUID generation (published template) |
|
|
2004
|
+
| `server-only` | Next.js server-only import guard |
|
|
2007
2005
|
|
|
2008
2006
|
## 3.3 OPEN SOURCE DEPENDENCIES
|
|
2009
2007
|
|
|
@@ -2015,7 +2013,7 @@ All third-party dependencies are resolved from the public npm registry (`registr
|
|
|
2015
2013
|
|
|
2016
2014
|
#### 3.3.1.2 Verdaccio — Local Development Registry
|
|
2017
2015
|
|
|
2018
|
-
The workspace includes a Verdaccio
|
|
2016
|
+
The workspace includes a Verdaccio configuration at `.verdaccio/config.yml` providing a local npm registry for release testing without publishing to the public registry. Key parameters:
|
|
2019
2017
|
|
|
2020
2018
|
| Parameter | Value |
|
|
2021
2019
|
|:--|:--|
|
|
@@ -2026,19 +2024,19 @@ The workspace includes a Verdaccio 6.0.5 configuration at `.verdaccio/config.yml
|
|
|
2026
2024
|
|
|
2027
2025
|
### 3.3.2 Published Workspace Libraries
|
|
2028
2026
|
|
|
2029
|
-
Each library publishes an independent version to the public npm registry. The table below summarizes workspace-source state
|
|
2027
|
+
Each library publishes an independent version to the public npm registry. The table below summarizes workspace-source state:
|
|
2030
2028
|
|
|
2031
|
-
| Package | Workspace Path |
|
|
2032
|
-
|
|
2033
|
-
| `@nextblock-cms/ui` | `libs/ui` | `
|
|
2034
|
-
| `@nextblock-cms/utils` | `libs/utils` | `
|
|
2035
|
-
| `@nextblock-cms/db` | `libs/db` | `
|
|
2036
|
-
| `@nextblock-cms/editor` | `libs/editor` | `
|
|
2037
|
-
| `@nextblock-cms/sdk` | `libs/sdk` | `
|
|
2038
|
-
| `@nextblock-cms/ecom` | `libs/ecommerce` | `
|
|
2039
|
-
| `create-nextblock` | `apps/create-nextblock` | `
|
|
2040
|
-
| `@nextblock-cms/template` | `apps/nextblock` | `
|
|
2041
|
-
|
|
|
2029
|
+
| Package | Workspace Path | Publish Access | Scope Tag |
|
|
2030
|
+
| :-- | :-- | :-- | :-- |
|
|
2031
|
+
| `@nextblock-cms/ui` | `libs/ui` | `public` | `scope:public` |
|
|
2032
|
+
| `@nextblock-cms/utils` | `libs/utils` | `public` | `scope:public` |
|
|
2033
|
+
| `@nextblock-cms/db` | `libs/db` | `public` | `scope:public` |
|
|
2034
|
+
| `@nextblock-cms/editor` | `libs/editor` | `public` | `scope:public` |
|
|
2035
|
+
| `@nextblock-cms/sdk` | `libs/sdk` | `public` | `scope:public` |
|
|
2036
|
+
| `@nextblock-cms/ecom` | `libs/ecommerce` | `public` | `scope:premium` |
|
|
2037
|
+
| `create-nextblock` | `apps/create-nextblock` | `public` | — |
|
|
2038
|
+
| `@nextblock-cms/template` | `apps/nextblock` | `private: true` | — |
|
|
2039
|
+
| `nextblock` | (root) | `private: true` | — |
|
|
2042
2040
|
|
|
2043
2041
|
#### 3.3.2.1 Package Alias Convention for Premium Modules
|
|
2044
2042
|
|
|
@@ -2059,40 +2057,40 @@ The root `package.json` declares four npm overrides to resolve transitive depend
|
|
|
2059
2057
|
|
|
2060
2058
|
The `apps/create-nextblock` scaffolding CLI depends on a focused set of command-line interaction libraries:
|
|
2061
2059
|
|
|
2062
|
-
| Dependency |
|
|
2063
|
-
|
|
2064
|
-
| `@clack/prompts` |
|
|
2065
|
-
| `@nextblock-cms/db` |
|
|
2066
|
-
| `chalk` |
|
|
2067
|
-
| `commander` |
|
|
2068
|
-
| `execa` |
|
|
2069
|
-
| `fs-extra` |
|
|
2070
|
-
| `inquirer` |
|
|
2071
|
-
| `open` |
|
|
2072
|
-
| `ora` |
|
|
2073
|
-
| `picocolors` |
|
|
2060
|
+
| Dependency | Purpose |
|
|
2061
|
+
| :-- | :-- |
|
|
2062
|
+
| `@clack/prompts` | Modern interactive prompts |
|
|
2063
|
+
| `@nextblock-cms/db` | Database schema utilities during scaffold |
|
|
2064
|
+
| `chalk` | Terminal text styling |
|
|
2065
|
+
| `commander` | Command-line argument parsing |
|
|
2066
|
+
| `execa` | Subprocess execution (npm install, git init) |
|
|
2067
|
+
| `fs-extra` | File-system utilities |
|
|
2068
|
+
| `inquirer` | Interactive prompts (legacy path) |
|
|
2069
|
+
| `open` | URL opening in default browser |
|
|
2070
|
+
| `ora` | Terminal spinners |
|
|
2071
|
+
| `picocolors` | Minimal color utility |
|
|
2074
2072
|
|
|
2075
2073
|
### 3.3.5 Type Definitions
|
|
2076
2074
|
|
|
2077
2075
|
The following `@types/*` packages are installed as devDependencies to supply ambient types for untyped or partially-typed dependencies:
|
|
2078
2076
|
|
|
2079
|
-
| Package |
|
|
2080
|
-
|
|
2081
|
-
| `@types/deno` |
|
|
2082
|
-
| `@types/fs-extra` |
|
|
2083
|
-
| `@types/inquirer` |
|
|
2084
|
-
| `@types/js-cookie` |
|
|
2085
|
-
| `@types/lodash.debounce` |
|
|
2086
|
-
| `@types/node` |
|
|
2087
|
-
| `@types/nodemailer` |
|
|
2088
|
-
| `@types/react` |
|
|
2089
|
-
| `@types/react-dom` |
|
|
2090
|
-
| `@types/react-color` |
|
|
2091
|
-
| `@types/react-transition-group` |
|
|
2077
|
+
| Package |
|
|
2078
|
+
| :-- |
|
|
2079
|
+
| `@types/deno` |
|
|
2080
|
+
| `@types/fs-extra` |
|
|
2081
|
+
| `@types/inquirer` |
|
|
2082
|
+
| `@types/js-cookie` |
|
|
2083
|
+
| `@types/lodash.debounce` |
|
|
2084
|
+
| `@types/node` |
|
|
2085
|
+
| `@types/nodemailer` |
|
|
2086
|
+
| `@types/react` |
|
|
2087
|
+
| `@types/react-dom` |
|
|
2088
|
+
| `@types/react-color` |
|
|
2089
|
+
| `@types/react-transition-group` |
|
|
2092
2090
|
|
|
2093
2091
|
## 3.4 THIRD-PARTY SERVICES
|
|
2094
2092
|
|
|
2095
|
-
Every external integration listed below is declared in `libs/environment.d.ts` (augmenting `NodeJS.ProcessEnv`) and documented via the `.env.
|
|
2093
|
+
Every external integration listed below is declared in `libs/environment.d.ts` (augmenting `NodeJS.ProcessEnv`) and documented via the `.env.example` template. The integration set corresponds exactly to the eight integration domains enumerated in Section 1.2.1.3.
|
|
2096
2094
|
|
|
2097
2095
|
```mermaid
|
|
2098
2096
|
graph TB
|
|
@@ -2132,11 +2130,11 @@ graph TB
|
|
|
2132
2130
|
|
|
2133
2131
|
### 3.4.1 Supabase — Database and Authentication
|
|
2134
2132
|
|
|
2135
|
-
| Library |
|
|
2136
|
-
|
|
2137
|
-
| `@supabase/ssr` |
|
|
2138
|
-
| `@supabase/supabase-js` |
|
|
2139
|
-
| `supabase` (CLI) |
|
|
2133
|
+
| Library | Role |
|
|
2134
|
+
| :-- | :-- |
|
|
2135
|
+
| `@supabase/ssr` | SSR-safe cookie-based Supabase client |
|
|
2136
|
+
| `@supabase/supabase-js` | Core Supabase SDK |
|
|
2137
|
+
| `supabase` (CLI) | Migration management, type generation (devDependency) |
|
|
2140
2138
|
|
|
2141
2139
|
#### 3.4.1.1 Responsibilities
|
|
2142
2140
|
|
|
@@ -2155,28 +2153,28 @@ Supabase provides PostgreSQL data storage, Row-Level Security, authentication (F
|
|
|
2155
2153
|
|
|
2156
2154
|
### 3.4.2 Cloudflare R2 — Object Storage
|
|
2157
2155
|
|
|
2158
|
-
| Library |
|
|
2159
|
-
|
|
2160
|
-
| `@aws-sdk/client-s3` |
|
|
2161
|
-
| `@aws-sdk/s3-request-presigner` |
|
|
2156
|
+
| Library | Role |
|
|
2157
|
+
| :-- | :-- |
|
|
2158
|
+
| `@aws-sdk/client-s3` | S3-compatible client |
|
|
2159
|
+
| `@aws-sdk/s3-request-presigner` | Presigned URL generation |
|
|
2162
2160
|
|
|
2163
2161
|
Cloudflare R2 serves as the media object store with an S3-compatible endpoint, per the infrastructure assumption in Section 1.3.3.3. It is accessed via two upload mechanisms: a presigned PUT URL path and a multipart proxy path, both exposed under `apps/nextblock/app/api/upload/`. The required environment variables are `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_S3_ENDPOINT`, `R2_REGION`, `R2_BUCKET_NAME`, `R2_TOKEN_VALUE`, `NEXT_PUBLIC_R2_PUBLIC_URL`, and `NEXT_PUBLIC_R2_BASE_URL`.
|
|
2164
2162
|
|
|
2165
2163
|
### 3.4.3 Stripe — Physical Products Payment
|
|
2166
2164
|
|
|
2167
|
-
| Library |
|
|
2168
|
-
|
|
2169
|
-
| `stripe` |
|
|
2170
|
-
| `@stripe/stripe-js` |
|
|
2165
|
+
| Library | Role |
|
|
2166
|
+
| :-- | :-- |
|
|
2167
|
+
| `stripe` | Server-side Stripe SDK |
|
|
2168
|
+
| `@stripe/stripe-js` | Client-side Stripe.js loader |
|
|
2171
2169
|
|
|
2172
2170
|
Stripe handles all physical-product checkout flows (F-016) including Stripe Tax integration for automatic tax calculation (F-020). Webhook processing at `apps/nextblock/app/api/webhooks/stripe/route.ts` validates signatures using `STRIPE_WEBHOOK_SECRET` per the security mitigation declared in Section 2.4.4. A development helper script (`npm run stripe`) invokes `stripe listen --forward-to localhost:4200/api/webhooks/stripe` to forward webhook events during local development.
|
|
2173
2171
|
|
|
2174
2172
|
### 3.4.4 Freemius — Digital Products and Licensing
|
|
2175
2173
|
|
|
2176
|
-
| Library |
|
|
2177
|
-
|
|
2178
|
-
| `@freemius/checkout` |
|
|
2179
|
-
| `@freemius/sdk` |
|
|
2174
|
+
| Library | Role |
|
|
2175
|
+
| :-- | :-- |
|
|
2176
|
+
| `@freemius/checkout` | Checkout widget |
|
|
2177
|
+
| `@freemius/sdk` | Freemius SDK for server operations |
|
|
2180
2178
|
|
|
2181
2179
|
Freemius handles digital-product checkout and licensing (F-017) including the premium license-gating surface that enables F-022. Webhook verification uses HMAC SHA-256 signature validation via `FREEMIUS_SECRET_KEY`. Per the known-issue enumeration in Section 1.3.3.1, webhook events are currently acknowledged but not yet reconciled back to the local database state. The Freemius environment variable surface is comparatively broad — `FREEMIUS_STORE_ID`, `FREEMIUS_PRODUCT_ID`, `FREEMIUS_PUBLIC_KEY`, `FREEMIUS_SECRET_KEY`, `FREEMIUS_API_KEY`, `FREEMIUS_CHECKOUT_PRODUCTS_JSON`, `FREEMIUS_ECOMMERCE_SANDBOX_PUBLIC_KEY`, `FREEMIUS_ECOMMERCE_SANDBOX_SECRET_KEY`, `FREEMIUS_SANDBOX_ENABLED`, `FREEMIUS_DEVELOPER_ID`, `FREEMIUS_ECOMMERCE_SANDBOX_KEY` — reflecting the mixture of store-scoped and product-scoped identifiers plus sandbox-aware duplication.
|
|
2182
2180
|
|
|
@@ -2186,18 +2184,18 @@ The `https://api.frankfurter.dev` public endpoint supplies daily FX rates for th
|
|
|
2186
2184
|
|
|
2187
2185
|
### 3.4.6 SMTP — Transactional Email
|
|
2188
2186
|
|
|
2189
|
-
| Library |
|
|
2190
|
-
|
|
2191
|
-
| `nodemailer` |
|
|
2187
|
+
| Library | Role |
|
|
2188
|
+
| :-- | :-- |
|
|
2189
|
+
| `nodemailer` | SMTP client for transactional email |
|
|
2192
2190
|
|
|
2193
2191
|
SMTP is used both by Supabase Auth (via the templates in `libs/db/src/supabase/templates/`) and directly by the CMS feedback feature (F-029). Environment variables: `SMTP_HOST`, `SMTP_PORT`, `SMTP_USER`, `SMTP_PASS`, `SMTP_FROM_EMAIL`, `SMTP_FROM_NAME`, `SUPABASE_AUTH_RATE_LIMIT_EMAIL_SENT`.
|
|
2194
2192
|
|
|
2195
2193
|
### 3.4.7 Vercel — Hosting Platform and Observability
|
|
2196
2194
|
|
|
2197
|
-
| Library |
|
|
2198
|
-
|
|
2199
|
-
| `@vercel/speed-insights` |
|
|
2200
|
-
| `@vercel/analytics` |
|
|
2195
|
+
| Library | Role |
|
|
2196
|
+
| :-- | :-- |
|
|
2197
|
+
| `@vercel/speed-insights` | RUM performance telemetry |
|
|
2198
|
+
| `@vercel/analytics` | Page-view analytics (published template) |
|
|
2201
2199
|
|
|
2202
2200
|
#### 3.4.7.1 Cron Job Declarations
|
|
2203
2201
|
|
|
@@ -2212,7 +2210,7 @@ Both endpoints enforce `Authorization: Bearer ${CRON_SECRET}` per the security m
|
|
|
2212
2210
|
|
|
2213
2211
|
### 3.4.8 Google Tag Manager — Analytics Delivery
|
|
2214
2212
|
|
|
2215
|
-
Google Tag Manager is loaded via `@next/third-parties`
|
|
2213
|
+
Google Tag Manager is loaded via `@next/third-parties` using the GTM container id configured in the CMS at **Settings → Privacy** and stored in the `site_settings` table (`privacy_settings.gtm_id`); there is no `NEXT_PUBLIC_GTM_ID` environment variable. The id is read in the root layout via `getPrivacySettings()` and passed through the consent gate, so the tag loads only after the visitor accepts analytics. The production CSP allowlist emitted by `apps/nextblock/proxy.ts` explicitly includes `googletagmanager.com`, `google-analytics.com`, and `analytics.google.com` per F-011's origin allowlist.
|
|
2216
2214
|
|
|
2217
2215
|
## 3.5 DATABASES AND STORAGE
|
|
2218
2216
|
|
|
@@ -2283,22 +2281,22 @@ The Next.js image optimizer is configured in `apps/nextblock/next.config.js` wit
|
|
|
2283
2281
|
|
|
2284
2282
|
#### 3.6.1.1 Linting and Code Quality
|
|
2285
2283
|
|
|
2286
|
-
| Tool |
|
|
2287
|
-
|
|
2288
|
-
| `eslint` |
|
|
2289
|
-
| `typescript-eslint` |
|
|
2290
|
-
| `@typescript-eslint/eslint-plugin` |
|
|
2291
|
-
| `@typescript-eslint/parser` |
|
|
2292
|
-
| `eslint-config-next` |
|
|
2293
|
-
| `eslint-config-prettier` |
|
|
2294
|
-
| `eslint-plugin-import` |
|
|
2295
|
-
| `eslint-plugin-jsx-a11y` |
|
|
2296
|
-
| `eslint-plugin-react` |
|
|
2297
|
-
| `eslint-plugin-react-hooks` |
|
|
2298
|
-
| `@next/eslint-plugin-next` |
|
|
2299
|
-
| `eslint-import-resolver-typescript` |
|
|
2300
|
-
| `jsonc-eslint-parser` |
|
|
2301
|
-
| `prettier` |
|
|
2284
|
+
| Tool | Role |
|
|
2285
|
+
| :-- | :-- |
|
|
2286
|
+
| `eslint` | Flat-config linter |
|
|
2287
|
+
| `typescript-eslint` | TypeScript parser + plugin meta-package |
|
|
2288
|
+
| `@typescript-eslint/eslint-plugin` | TypeScript lint rules |
|
|
2289
|
+
| `@typescript-eslint/parser` | TypeScript ESLint parser |
|
|
2290
|
+
| `eslint-config-next` | Next.js ESLint preset |
|
|
2291
|
+
| `eslint-config-prettier` | Prettier compatibility |
|
|
2292
|
+
| `eslint-plugin-import` | Import sort/group rules |
|
|
2293
|
+
| `eslint-plugin-jsx-a11y` | Accessibility rules |
|
|
2294
|
+
| `eslint-plugin-react` | React rules |
|
|
2295
|
+
| `eslint-plugin-react-hooks` | React Hooks rules |
|
|
2296
|
+
| `@next/eslint-plugin-next` | Next.js core-web-vitals rules |
|
|
2297
|
+
| `eslint-import-resolver-typescript` | TS path resolution |
|
|
2298
|
+
| `jsonc-eslint-parser` | JSONC parsing support |
|
|
2299
|
+
| `prettier` | Code formatter |
|
|
2302
2300
|
|
|
2303
2301
|
#### 3.6.1.2 Nx Module Boundary Rules
|
|
2304
2302
|
|
|
@@ -2314,12 +2312,12 @@ The workspace operates a dual build strategy: Next.js's native build pipeline fo
|
|
|
2314
2312
|
|
|
2315
2313
|
#### 3.6.2.1 Library Bundling — Vite
|
|
2316
2314
|
|
|
2317
|
-
| Tool |
|
|
2318
|
-
|
|
2319
|
-
| `vite` |
|
|
2320
|
-
| `vite-plugin-dts` |
|
|
2321
|
-
| `@vitejs/plugin-react` |
|
|
2322
|
-
| `vite-tsconfig-paths` |
|
|
2315
|
+
| Tool | Role |
|
|
2316
|
+
| :-- | :-- |
|
|
2317
|
+
| `vite` | Library bundler |
|
|
2318
|
+
| `vite-plugin-dts` | TypeScript declaration emission |
|
|
2319
|
+
| `@vitejs/plugin-react` | React/JSX transformation |
|
|
2320
|
+
| `vite-tsconfig-paths` | TypeScript path alias resolution |
|
|
2323
2321
|
|
|
2324
2322
|
Libraries `libs/ui`, `libs/db`, `libs/editor`, `libs/sdk`, and `libs/utils` are bundled via Vite. Each library's `vite.config.ts` imposes package-specific concerns — `libs/ui` patches client directives, `libs/utils` separates client/server entries, and `libs/db` appends a `copy-db-supabase.cjs` post-step to propagate migration assets.
|
|
2325
2323
|
|
|
@@ -2329,27 +2327,27 @@ The `libs/ecommerce` premium library uses the `@nx/js:tsc` executor to produce o
|
|
|
2329
2327
|
|
|
2330
2328
|
#### 3.6.2.3 Transpilation and Runtime Compilation
|
|
2331
2329
|
|
|
2332
|
-
| Tool |
|
|
2333
|
-
|
|
2334
|
-
| `esbuild` |
|
|
2335
|
-
| `@swc-node/register` |
|
|
2336
|
-
| `@swc/cli` |
|
|
2337
|
-
| `@swc/core` |
|
|
2338
|
-
| `@swc/helpers` |
|
|
2339
|
-
| `@swc/wasm` |
|
|
2340
|
-
| `@babel/core` |
|
|
2341
|
-
| `@babel/preset-react` |
|
|
2342
|
-
| `ts-node` |
|
|
2343
|
-
| `tsx` |
|
|
2344
|
-
| `jiti` |
|
|
2330
|
+
| Tool | Role |
|
|
2331
|
+
| :-- | :-- |
|
|
2332
|
+
| `esbuild` | Fast bundler used by Nx |
|
|
2333
|
+
| `@swc-node/register` | SWC-based Node register |
|
|
2334
|
+
| `@swc/cli` | SWC CLI |
|
|
2335
|
+
| `@swc/core` | SWC compiler core |
|
|
2336
|
+
| `@swc/helpers` | SWC runtime helpers |
|
|
2337
|
+
| `@swc/wasm` | SWC WASM build |
|
|
2338
|
+
| `@babel/core` | Babel core |
|
|
2339
|
+
| `@babel/preset-react` | Babel React preset |
|
|
2340
|
+
| `ts-node` | TypeScript execution |
|
|
2341
|
+
| `tsx` | TypeScript execute for scripts |
|
|
2342
|
+
| `jiti` | Runtime TypeScript loader |
|
|
2345
2343
|
|
|
2346
2344
|
#### 3.6.2.4 Environment Variable Tooling
|
|
2347
2345
|
|
|
2348
|
-
| Tool |
|
|
2349
|
-
|
|
2350
|
-
| `dotenv` |
|
|
2351
|
-
| `dotenv-cli` |
|
|
2352
|
-
| `cross-env` |
|
|
2346
|
+
| Tool | Role |
|
|
2347
|
+
| :-- | :-- |
|
|
2348
|
+
| `dotenv` | `.env` file loader |
|
|
2349
|
+
| `dotenv-cli` | CLI wrapper for dotenv |
|
|
2350
|
+
| `cross-env` | Cross-platform env-var setter |
|
|
2353
2351
|
|
|
2354
2352
|
#### 3.6.2.5 Key Build Targets
|
|
2355
2353
|
|
|
@@ -2363,13 +2361,13 @@ The `libs/ecommerce` premium library uses the `@nx/js:tsc` executor to produce o
|
|
|
2363
2361
|
|
|
2364
2362
|
### 3.6.3 Testing
|
|
2365
2363
|
|
|
2366
|
-
| Tool |
|
|
2367
|
-
|
|
2368
|
-
| `vitest` |
|
|
2369
|
-
| `@vitest/ui` |
|
|
2370
|
-
| `jsdom` |
|
|
2371
|
-
| `ajv` |
|
|
2372
|
-
| `baseline-browser-mapping` |
|
|
2364
|
+
| Tool | Role |
|
|
2365
|
+
| :-- | :-- |
|
|
2366
|
+
| `vitest` | Unit test runner |
|
|
2367
|
+
| `@vitest/ui` | Vitest web UI |
|
|
2368
|
+
| `jsdom` | Browser environment shim |
|
|
2369
|
+
| `ajv` | JSON schema validation |
|
|
2370
|
+
| `baseline-browser-mapping` | Browser compatibility data |
|
|
2373
2371
|
|
|
2374
2372
|
The Vitest configuration is integrated via `@nx/vitest` with `testTargetName: "test"`. The `libs/utils/tests/` directory contains Vitest coverage for translation-workspace helpers.
|
|
2375
2373
|
|
|
@@ -2398,7 +2396,7 @@ The workspace does **not** use Terraform. Infrastructure configuration is declar
|
|
|
2398
2396
|
| `vercel.json` | Cron schedules |
|
|
2399
2397
|
| `libs/db/src/supabase/migrations/` | Database schema (ordered append-only migration files) |
|
|
2400
2398
|
| `libs/db/src/supabase/config.toml` | Supabase local development configuration |
|
|
2401
|
-
| `.env.
|
|
2399
|
+
| `.env.example` | Environment variable template |
|
|
2402
2400
|
| `nx.json` + per-project `project.json` | Workspace orchestration topology |
|
|
2403
2401
|
|
|
2404
2402
|
### 3.6.7 Workspace Automation Scripts
|
|
@@ -2444,7 +2442,7 @@ The Default Technology Stack specified for this project included assumptions tha
|
|
|
2444
2442
|
|
|
2445
2443
|
The stack substitutions collectively preserve the four cross-cutting architectural invariants articulated in Section 1.2.3.2:
|
|
2446
2444
|
|
|
2447
|
-
1. **Open-core boundary enforcement** — Nx
|
|
2445
|
+
1. **Open-core boundary enforcement** — Nx + ESLint's `@nx/enforce-module-boundaries` plugin implement the invariant. No equivalent exists in a Python/Flask monorepo.
|
|
2448
2446
|
2. **Scope tag discipline** — Nx scope tags (`scope:public`, `scope:premium`) are project-local metadata that cannot be expressed in the Default Stack's toolchain.
|
|
2449
2447
|
3. **Security header coverage** — The `proxy.ts` pattern requires a Node/Edge runtime with access to the Next.js response pipeline, unattainable with a Python web server.
|
|
2450
2448
|
4. **License activation integrity** — `verifyPackageOnline()` leans on Next.js's `unstable_cache` for its 60-second memoization window.
|
|
@@ -2529,21 +2527,21 @@ The premium `libs/ecommerce` is guarded at runtime by the `verifyPackageOnline('
|
|
|
2529
2527
|
- `eslint.config.mjs` — Flat ESLint configuration with `@nx/enforce-module-boundaries` rules
|
|
2530
2528
|
- `components.json` — shadcn/ui configuration (slate base, CSS variables, RSC, TSX)
|
|
2531
2529
|
- `project.json` — Root Nx project with Verdaccio `local-registry` target
|
|
2532
|
-
- `.env.
|
|
2530
|
+
- `.env.example` — Environment variable reference template
|
|
2533
2531
|
- `.verdaccio/config.yml` — Local npm registry configuration (port 4873)
|
|
2534
|
-
- `apps/nextblock/package.json` — `@nextblock-cms/template`
|
|
2532
|
+
- `apps/nextblock/package.json` — `@nextblock-cms/template` dependencies
|
|
2535
2533
|
- `apps/nextblock/next.config.js` — Image optimization, CSP, `transpilePackages`, Turbopack
|
|
2536
2534
|
- `apps/nextblock/proxy.ts` — Session sync, RBAC, locale, security headers, CSP
|
|
2537
2535
|
- `apps/nextblock/tsconfig.json` — App-level TypeScript configuration (ES2017 target, bundler resolution)
|
|
2538
2536
|
- `apps/nextblock/eslint.config.mjs` — App ESLint with Next.js Core Web Vitals
|
|
2539
|
-
- `apps/create-nextblock/package.json` — CLI package
|
|
2537
|
+
- `apps/create-nextblock/package.json` — CLI package dependencies
|
|
2540
2538
|
- `apps/create-nextblock/bin/create-nextblock.js` — CLI entry point (ES module shebang)
|
|
2541
|
-
- `libs/db/package.json` — `@nextblock-cms/db`
|
|
2542
|
-
- `libs/ui/package.json` — `@nextblock-cms/ui`
|
|
2543
|
-
- `libs/editor/package.json` — `@nextblock-cms/editor`
|
|
2544
|
-
- `libs/ecommerce/package.json` — `@nextblock-cms/ecom`
|
|
2545
|
-
- `libs/utils/package.json` — `@nextblock-cms/utils`
|
|
2546
|
-
- `libs/sdk/package.json` — `@nextblock-cms/sdk`
|
|
2539
|
+
- `libs/db/package.json` — `@nextblock-cms/db`
|
|
2540
|
+
- `libs/ui/package.json` — `@nextblock-cms/ui` with exports map
|
|
2541
|
+
- `libs/editor/package.json` — `@nextblock-cms/editor` with Tiptap + Yjs dependencies
|
|
2542
|
+
- `libs/ecommerce/package.json` — `@nextblock-cms/ecom` with `scope:premium` Nx tag
|
|
2543
|
+
- `libs/utils/package.json` — `@nextblock-cms/utils`
|
|
2544
|
+
- `libs/sdk/package.json` — `@nextblock-cms/sdk`
|
|
2547
2545
|
- `libs/environment.d.ts` — `NodeJS.ProcessEnv` augmentation for all environment variables
|
|
2548
2546
|
- `libs/db/src/lib/package-validation.ts` — `verifyPackageOnline` with 60-second `unstable_cache`
|
|
2549
2547
|
- `libs/db/vite.config.ts` — Vite library build + `copy-db-supabase.cjs` post-step
|
|
@@ -2701,7 +2699,7 @@ flowchart LR
|
|
|
2701
2699
|
|
|
2702
2700
|
### 4.2.2 Authentication Workflows
|
|
2703
2701
|
|
|
2704
|
-
Authentication (F-002) is layered over Supabase Auth via `@supabase/ssr
|
|
2702
|
+
Authentication (F-002) is layered over Supabase Auth via `@supabase/ssr`. Server actions in `apps/nextblock/app/actions.ts` orchestrate email/password sign-up, sign-in, and password-reset flows, while `app/auth/callback/route.ts` handles OAuth authorization-code exchange.
|
|
2705
2703
|
|
|
2706
2704
|
#### 4.2.2.1 Sign-Up Flow
|
|
2707
2705
|
|
|
@@ -4043,7 +4041,7 @@ NextBlock CMS is architected as an **Nx-orchestrated monorepo** that composes a
|
|
|
4043
4041
|
|
|
4044
4042
|
#### 5.1.1.1 Architectural Principles
|
|
4045
4043
|
|
|
4046
|
-
- **Server-Components-First Rendering.** The application is built on the React Server Components model introduced by the Next.js App Router. The system uses Next.js (App Router)
|
|
4044
|
+
- **Server-Components-First Rendering.** The application is built on the React Server Components model introduced by the Next.js App Router. The system uses Next.js (App Router) as its application framework, React / react-dom as its UI runtime, and TypeScript under strict mode as the implementation language. Public layouts such as `apps/nextblock/app/layout.tsx` fetch cached data through `unstable_cache` and render on the server, while client islands (cart, editors, switchers) hydrate inside the provider chain declared in `apps/nextblock/app/providers.tsx`.
|
|
4047
4045
|
|
|
4048
4046
|
- **Open-Core Boundary Enforcement.** The workspace is partitioned into two dependency tiers via Nx scope tags. All foundational libraries (`libs/ui`, `libs/utils`, `libs/db`, `libs/editor`, `libs/sdk`) are tagged `scope:public` and published under AGPLv3, while `libs/ecommerce` is tagged `scope:premium` and activated through a license-key-gated installation path (`@nextblock-cms/ecommerce@npm:@nextblock-cms/ecom@latest`). The rule that `libs/ui` MUST NOT depend on `apps/nextblock` is enforced via ESLint's `@nx/enforce-module-boundaries` plugin, as documented in `.agent/skills/project-architecture/SKILL.md`, and every Nx project declares a `scope:public` or `scope:premium` tag, enabling dependency-direction enforcement between open and premium tiers.
|
|
4049
4047
|
|
|
@@ -4055,7 +4053,7 @@ NextBlock CMS is architected as an **Nx-orchestrated monorepo** that composes a
|
|
|
4055
4053
|
|
|
4056
4054
|
#### 5.1.1.2 System Boundaries and Major Interfaces
|
|
4057
4055
|
|
|
4058
|
-
The trust boundary runs between the Next.js application and its eight external service integrations. The external service landscape is composed of Supabase (`@supabase/ssr
|
|
4056
|
+
The trust boundary runs between the Next.js application and its eight external service integrations. The external service landscape is composed of Supabase (`@supabase/ssr`, `@supabase/supabase-js`) for Postgres storage, Row-Level Security, and Auth; Cloudflare R2 (S3-compatible via `@aws-sdk/client-s3`) for media assets and presigned uploads; Stripe (`stripe`, `@stripe/stripe-js`) for Checkout, payments, and Stripe Tax; Freemius (`@freemius/checkout`, `@freemius/sdk`) for digital-product checkout and licensing; `api.frankfurter.dev` (configurable via `FX_API_BASE_URL`) for multi-currency rate synchronization; `@vercel/speed-insights` and `@next/third-parties` (GTM) for performance and behavior tracking; Vercel for edge delivery and scheduled jobs defined in `vercel.json`; and SMTP (env-configured) for transactional email.
|
|
4059
4057
|
|
|
4060
4058
|
Major interfaces are exposed at six Next.js route surfaces:
|
|
4061
4059
|
|
|
@@ -4127,14 +4125,14 @@ The workspace decomposes into eight first-class components (two applications and
|
|
|
4127
4125
|
|
|
4128
4126
|
| Component Name | Primary Responsibility | Key Dependencies |
|
|
4129
4127
|
|---|---|---|
|
|
4130
|
-
| `apps/nextblock` (`@nextblock-cms/template`,
|
|
4131
|
-
| `apps/create-nextblock` (`create-nextblock`,
|
|
4132
|
-
| `libs/db` (`@nextblock-cms/db`,
|
|
4133
|
-
| `libs/ui` (`@nextblock-cms/ui`,
|
|
4134
|
-
| `libs/editor` (`@nextblock-cms/editor`,
|
|
4135
|
-
| `libs/sdk` (`@nextblock-cms/sdk`,
|
|
4136
|
-
| `libs/utils` (`@nextblock-cms/utils`,
|
|
4137
|
-
| `libs/ecommerce` (`@nextblock-cms/ecom`,
|
|
4128
|
+
| `apps/nextblock` (`@nextblock-cms/template`,) | Public site, CMS admin, checkout, API/cron/webhooks, proxy | All six libraries + Supabase, R2, Stripe, Freemius |
|
|
4129
|
+
| `apps/create-nextblock` (`create-nextblock`,) | CLI scaffolder (`create`, `activate`) | `@clack/prompts`, `commander`, `execa`, `fs-extra` |
|
|
4130
|
+
| `libs/db` (`@nextblock-cms/db`,) | Supabase clients, migrations, package-activation gate, media actions | `@supabase/ssr`, `@supabase/supabase-js`, `postgres` |
|
|
4131
|
+
| `libs/ui` (`@nextblock-cms/ui`,) | Shared design system, Radix primitives, Tailwind config, styles | Radix UI, `tailwindcss`, `lucide-react` |
|
|
4132
|
+
| `libs/editor` (`@nextblock-cms/editor`,) | Tiptap rich-text editor, slash menu, block widgets | Tiptap 3.x, Yjs, lowlight, katex |
|
|
4133
|
+
| `libs/sdk` (`@nextblock-cms/sdk`,) | Block registration contract (schemas, props) | `zod`, peer: React |
|
|
4134
|
+
| `libs/utils` (`@nextblock-cms/utils`,) | Client/server helpers, email, R2 client, translations | `nodemailer`, `@aws-sdk/client-s3` |
|
|
4135
|
+
| `libs/ecommerce` (`@nextblock-cms/ecom`,) | Catalog, cart, checkout, payments, shipping, tax, orders | Stripe, Freemius, Zustand, `@nextblock-cms/db` |
|
|
4138
4136
|
|
|
4139
4137
|
#### 5.1.2.2 Components: Integration Points and Considerations
|
|
4140
4138
|
|
|
@@ -4171,7 +4169,7 @@ The authoritative store is **Supabase Postgres**, governed by 11 SQL migrations
|
|
|
4171
4169
|
|
|
4172
4170
|
### 5.1.4 External Integration Points
|
|
4173
4171
|
|
|
4174
|
-
The integration landscape comprises eight external domains declared in `libs/environment.d.ts` and `.env.
|
|
4172
|
+
The integration landscape comprises eight external domains declared in `libs/environment.d.ts` and `.env.example`:
|
|
4175
4173
|
|
|
4176
4174
|
#### 5.1.4.1 Integration Types and Exchange Patterns
|
|
4177
4175
|
|
|
@@ -4207,7 +4205,7 @@ The integration landscape comprises eight external domains declared in `libs/env
|
|
|
4207
4205
|
|
|
4208
4206
|
The primary Next.js application is the sole runtime surface; it hosts the public website, the CMS admin, the customer storefront, and all API/webhook/cron/upload handlers. It is the only component that owns `proxy.ts`, `next.config.js`, and `app/providers.tsx`.
|
|
4209
4207
|
|
|
4210
|
-
The application stack comprises Next.js App Router
|
|
4208
|
+
The application stack comprises Next.js App Router, React, TypeScript in strict mode, Tailwind CSS with 12+ Radix UI primitives, lucide-react for icons, next-themes for theme management with light/dark/vibrant/system variants, Tiptap for rich text, Zustand for client state, Zod for schemas, react-hook-form for forms, @hookform/resolvers, sharp for image processing, plaiceholder for blur placeholders, beasties for critical CSS, @next/bundle-analyzer, Vitest for unit tests, and Verdaccio as a local registry.
|
|
4211
4209
|
|
|
4212
4210
|
#### 5.2.1.2 Key Interfaces and APIs
|
|
4213
4211
|
|
|
@@ -4302,7 +4300,7 @@ The premium `libs/ecommerce` is guarded at runtime by `verifyPackageOnline('ecom
|
|
|
4302
4300
|
|
|
4303
4301
|
#### 5.2.4.1 Purpose and Technologies
|
|
4304
4302
|
|
|
4305
|
-
Encapsulates the entire commerce domain: catalog rendering, cart persistence, checkout orchestration, payment provider routing, currency conversion, shipping zone resolution, tax calculation, order sync, and invoice synthesis. Technologies include Stripe
|
|
4303
|
+
Encapsulates the entire commerce domain: catalog rendering, cart persistence, checkout orchestration, payment provider routing, currency conversion, shipping zone resolution, tax calculation, order sync, and invoice synthesis. Technologies include Stripe and @stripe/stripe-js for physical-product checkout, @freemius/checkout and @freemius/sdk for digital-product checkout and licensing, and Zustand for the cart store with persist middleware.
|
|
4306
4304
|
|
|
4307
4305
|
#### 5.2.4.2 Key Interfaces and Provider Routing
|
|
4308
4306
|
|
|
@@ -4336,7 +4334,7 @@ Commerce tables live in migrations `003_catalog_and_licensing` (products, varian
|
|
|
4336
4334
|
|
|
4337
4335
|
#### 5.2.5.1 Purpose and Technologies
|
|
4338
4336
|
|
|
4339
|
-
Exports a Tiptap-based rich text editor with a slash menu, draggable nodes, inline widgets, image picker bridging, and HTML-preserving behavior suitable for the in-app block registry. Technologies: Tiptap
|
|
4337
|
+
Exports a Tiptap-based rich text editor with a slash menu, draggable nodes, inline widgets, image picker bridging, and HTML-preserving behavior suitable for the in-app block registry. Technologies: Tiptap with 40+ extensions, Yjs with y-protocols and y-tiptap for collaboration, lowlight for syntax highlighting, and katex for mathematical typesetting.
|
|
4340
4338
|
|
|
4341
4339
|
#### 5.2.5.2 Interfaces
|
|
4342
4340
|
|
|
@@ -4498,11 +4496,11 @@ stateDiagram-v2
|
|
|
4498
4496
|
|
|
4499
4497
|
### 5.3.1 Architecture Style Decisions and Tradeoffs
|
|
4500
4498
|
|
|
4501
|
-
The Nx monorepo orchestrator
|
|
4499
|
+
The Nx monorepo orchestrator supports atomic commits across apps and libraries.
|
|
4502
4500
|
|
|
4503
4501
|
| Decision | Choice | Rationale |
|
|
4504
4502
|
|---|---|---|
|
|
4505
|
-
| Monorepo vs. polyrepo | Nx monorepo
|
|
4503
|
+
| Monorepo vs. polyrepo | Nx monorepo | Atomic commits across apps and libs; single lint/test config |
|
|
4506
4504
|
| Rendering model | React Server Components + App Router | Minimal client JS; server-side data fetching; caching primitives |
|
|
4507
4505
|
| Middleware form | `proxy.ts` (explicit) | Single chokepoint for auth, RBAC, locale, CSP, page-type |
|
|
4508
4506
|
| Premium distribution | Scope tag + license gate | Open core without exposing premium source |
|
|
@@ -4536,8 +4534,8 @@ Each pattern was selected to match the operational constraints of its surface: V
|
|
|
4536
4534
|
| Concern | Choice | Reasoning |
|
|
4537
4535
|
|---|---|---|
|
|
4538
4536
|
| Primary OLTP | Supabase Postgres | Native RLS, auth, storage; SQL power; matches TypeScript types via codegen |
|
|
4539
|
-
| Object Storage | Cloudflare R2 | Egress-free; S3 API compatibility via `@aws-sdk/client-s3`
|
|
4540
|
-
| Browser-local State | Zustand
|
|
4537
|
+
| Object Storage | Cloudflare R2 | Egress-free; S3 API compatibility via `@aws-sdk/client-s3` |
|
|
4538
|
+
| Browser-local State | Zustand + persist | Minimal client JS; first-class TypeScript |
|
|
4541
4539
|
| Server-side cache | `unstable_cache` (Next.js Data Cache) | Tag-based invalidation; 60s TTL on hot paths |
|
|
4542
4540
|
|
|
4543
4541
|
**Why not MongoDB or Prisma?** The tech stack deviations in Section 3.7 note that MongoDB, Langchain, and the Default Stack's container/Terraform/GitHub Actions tooling are not used. The decision to use Postgres was reinforced by the need for strict relational constraints (CHECK constraints on `products.type`/`provider`, `tax_rates` ranges, single-default currency enforcement) and RLS policies, both of which are idiomatic in Postgres.
|
|
@@ -4629,7 +4627,7 @@ RPC is the primary code path; a direct-`postgres` SQL fallback activates when th
|
|
|
4629
4627
|
|
|
4630
4628
|
### 5.4.1 Monitoring and Observability Approach
|
|
4631
4629
|
|
|
4632
|
-
Observability instrumentation includes @vercel/speed-insights
|
|
4630
|
+
Observability instrumentation includes @vercel/speed-insights for performance metrics and @next/third-parties (GTM) for client-side analytics. Server-side observability is achieved via structured `console.log`/`console.error` (with `compiler.removeConsole` stripping debug logs in production), `/api/revalidate-log` for best-effort revalidation telemetry, and the Speed Insights dashboard.
|
|
4633
4631
|
|
|
4634
4632
|
#### 5.4.1.1 Key Performance Indicators Tracked
|
|
4635
4633
|
|
|
@@ -5048,16 +5046,16 @@ Although there are no internal services, the codebase is decomposed into eight f
|
|
|
5048
5046
|
|
|
5049
5047
|
The eight components of the workspace are summarized below. Each has a stable path alias defined in `tsconfig.base.json` and a scope tag declared in the respective `project.json`.
|
|
5050
5048
|
|
|
5051
|
-
| Component |
|
|
5052
|
-
|
|
5053
|
-
| `apps/nextblock` |
|
|
5054
|
-
| `apps/create-nextblock` |
|
|
5055
|
-
| `libs/db` (`@nextblock-cms/db`) |
|
|
5056
|
-
| `libs/ui` (`@nextblock-cms/ui`) |
|
|
5057
|
-
| `libs/editor` (`@nextblock-cms/editor`) |
|
|
5058
|
-
| `libs/sdk` (`@nextblock-cms/sdk`) |
|
|
5059
|
-
| `libs/utils` (`@nextblock-cms/utils`) |
|
|
5060
|
-
| `libs/ecommerce` (`@nextblock-cms/ecom`) |
|
|
5049
|
+
| Component | Scope Tag |
|
|
5050
|
+
| :-- | :-- |
|
|
5051
|
+
| `apps/nextblock` | `scope:public` |
|
|
5052
|
+
| `apps/create-nextblock` | (apps) |
|
|
5053
|
+
| `libs/db` (`@nextblock-cms/db`) | `scope:public` |
|
|
5054
|
+
| `libs/ui` (`@nextblock-cms/ui`) | `scope:public` |
|
|
5055
|
+
| `libs/editor` (`@nextblock-cms/editor`) | `scope:public` |
|
|
5056
|
+
| `libs/sdk` (`@nextblock-cms/sdk`) | `scope:public` |
|
|
5057
|
+
| `libs/utils` (`@nextblock-cms/utils`) | `scope:public` |
|
|
5058
|
+
| `libs/ecommerce` (`@nextblock-cms/ecom`) | `scope:premium` |
|
|
5061
5059
|
|
|
5062
5060
|
Component-level responsibilities and dependencies are documented exhaustively in Section 5.2. For this section's purposes, the salient observation is that **all eight components are bundled into a single Next.js build output** deployed to Vercel — they are not independently deployable services.
|
|
5063
5061
|
|
|
@@ -5124,7 +5122,7 @@ The only "services" in the architecture are the **eight external third-party dom
|
|
|
5124
5122
|
|
|
5125
5123
|
#### 6.1.3.1 External Services Inventory
|
|
5126
5124
|
|
|
5127
|
-
Eight external integration points are declared in `libs/environment.d.ts` and `.env.
|
|
5125
|
+
Eight external integration points are declared in `libs/environment.d.ts` and `.env.example`:
|
|
5128
5126
|
|
|
5129
5127
|
| Service | Purpose | Protocol |
|
|
5130
5128
|
|:--|:--|:--|
|
|
@@ -5289,7 +5287,7 @@ Performance targets (Section 5.4.5) include a 100/100 Lighthouse score, ≤30 s
|
|
|
5289
5287
|
|
|
5290
5288
|
1. **React Server Components First.** Public layouts (`apps/nextblock/app/layout.tsx`) fetch cached data via `unstable_cache` and render on the server, minimizing client JavaScript.
|
|
5291
5289
|
2. **Image Pipeline Pre-optimization.** The `next.config.js` configures AVIF + WebP formats, nine image sizes (16 – 512 px), eleven device sizes (320 – 2560 px), quality tiers `[60, 75]`, and a 1-year `minimumCacheTTL`. Uploads are post-processed by `sharp` and `plaiceholder` to derive derivatives at widths 1920/1280/768/384/128 with blur placeholders.
|
|
5292
|
-
3. **Critical CSS Inlining.** `beasties`
|
|
5290
|
+
3. **Critical CSS Inlining.** `beasties` inlines critical CSS at build.
|
|
5293
5291
|
4. **ISR + On-Demand Revalidation.** Supabase webhooks call `/api/revalidate`, which invokes `revalidatePath(normalizedPath, 'page')` to surgically invalidate changed routes.
|
|
5294
5292
|
5. **Prefetch Priority Signaling.** `proxy.ts` attaches `X-Prefetch-Priority` headers based on page type (`critical`, `high`, `medium`) to guide client-side prefetch decisions.
|
|
5295
5293
|
6. **bfcache Compatibility.** `proxy.ts` emits `Cache-Control: public, max-age=0, must-revalidate` to enable back/forward cache reuse.
|
|
@@ -5307,7 +5305,7 @@ Because the application is deployed on a managed platform with automatic scaling
|
|
|
5307
5305
|
| Stripe webhook latency | Response must complete rapidly; all processing inline | `/api/webhooks/stripe/route.ts` |
|
|
5308
5306
|
| Frankfurter API | One daily cron call amortizes across all stores | `/api/cron/sync-currencies` |
|
|
5309
5307
|
| Cron execution budget | Fit within declared `maxDuration` (30s / 60s) | `vercel.json` |
|
|
5310
|
-
| Revision storage | Use JSON Patch diffs over snapshots to minimize growth | `fast-json-patch`
|
|
5308
|
+
| Revision storage | Use JSON Patch diffs over snapshots to minimize growth | `fast-json-patch` |
|
|
5311
5309
|
|
|
5312
5310
|
Additional scalability considerations documented in Section 2.4.3:
|
|
5313
5311
|
|
|
@@ -5491,7 +5489,7 @@ Content recovery is available through a hybrid snapshot/diff revision scheme:
|
|
|
5491
5489
|
- Revisions are stored in `page_revisions` and `post_revisions` tables.
|
|
5492
5490
|
- `revision_type` enum values are `snapshot` | `diff`.
|
|
5493
5491
|
- `UNIQUE (page_id, version)` ensures monotonic versioning.
|
|
5494
|
-
- Diffs use JSON Patch via `fast-json-patch
|
|
5492
|
+
- Diffs use JSON Patch via `fast-json-patch`.
|
|
5495
5493
|
|
|
5496
5494
|
This enables rollback to any published state without requiring a database restore.
|
|
5497
5495
|
|
|
@@ -5586,7 +5584,7 @@ Failover behavior is **implicit via Vercel's platform** and **explicit via dual-
|
|
|
5586
5584
|
- `nx.json` — Nx workspace orchestration and target defaults
|
|
5587
5585
|
- `eslint.config.mjs` — `@nx/enforce-module-boundaries` rules for scope:public/scope:premium
|
|
5588
5586
|
- `tsconfig.base.json` — Path aliases for all `@nextblock-cms/*` packages
|
|
5589
|
-
- `package.json` (root) — Workspace metadata (
|
|
5587
|
+
- `package.json` (root) — Workspace metadata (`nextblock`)
|
|
5590
5588
|
|
|
5591
5589
|
#### Folders Explored
|
|
5592
5590
|
|
|
@@ -6065,7 +6063,7 @@ flowchart TB
|
|
|
6065
6063
|
end
|
|
6066
6064
|
|
|
6067
6065
|
subgraph DirectPath["Direct Postgres Path - Resilience"]
|
|
6068
|
-
PgLib[postgres
|
|
6066
|
+
PgLib[postgres<br/>order-inventory.ts]
|
|
6069
6067
|
PgUrl[POSTGRES_URL or DATABASE_URL<br/>ssl: require]
|
|
6070
6068
|
end
|
|
6071
6069
|
|
|
@@ -6148,7 +6146,7 @@ sequenceDiagram
|
|
|
6148
6146
|
end
|
|
6149
6147
|
```
|
|
6150
6148
|
|
|
6151
|
-
The RPC function `apply_order_inventory_deduction(p_order_id)` (defined in migration `00000000000005`) is idempotent via the `inventory_deducted_at` sentinel column, respects the `track_quantities` setting read from `site_settings.ecommerce_inventory_settings`, and uses `FOR UPDATE` locking on the order row. If the RPC fails (PostgREST cold start, transient network error), the fallback opens a direct Postgres connection using the `postgres` library
|
|
6149
|
+
The RPC function `apply_order_inventory_deduction(p_order_id)` (defined in migration `00000000000005`) is idempotent via the `inventory_deducted_at` sentinel column, respects the `track_quantities` setting read from `site_settings.ecommerce_inventory_settings`, and uses `FOR UPDATE` locking on the order row. If the RPC fails (PostgREST cold start, transient network error), the fallback opens a direct Postgres connection using the `postgres` library with `ssl: 'require'` and replicates the same transactional semantics. Both paths throw on failure — ensuring the order never transitions to `paid` without a successful inventory effect.
|
|
6152
6150
|
|
|
6153
6151
|
#### 6.2.3.5 Caching Policies
|
|
6154
6152
|
|
|
@@ -6318,7 +6316,7 @@ Connection pooling is managed by **Supabase's managed Supavisor pooler** at the
|
|
|
6318
6316
|
Application-layer details:
|
|
6319
6317
|
|
|
6320
6318
|
- **PostgREST (primary path)** — HTTP-based, stateless; each request uses the Supabase pooler implicitly. No client-side pool configuration is needed.
|
|
6321
|
-
- **Direct Postgres (fallback path)** — `libs/ecommerce/src/lib/order-inventory.ts` uses the `postgres` library
|
|
6319
|
+
- **Direct Postgres (fallback path)** — `libs/ecommerce/src/lib/order-inventory.ts` uses the `postgres` library with `ssl: 'require'`. Per-invocation connection (no persistent pool) to minimize serverless function footprint, suited to Vercel's short-lived functions.
|
|
6322
6320
|
- **Supabase CLI** — uses direct connection with `POSTGRES_URL` / `DATABASE_URL` for `pg_dump`, `psql`, and migration push.
|
|
6323
6321
|
|
|
6324
6322
|
#### 6.2.5.4 Read/Write Splitting
|
|
@@ -6416,7 +6414,7 @@ flowchart TB
|
|
|
6416
6414
|
end
|
|
6417
6415
|
|
|
6418
6416
|
subgraph DirectPath["Direct Postgres Fallback"]
|
|
6419
|
-
PgClient[postgres
|
|
6417
|
+
PgClient[postgres<br/>ssl: require]
|
|
6420
6418
|
end
|
|
6421
6419
|
|
|
6422
6420
|
Prox -->|Session Sync| GoTrue
|
|
@@ -6777,14 +6775,14 @@ External integrations inherit their upstream provider's versioning regime:
|
|
|
6777
6775
|
| Provider | Versioning Mechanism | Version Anchor |
|
|
6778
6776
|
|:--|:--|:--|
|
|
6779
6777
|
| Frankfurter FX | Hardcoded `/v2/rates` path | `libs/ecommerce/src/lib/currency-sync.ts` line 225 |
|
|
6780
|
-
| Stripe | SDK-pinned API version | `stripe` package
|
|
6781
|
-
| Freemius | SDK-pinned API version | `@freemius/sdk`
|
|
6782
|
-
| Supabase | SDK-pinned client version | `@supabase/supabase-js`
|
|
6783
|
-
| Cloudflare R2 | AWS S3 v4 signatures | `@aws-sdk/client-s3`
|
|
6778
|
+
| Stripe | SDK-pinned API version | `stripe` package |
|
|
6779
|
+
| Freemius | SDK-pinned API version | `@freemius/sdk` |
|
|
6780
|
+
| Supabase | SDK-pinned client version | `@supabase/supabase-js` , `@supabase/ssr` |
|
|
6781
|
+
| Cloudflare R2 | AWS S3 v4 signatures | `@aws-sdk/client-s3` |
|
|
6784
6782
|
|
|
6785
6783
|
##### 6.3.2.5.2 Library Versioning as Implicit Contract Versioning
|
|
6786
6784
|
|
|
6787
|
-
Internal contracts between `apps/nextblock` and the six in-process libraries carry independent npm versions
|
|
6785
|
+
Internal contracts between `apps/nextblock` and the six in-process libraries carry independent npm versions. Because all libraries are bundled into a single deployable build, these versions are primarily meaningful for the `apps/create-nextblock` CLI and external SDK consumers — not for runtime API versioning within the application itself.
|
|
6788
6786
|
|
|
6789
6787
|
#### 6.3.2.6 Documentation Standards
|
|
6790
6788
|
|
|
@@ -6813,7 +6811,7 @@ Additional documentation lives in:
|
|
|
6813
6811
|
|
|
6814
6812
|
- `docs/02-ECOMMERCE-CAPABILITIES.md` — Commerce feature matrix and known limitations
|
|
6815
6813
|
- `docs/04-DATABASE-AND-AUTH.md` — Database schema and auth flows
|
|
6816
|
-
- `.env.
|
|
6814
|
+
- `.env.example` — Authoritative environment variable template
|
|
6817
6815
|
- `.agent/skills/project-architecture/SKILL.md` — Boundary-enforcement documentation
|
|
6818
6816
|
|
|
6819
6817
|
---
|
|
@@ -6953,19 +6951,19 @@ This pattern is the system's in-process analog to a retry-with-fallback circuit
|
|
|
6953
6951
|
|
|
6954
6952
|
#### 6.3.4.1 Third-Party Integration Patterns
|
|
6955
6953
|
|
|
6956
|
-
The system integrates with **eight external services**, each declared in `libs/environment.d.ts` and documented in the `.env.
|
|
6954
|
+
The system integrates with **eight external services**, each declared in `libs/environment.d.ts` and documented in the `.env.example` template. Each follows one of the four canonical patterns introduced in Section 6.3.1.2.
|
|
6957
6955
|
|
|
6958
6956
|
##### 6.3.4.1.1 Complete External Service Inventory
|
|
6959
6957
|
|
|
6960
6958
|
| Service | Library / Version | Primary Purpose |
|
|
6961
6959
|
|:--|:--|:--|
|
|
6962
|
-
| Supabase | `@supabase/ssr
|
|
6963
|
-
| Cloudflare R2 | `@aws-sdk/client-s3
|
|
6964
|
-
| Stripe | `stripe
|
|
6965
|
-
| Freemius | `@freemius/checkout
|
|
6960
|
+
| Supabase | `@supabase/ssr`, `@supabase/supabase-js` | Postgres + Auth + RLS + Storage |
|
|
6961
|
+
| Cloudflare R2 | `@aws-sdk/client-s3`, `@aws-sdk/s3-request-presigner` | S3-compatible object storage |
|
|
6962
|
+
| Stripe | `stripe`, `@stripe/stripe-js` | Physical product checkout + Tax |
|
|
6963
|
+
| Freemius | `@freemius/checkout`, `@freemius/sdk` | Digital product checkout + licensing |
|
|
6966
6964
|
| Frankfurter | (native fetch) | FX rate synchronization |
|
|
6967
|
-
| SMTP | `nodemailer
|
|
6968
|
-
| Vercel Platform | `@vercel/speed-insights
|
|
6965
|
+
| SMTP | `nodemailer` | Transactional email |
|
|
6966
|
+
| Vercel Platform | `@vercel/speed-insights`, `@next/third-parties` | Hosting + cron + RUM |
|
|
6969
6967
|
| Google Tag Manager | `@next/third-parties` | Client-side analytics |
|
|
6970
6968
|
|
|
6971
6969
|
##### 6.3.4.1.2 Pattern Distribution
|
|
@@ -7069,7 +7067,7 @@ The CSP policy emitted by `proxy.ts` explicitly whitelists each external integra
|
|
|
7069
7067
|
|
|
7070
7068
|
#### 6.3.4.4 External Service Contracts
|
|
7071
7069
|
|
|
7072
|
-
The complete environment-variable surface of the system is documented below, organized by external integration. All variables are declared in `libs/environment.d.ts` and documented in `.env.
|
|
7070
|
+
The complete environment-variable surface of the system is documented below, organized by external integration. All variables are declared in `libs/environment.d.ts` and documented in `.env.example`.
|
|
7073
7071
|
|
|
7074
7072
|
##### 6.3.4.4.1 Supabase Contract (6 variables)
|
|
7075
7073
|
|
|
@@ -7432,7 +7430,7 @@ The `shipping_zone_locations.postal_code` column exists in the schema but the cu
|
|
|
7432
7430
|
|
|
7433
7431
|
- `vercel.json` — Cron schedule declarations (`reset-sandbox` at 03:00 UTC, `sync-currencies` at 18:00 UTC)
|
|
7434
7432
|
- `libs/environment.d.ts` — NodeJS.ProcessEnv augmentation declaring all external-integration environment variables
|
|
7435
|
-
- `.env.
|
|
7433
|
+
- `.env.example` — Authoritative environment variable template
|
|
7436
7434
|
- `apps/nextblock/proxy.ts` — 272-line request proxy consolidating session sync, RBAC, locale, security headers, CSP, and page-type classification
|
|
7437
7435
|
- `apps/nextblock/app/api/checkout/route.ts` — Checkout orchestration with `resolveProviderFromItem` priority chain, license gate, and provider constraints
|
|
7438
7436
|
- `apps/nextblock/app/api/webhooks/stripe/route.ts` — Stripe webhook transport with raw-body preservation, delegating to `handleStripeWebhook`
|
|
@@ -7486,7 +7484,7 @@ The `shipping_zone_locations.postal_code` column exists in the schema but the cu
|
|
|
7486
7484
|
- `4.5 SCHEDULED AND OPERATIONAL WORKFLOWS` — Sandbox reset and currency sync cron flows
|
|
7487
7485
|
- `4.8 ERROR HANDLING AND RECOVERY` — Error taxonomy and five-pattern resilience classification
|
|
7488
7486
|
- `4.12 TIMING AND SLA CONSIDERATIONS` — Consolidated SLA values
|
|
7489
|
-
- `5.1 HIGH-LEVEL ARCHITECTURE` — Boundary diagrams and integration types
|
|
7487
|
+
- `5.1 HIGH-LEVEL ARCHITECTURE` — Boundary diagrams and integration types
|
|
7490
7488
|
- `5.3 TECHNICAL DECISIONS` — Communication pattern choices, ADR-04 (provider segregation), ADR-05 (inventory dual-path)
|
|
7491
7489
|
- `5.4 CROSS-CUTTING CONCERNS` — Error handling patterns, auth/authz framework, integration points
|
|
7492
7490
|
- `6.1 Core Services Architecture` — Monolithic applicability justification and external integration patterns
|
|
@@ -7886,7 +7884,7 @@ No application-layer field-level encryption is implemented; the architecture rel
|
|
|
7886
7884
|
|
|
7887
7885
|
#### 6.4.4.2 Key and Secret Management
|
|
7888
7886
|
|
|
7889
|
-
Secrets are managed exclusively through environment variables. No credentials are hardcoded in the repository. The authoritative inventory lives in `.env.
|
|
7887
|
+
Secrets are managed exclusively through environment variables. No credentials are hardcoded in the repository. The authoritative inventory lives in `.env.example` and `libs/environment.d.ts` (which augments `NodeJS.ProcessEnv` for compile-time typing).
|
|
7890
7888
|
|
|
7891
7889
|
| Secret | Purpose | Binding Scope |
|
|
7892
7890
|
|--------|---------|---------------|
|
|
@@ -8152,7 +8150,7 @@ No formal compliance certification (SOC 2, ISO 27001, PCI-DSS, HIPAA) is declare
|
|
|
8152
8150
|
| Authorization | Least privilege via RLS grants | `migration 00000000000006` |
|
|
8153
8151
|
| Data Protection (Transit) | TLS via Vercel; HSTS preload eligible | Live response headers |
|
|
8154
8152
|
| Data Protection (Rest) | Platform-default AES-256 (Supabase + R2) | Managed service |
|
|
8155
|
-
| Secret Management | Env-only; no hardcoded credentials | `.env.
|
|
8153
|
+
| Secret Management | Env-only; no hardcoded credentials | `.env.example` audit |
|
|
8156
8154
|
| Webhook Integrity | Provider-specific HMAC signature verification | `/api/webhooks/*` |
|
|
8157
8155
|
| Audit Trail | Structured `console.warn`/`console.error` + Speed Insights | `proxy.ts` + `next.config.js` |
|
|
8158
8156
|
| Bootstrap Integrity | First-admin bootstrap via DB-level atomicity (`FOR UPDATE` + SECURITY DEFINER) | `migration 00000000000005` |
|
|
@@ -8244,7 +8242,7 @@ For details beyond the scope of this section, consult:
|
|
|
8244
8242
|
|
|
8245
8243
|
#### Environment and Configuration
|
|
8246
8244
|
|
|
8247
|
-
- `.env.
|
|
8245
|
+
- `.env.example` — 69-line environment variable inventory
|
|
8248
8246
|
- `libs/environment.d.ts` — `NodeJS.ProcessEnv` type augmentation
|
|
8249
8247
|
|
|
8250
8248
|
#### Documentation and Skills
|
|
@@ -8293,7 +8291,7 @@ The following minimal observability practices are in place and documented throug
|
|
|
8293
8291
|
|
|
8294
8292
|
| Practice | Implementation | Surface |
|
|
8295
8293
|
|:--|:--|:--|
|
|
8296
|
-
| Real User Monitoring (RUM) | `@vercel/speed-insights
|
|
8294
|
+
| Real User Monitoring (RUM) | `@vercel/speed-insights` in `app/layout.tsx` | Vercel Speed Insights dashboard |
|
|
8297
8295
|
| Client-side analytics | `@next/third-parties` GoogleTagManager in `app/layout.tsx` | GTM / Google Analytics |
|
|
8298
8296
|
| Structured log emission | JSON-shaped `console.log` events in `proxy.ts` and `/api/revalidate-log` | Vercel platform log stream |
|
|
8299
8297
|
| Critical-failure log preservation | `compiler.removeConsole` preserves `warn` and `error` | Vercel platform log stream |
|
|
@@ -8324,7 +8322,7 @@ Metrics collection is accomplished through two client-side telemetry libraries l
|
|
|
8324
8322
|
|
|
8325
8323
|
##### 6.5.2.1.1 Vercel Speed Insights (Real User Monitoring)
|
|
8326
8324
|
|
|
8327
|
-
The `@vercel/speed-insights
|
|
8325
|
+
The `@vercel/speed-insights` package is declared in the root `package.json` and mounted via the `<SpeedInsights nonce={nonce} />` component near the closing `<body>` tag of `apps/nextblock/app/layout.tsx`. The component collects Core Web Vitals (LCP, FID/INP, CLS, TTFB) from real user browsers and reports them to the Vercel platform, where they are surfaced on the project's Speed Insights dashboard. The CSP declared in `proxy.ts` explicitly allowlists the `vercel.live` and `vercel.com` origins to permit telemetry transport under the strict nonce-based script policy.
|
|
8328
8326
|
|
|
8329
8327
|
##### 6.5.2.1.2 Google Tag Manager and Client-Side Analytics
|
|
8330
8328
|
|
|
@@ -8332,15 +8330,15 @@ Google Tag Manager is integrated via `@next/third-parties`, wrapped by `ConsentG
|
|
|
8332
8330
|
|
|
8333
8331
|
##### 6.5.2.1.3 Declared-but-Unused @vercel/analytics
|
|
8334
8332
|
|
|
8335
|
-
The `@vercel/analytics
|
|
8333
|
+
The `@vercel/analytics` package is declared in `apps/nextblock/package.json` but is not imported or rendered anywhere in the active codebase. This is an intentional dependency reservation for future enablement; page-view analytics are currently delivered exclusively through GTM when configured.
|
|
8336
8334
|
|
|
8337
8335
|
##### 6.5.2.1.4 Metrics Collection Summary
|
|
8338
8336
|
|
|
8339
8337
|
| Collector | Library Version | Integration Point |
|
|
8340
8338
|
|:--|:--|:--|
|
|
8341
|
-
| Vercel Speed Insights | `@vercel/speed-insights
|
|
8342
|
-
| Google Tag Manager | `@next/third-parties
|
|
8343
|
-
| `@vercel/analytics` |
|
|
8339
|
+
| Vercel Speed Insights | `@vercel/speed-insights` | `apps/nextblock/app/layout.tsx` |
|
|
8340
|
+
| Google Tag Manager | `@next/third-parties` | `apps/nextblock/app/layout.tsx` |
|
|
8341
|
+
| `@vercel/analytics` | (declared) | Not imported |
|
|
8344
8342
|
| Prometheus / StatsD / OTel | Not present | Not applicable |
|
|
8345
8343
|
|
|
8346
8344
|
#### 6.5.2.2 Log Aggregation
|
|
@@ -8393,7 +8391,7 @@ No dedicated alert manager is deployed. Alert pathways fall into three categorie
|
|
|
8393
8391
|
|
|
8394
8392
|
##### 6.5.2.4.1 User-Initiated Feedback Channel (F-029)
|
|
8395
8393
|
|
|
8396
|
-
The primary alert pathway is the **Feedback System** implemented by `FeedbackModal.tsx` in the CMS layout and backed by the `submitFeedback` server action in `apps/nextblock/app/actions/feedback.ts`. The modal presents a subject dropdown (`suggestion`, `bug`, `feature`, `other`), and the server action dispatches an email via `nodemailer
|
|
8394
|
+
The primary alert pathway is the **Feedback System** implemented by `FeedbackModal.tsx` in the CMS layout and backed by the `submitFeedback` server action in `apps/nextblock/app/actions/feedback.ts`. The modal presents a subject dropdown (`suggestion`, `bug`, `feature`, `other`), and the server action dispatches an email via `nodemailer` to the fixed inbox `feedback@nextblock.dev` with a `[CMS Feedback]` subject prefix. Transport credentials are env-configured (SMTP host, port, user, pass). Submission failures log `console.error("Failed to submit feedback:", error)` and return a structured `{success: false, error}` response to the modal.
|
|
8397
8395
|
|
|
8398
8396
|
##### 6.5.2.4.2 Configuration-Discovery Alerts
|
|
8399
8397
|
|
|
@@ -8673,7 +8671,7 @@ Capacity tracking is **entirely platform-delegated**. Per Section 6.1.4, the sys
|
|
|
8673
8671
|
| Cron execution budget | `maxDuration` 30s/60s | Vercel + `vercel.json` |
|
|
8674
8672
|
| Stripe API rate | Provider-managed | Stripe |
|
|
8675
8673
|
| Frankfurter API rate | Single daily cron amortization | Application |
|
|
8676
|
-
| Revision table growth | JSON Patch diffs over snapshots | Application (`fast-json-patch
|
|
8674
|
+
| Revision table growth | JSON Patch diffs over snapshots | Application (`fast-json-patch`) |
|
|
8677
8675
|
|
|
8678
8676
|
Because capacity is not tracked in-application, capacity planning guidance (Section 6.1.4.6) focuses on external integration limits rather than on instance counts.
|
|
8679
8677
|
|
|
@@ -8703,7 +8701,7 @@ flowchart LR
|
|
|
8703
8701
|
CmsUser((CMS User<br/>ADMIN / WRITER))
|
|
8704
8702
|
FeedbackModal[FeedbackModal.tsx<br/>Subject: suggestion · bug<br/>feature · other]
|
|
8705
8703
|
Action[submitFeedback<br/>server action]
|
|
8706
|
-
Nodemailer[nodemailer
|
|
8704
|
+
Nodemailer[nodemailer<br/>SMTP over TLS]
|
|
8707
8705
|
Inbox[(feedback@nextblock.dev<br/>Fixed inbox)]
|
|
8708
8706
|
|
|
8709
8707
|
CmsUser --> FeedbackModal
|
|
@@ -8763,7 +8761,7 @@ The repository does not contain a dedicated `runbooks/` directory. The closest e
|
|
|
8763
8761
|
|
|
8764
8762
|
Operators have four primary recovery mechanisms, all described in detail in Section 6.1.6 and Section 5.4.6:
|
|
8765
8763
|
|
|
8766
|
-
1. **Content rollback via revisions.** `page_revisions` and `post_revisions` tables store hybrid snapshot/diff records (JSON Patch via `fast-json-patch
|
|
8764
|
+
1. **Content rollback via revisions.** `page_revisions` and `post_revisions` tables store hybrid snapshot/diff records (JSON Patch via `fast-json-patch`) keyed by `UNIQUE (page_id, version)`. Any published state can be restored without a database restore.
|
|
8767
8765
|
2. **Supabase Point-in-Time Recovery.** Platform-level PITR is the authoritative recovery path for catastrophic data loss.
|
|
8768
8766
|
3. **Schema reconstruction from migrations.** The eleven canonical SQL files in `libs/db/src/supabase/migrations/` (`000_foundation_and_enums` through `010_seed_content_scaffold`) allow deterministic schema rebuild on a fresh Supabase project.
|
|
8769
8767
|
4. **Nightly sandbox reset as reconstruction rehearsal.** The 03:00 UTC `/api/cron/reset-sandbox` job exercises the full R2-clear → SQL-bootstrap → media-normalize → seed pipeline daily, serving as continuous validation that the recovery procedure still works.
|
|
@@ -8902,8 +8900,8 @@ The following observability gaps are acknowledged and documented for honest stak
|
|
|
8902
8900
|
- `libs/db/src/lib/package-validation.ts` — License gate with `console.error` and 60-second `unstable_cache` tagged `'package-activation'`
|
|
8903
8901
|
- `libs/environment.d.ts` — `NodeJS.ProcessEnv` augmentation declaring external-service env vars (Supabase, R2/S3, SMTP, Freemius, OpenRouter/Cortex AI). GTM is no longer env-configured — it lives in `privacy_settings`.
|
|
8904
8902
|
- `vercel.json` — Two cron schedule declarations: `0 3 * * *` reset-sandbox (60s) and `0 18 * * *` sync-currencies (30s)
|
|
8905
|
-
- `package.json` (root) — Dependency declarations including `@vercel/speed-insights
|
|
8906
|
-
- `apps/nextblock/package.json` — Template-level dependency declarations including `@vercel/analytics
|
|
8903
|
+
- `package.json` (root) — Dependency declarations including `@vercel/speed-insights` and `@next/third-parties`
|
|
8904
|
+
- `apps/nextblock/package.json` — Template-level dependency declarations including `@vercel/analytics` (declared but not imported)
|
|
8907
8905
|
- `docs/05-DEVELOPER-GUIDE.md` — Operational handbook, deployment notes, sandbox operations
|
|
8908
8906
|
- `docs/04-DATABASE-AND-AUTH.md` — Authentication flow, RLS policies, role assignment
|
|
8909
8907
|
|
|
@@ -8977,16 +8975,16 @@ The table below clarifies what is in and out of scope for this section:
|
|
|
8977
8975
|
|
|
8978
8976
|
#### 6.6.2.1 Testing Framework and Dependencies
|
|
8979
8977
|
|
|
8980
|
-
The unit testing surface uses **Vitest
|
|
8978
|
+
The unit testing surface uses **Vitest** as the test runner, integrated into the Nx workspace through the `@nx/vitest` plugin. The full dependency set declared in the root `package.json` is:
|
|
8981
8979
|
|
|
8982
|
-
| Package |
|
|
8983
|
-
|
|
8984
|
-
| `vitest` |
|
|
8985
|
-
| `@vitest/ui` |
|
|
8986
|
-
| `@nx/vitest` |
|
|
8987
|
-
| `jsdom` |
|
|
8988
|
-
| `ajv` |
|
|
8989
|
-
| `baseline-browser-mapping` |
|
|
8980
|
+
| Package | Role in Testing |
|
|
8981
|
+
| :-- | :-- |
|
|
8982
|
+
| `vitest` | Test runner and assertion library |
|
|
8983
|
+
| `@vitest/ui` | Browser-based test UI |
|
|
8984
|
+
| `@nx/vitest` | Nx workspace integration; auto-infers test targets |
|
|
8985
|
+
| `jsdom` | Browser environment shim for DOM-dependent tests |
|
|
8986
|
+
| `ajv` | JSON Schema validation (available to schema-driven tests) |
|
|
8987
|
+
| `baseline-browser-mapping` | Browser compatibility reference data |
|
|
8990
8988
|
|
|
8991
8989
|
Authoritative enumeration of these packages appears in §3.6.3 (Testing) of this specification. No additional testing libraries (Jest, Playwright, Cypress, Storybook, React Testing Library, WebdriverIO, c8, istanbul) are installed.
|
|
8992
8990
|
|
|
@@ -9120,7 +9118,7 @@ No E2E test framework (Playwright, Cypress, WebdriverIO, Puppeteer) is installed
|
|
|
9120
9118
|
|
|
9121
9119
|
#### 6.6.4.2 Cross-Browser Testing — Not Automated
|
|
9122
9120
|
|
|
9123
|
-
Cross-browser compatibility is addressed through the **`baseline-browser-mapping
|
|
9121
|
+
Cross-browser compatibility is addressed through the **`baseline-browser-mapping`** reference dataset, which informs build-time compatibility decisions. No automated cross-browser test matrix (BrowserStack, Sauce Labs, Playwright browser pool) is configured. The workspace ships `jsdom` as a browser environment shim — available for future DOM-dependent unit tests — but currently has no tests that use it.
|
|
9124
9122
|
|
|
9125
9123
|
#### 6.6.4.3 Performance Testing Requirements — Not Automated
|
|
9126
9124
|
|
|
@@ -9224,12 +9222,12 @@ The quality gates that **do** exist — and that, in aggregate, substitute for t
|
|
|
9224
9222
|
| Gate | Mechanism | Enforcement Point |
|
|
9225
9223
|
|:--|:--|:--|
|
|
9226
9224
|
| Type safety | TypeScript `strict: true` | `tsconfig.base.json` — build-time |
|
|
9227
|
-
| Code style | Prettier
|
|
9228
|
-
| Lint rules | ESLint
|
|
9225
|
+
| Code style | Prettier | `.prettierrc` — IDE / manual |
|
|
9226
|
+
| Lint rules | ESLint flat config | `eslint.config.mjs` — `npm run lint` |
|
|
9229
9227
|
| Module boundaries | `@nx/enforce-module-boundaries` | `eslint.config.mjs` — lint-time |
|
|
9230
|
-
| Accessibility | `eslint-plugin-jsx-a11y
|
|
9231
|
-
| React rules | `eslint-plugin-react
|
|
9232
|
-
| Next.js best practices | `eslint-config-next
|
|
9228
|
+
| Accessibility | `eslint-plugin-jsx-a11y` | Lint-time |
|
|
9229
|
+
| React rules | `eslint-plugin-react`, `eslint-plugin-react-hooks` | Lint-time |
|
|
9230
|
+
| Next.js best practices | `eslint-config-next`, `@next/eslint-plugin-next` | Lint-time |
|
|
9233
9231
|
| Database authorization | Row-Level Security + SECURITY DEFINER helpers | Runtime (Supabase) |
|
|
9234
9232
|
| Webhook authenticity | Stripe `constructEvent`, Freemius HMAC-SHA-256 | Runtime (serverless handlers) |
|
|
9235
9233
|
| Server-only isolation | `import 'server-only'` + `typeof window !== 'undefined'` guards | Build-time + runtime |
|
|
@@ -9272,8 +9270,8 @@ graph TB
|
|
|
9272
9270
|
subgraph DevMachine["Developer Machine - Local Test Environment"]
|
|
9273
9271
|
Node[Node.js Runtime<br/>v20 or later]
|
|
9274
9272
|
Pnpm[npm / Nx CLI]
|
|
9275
|
-
Nx[Nx
|
|
9276
|
-
VitestRunner[Vitest
|
|
9273
|
+
Nx[Nx<br/>with @nx/vitest plugin]
|
|
9274
|
+
VitestRunner[Vitest Runner]
|
|
9277
9275
|
JSDOM[jsdom 27 - available<br/>currently unused]
|
|
9278
9276
|
TestFile[libs/utils/tests/<br/>translation-workspace.test.ts]
|
|
9279
9277
|
SrcModule[libs/utils/src/lib/<br/>translation-workspace.ts]
|
|
@@ -9308,7 +9306,7 @@ flowchart TD
|
|
|
9308
9306
|
NxResolve --> Infer{Test target<br/>configured?}
|
|
9309
9307
|
Infer -->|No explicit target| AutoInfer[@nx/vitest plugin<br/>auto-infers test target]
|
|
9310
9308
|
Infer -->|Yes explicit| DirectTarget[Use declared target]
|
|
9311
|
-
AutoInfer --> LaunchVitest[Launch Vitest
|
|
9309
|
+
AutoInfer --> LaunchVitest[Launch Vitest]
|
|
9312
9310
|
DirectTarget --> LaunchVitest
|
|
9313
9311
|
LaunchVitest --> Discover[Discover test files<br/>matching test pattern]
|
|
9314
9312
|
Discover --> LoadTest[Load<br/>translation-workspace.test.ts]
|
|
@@ -9357,7 +9355,7 @@ Resource requirements for executing the test suite are minimal and match a stand
|
|
|
9357
9355
|
|
|
9358
9356
|
| Resource | Requirement |
|
|
9359
9357
|
|:--|:--|
|
|
9360
|
-
| Node.js | Version compatible with Vitest
|
|
9358
|
+
| Node.js | Version compatible with Vitest and Nx |
|
|
9361
9359
|
| CPU | Single core sufficient (6 tests complete in subsecond time) |
|
|
9362
9360
|
| Memory | <512 MB typical for Vitest + jsdom idle load |
|
|
9363
9361
|
| Disk | Shared with Nx workspace cache (no dedicated test artifact storage) |
|
|
@@ -9462,7 +9460,7 @@ While the current posture is intentional, the Nx workspace is pre-configured to
|
|
|
9462
9460
|
|:--|:--|
|
|
9463
9461
|
| Additional unit tests in any library | Add `*.test.ts` file; `@nx/vitest` auto-infers the target |
|
|
9464
9462
|
| Coverage enforcement | Create `vitest.config.ts` in a project; Nx generator supports `--coverage` |
|
|
9465
|
-
| Component testing (React Testing Library) | Install `@testing-library/react`; use existing `jsdom
|
|
9463
|
+
| Component testing (React Testing Library) | Install `@testing-library/react`; use existing `jsdom` environment shim |
|
|
9466
9464
|
| E2E testing (Playwright / Cypress) | Install framework; create `apps/nextblock-e2e` project per Nx convention |
|
|
9467
9465
|
| CI integration (GitHub Actions) | Create `.github/workflows/ci.yml` invoking `nx affected -t test,lint,build` |
|
|
9468
9466
|
| Coverage reporting | Apply the registered-but-unapplied `@nx/vitest` migration `update-22-6-0-prefix-reports-directory` |
|
|
@@ -9503,7 +9501,7 @@ The accepted tradeoff in §5.3.1 ("Vitest-only — Limited end-to-end coverage")
|
|
|
9503
9501
|
|
|
9504
9502
|
- The system has an **intentionally minimal testing strategy** formalized as an ADR in §5.3.1.
|
|
9505
9503
|
- The **sole automated test file** is `libs/utils/tests/translation-workspace.test.ts`, containing six Vitest test cases across two `describe` blocks.
|
|
9506
|
-
- **Vitest
|
|
9504
|
+
- **Vitest** is integrated via the `@nx/vitest` plugin with `testTargetName: "test"`; no `vitest.config.ts` file exists in the workspace.
|
|
9507
9505
|
- **No CI/CD test automation exists** — the repository contains no `.github/workflows/` directory; Vercel builds the application and Node scripts publish libraries, neither of which runs tests.
|
|
9508
9506
|
- **Manual QA harnesses** in `libs/editor/src/lib/components/test/` provide human-operated validation for editor surfaces but are not automated tests.
|
|
9509
9507
|
- **Quality assurance substitutes** for an automated test pyramid via TypeScript `strict: true`, ESLint `@nx/enforce-module-boundaries`, accessibility lints, RLS at the database layer, signed-webhook verification at integration boundaries, and build-time type safety.
|
|
@@ -9530,7 +9528,7 @@ The accepted tradeoff in §5.3.1 ("Vitest-only — Limited end-to-end coverage")
|
|
|
9530
9528
|
|
|
9531
9529
|
#### Files Examined
|
|
9532
9530
|
|
|
9533
|
-
- `package.json` (root) — Declares `vitest
|
|
9531
|
+
- `package.json` (root) — Declares `vitest`, `@vitest/ui`, `@nx/vitest`, `jsdom`, `ajv`, `baseline-browser-mapping`; contains 51 scripts with zero matching `test`/`spec`
|
|
9534
9532
|
- `nx.json` — `@nx/vitest` plugin registration with `testTargetName: "test"`; production named-input excludes `*.spec.*`/`*.test.*`/`tsconfig.spec.json`/`test-setup.*`; `@nx/react` library generator default `unitTestRunner: "none"`
|
|
9535
9533
|
- `migrations.json` — Registered unapplied migration `update-22-6-0-prefix-reports-directory` for Vitest coverage report path
|
|
9536
9534
|
- `tsconfig.base.json` — Workspace-wide TypeScript `strict: true` (compensating compile-time gate)
|
|
@@ -9599,12 +9597,12 @@ The UI is composed using the React Server Components (RSC)-first model introduce
|
|
|
9599
9597
|
|
|
9600
9598
|
### 7.2.1 Framework and Runtime Stack
|
|
9601
9599
|
|
|
9602
|
-
| Technology |
|
|
9603
|
-
|
|
9604
|
-
| Next.js (App Router) |
|
|
9605
|
-
| React / react-dom |
|
|
9606
|
-
| TypeScript |
|
|
9607
|
-
| Nx |
|
|
9600
|
+
| Technology | Role |
|
|
9601
|
+
| :-- | :-- |
|
|
9602
|
+
| Next.js (App Router) | Full-stack React framework with RSC |
|
|
9603
|
+
| React / react-dom | UI runtime with Server Components & Actions |
|
|
9604
|
+
| TypeScript | Strict-mode language |
|
|
9605
|
+
| Nx | Monorepo orchestration |
|
|
9608
9606
|
|
|
9609
9607
|
The application is the sole runtime surface; it hosts the public website, the CMS admin, the customer storefront, and all API/webhook/cron/upload handlers. Client-side composition follows a strict nested provider order, defined in `apps/nextblock/app/providers.tsx`, that hydrates server-resolved state (auth, locale, currency, content context, translations, theme) into React Context for the entire client tree.
|
|
9610
9608
|
|
|
@@ -9612,15 +9610,15 @@ The application is the sole runtime surface; it hosts the public website, the CM
|
|
|
9612
9610
|
|
|
9613
9611
|
The workspace's styling model combines a utility-first CSS layer with a headless-component layer:
|
|
9614
9612
|
|
|
9615
|
-
| Library |
|
|
9616
|
-
|
|
9617
|
-
| `tailwindcss` |
|
|
9618
|
-
| `@tailwindcss/postcss` |
|
|
9619
|
-
| `postcss` / `autoprefixer` |
|
|
9620
|
-
| `tailwindcss-animate` |
|
|
9621
|
-
| `tailwind-merge` |
|
|
9622
|
-
| `clsx` |
|
|
9623
|
-
| `class-variance-authority` |
|
|
9613
|
+
| Library | Purpose |
|
|
9614
|
+
| :-- | :-- |
|
|
9615
|
+
| `tailwindcss` | Utility-first CSS framework |
|
|
9616
|
+
| `@tailwindcss/postcss` | Tailwind 4 PostCSS integration |
|
|
9617
|
+
| `postcss` / `autoprefixer` | CSS transformation + vendor prefixing |
|
|
9618
|
+
| `tailwindcss-animate` | Pre-built animation utilities |
|
|
9619
|
+
| `tailwind-merge` | Class-name conflict resolution |
|
|
9620
|
+
| `clsx` | Conditional class composition |
|
|
9621
|
+
| `class-variance-authority` | Variant-based styling primitives |
|
|
9624
9622
|
|
|
9625
9623
|
The root `components.json` registers shadcn/ui with the `slate` base color palette, CSS-variables-based theming, React Server Components support, and TSX component format. Tailwind is configured with `darkMode: ['class']` for `next-themes` compatibility and content globs spanning both `apps/**` and `libs/**`.
|
|
9626
9624
|
|
|
@@ -9628,23 +9626,23 @@ The root `components.json` registers shadcn/ui with the `slate` base color palet
|
|
|
9628
9626
|
|
|
9629
9627
|
Twelve `@radix-ui/*` primitives supply accessible, WAI-ARIA-compliant behavior underneath the design system components:
|
|
9630
9628
|
|
|
9631
|
-
| Primitive |
|
|
9632
|
-
|
|
9633
|
-
| `@radix-ui/react-avatar` |
|
|
9634
|
-
| `@radix-ui/react-checkbox` |
|
|
9635
|
-
| `@radix-ui/react-dialog` |
|
|
9636
|
-
| `@radix-ui/react-dropdown-menu` |
|
|
9637
|
-
| `@radix-ui/react-label` |
|
|
9638
|
-
| `@radix-ui/react-popover` |
|
|
9629
|
+
| Primitive | Primitive |
|
|
9630
|
+
| :-- | :-- |
|
|
9631
|
+
| `@radix-ui/react-avatar` | `@radix-ui/react-progress` |
|
|
9632
|
+
| `@radix-ui/react-checkbox` | `@radix-ui/react-radio-group` |
|
|
9633
|
+
| `@radix-ui/react-dialog` | `@radix-ui/react-select` |
|
|
9634
|
+
| `@radix-ui/react-dropdown-menu` | `@radix-ui/react-separator` |
|
|
9635
|
+
| `@radix-ui/react-label` | `@radix-ui/react-slot` |
|
|
9636
|
+
| `@radix-ui/react-popover` | `@radix-ui/react-tooltip` |
|
|
9639
9637
|
|
|
9640
9638
|
### 7.2.4 Iconography and Theming
|
|
9641
9639
|
|
|
9642
|
-
- **`lucide-react`** (
|
|
9643
|
-
- **`next-themes`**
|
|
9640
|
+
- **`lucide-react`** (at workspace level; in the published template package) — provides the typed icon set consumed throughout the UI and by `@nextblock-cms/sdk` block configurations (F-024).
|
|
9641
|
+
- **`next-themes`** — enables four-variant theme switching (`light`, `dark`, `vibrant`, `system`) via class-based strategy, composed as the outermost provider in `apps/nextblock/app/providers.tsx`.
|
|
9644
9642
|
|
|
9645
9643
|
### 7.2.5 Rich-Text Editor Stack — `libs/editor`
|
|
9646
9644
|
|
|
9647
|
-
The `@nextblock-cms/editor` library
|
|
9645
|
+
The `@nextblock-cms/editor` library bundles Tiptap with 40+ extensions and the Yjs collaboration stack, exported by feature family:
|
|
9648
9646
|
|
|
9649
9647
|
| Family | Included Extensions |
|
|
9650
9648
|
|:--|:--|
|
|
@@ -9652,29 +9650,29 @@ The `@nextblock-cms/editor` library (version `0.2.24`) bundles Tiptap 3.22.4 wit
|
|
|
9652
9650
|
| Inline Marks | bold, italic, underline, strike, code, subscript, superscript, highlight, link, color, font-family, text-align, text-style, blockquote |
|
|
9653
9651
|
| Block Nodes | bullet-list, ordered-list, list-item, task-item, task-list, heading, code-block-lowlight, details, horizontal-rule, hard-break, table/-cell/-header/-row, image |
|
|
9654
9652
|
| Interactions | bubble-menu, floating-menu, drag-handle, drag-handle-react, focus, placeholder, character-count, dropcursor, gapcursor, emoji, mention, node-range, typography, history, mathematics, youtube |
|
|
9655
|
-
| Collaboration | `@tiptap/extension-collaboration`
|
|
9656
|
-
| Auxiliary | `lowlight`
|
|
9653
|
+
| Collaboration | `@tiptap/extension-collaboration` , `@tiptap/y-tiptap` , `yjs` , `y-protocols` |
|
|
9654
|
+
| Auxiliary | `lowlight` for syntax highlighting, `katex` for mathematical notation |
|
|
9657
9655
|
|
|
9658
9656
|
### 7.2.6 Forms, Validation, and Client State
|
|
9659
9657
|
|
|
9660
|
-
| Library |
|
|
9661
|
-
|
|
9662
|
-
| `zod` |
|
|
9663
|
-
| `react-hook-form` |
|
|
9664
|
-
| `@hookform/resolvers` |
|
|
9665
|
-
| `zustand` |
|
|
9658
|
+
| Library | Role |
|
|
9659
|
+
| :-- | :-- |
|
|
9660
|
+
| `zod` | Universal schema validation (block schemas, API validation, form resolvers) |
|
|
9661
|
+
| `react-hook-form` | Form state management |
|
|
9662
|
+
| `@hookform/resolvers` | Zod ↔ react-hook-form adapter |
|
|
9663
|
+
| `zustand` | Client-side cart store (F-015) with persist middleware |
|
|
9666
9664
|
|
|
9667
9665
|
### 7.2.7 Interaction and Behavior Libraries
|
|
9668
9666
|
|
|
9669
|
-
| Library |
|
|
9670
|
-
|
|
9671
|
-
| `@dnd-kit/core` |
|
|
9672
|
-
| `@dnd-kit/sortable` |
|
|
9673
|
-
| `@dnd-kit/utilities` |
|
|
9674
|
-
| `@floating-ui/dom` |
|
|
9675
|
-
| `@floating-ui/react` |
|
|
9676
|
-
| `react-hot-toast` |
|
|
9677
|
-
| `sonner` |
|
|
9667
|
+
| Library | Purpose |
|
|
9668
|
+
| :-- | :-- |
|
|
9669
|
+
| `@dnd-kit/core` | Drag-and-drop primitives for block reordering |
|
|
9670
|
+
| `@dnd-kit/sortable` | Sortable list implementation |
|
|
9671
|
+
| `@dnd-kit/utilities` | DnD helpers |
|
|
9672
|
+
| `@floating-ui/dom` | Floating element positioning |
|
|
9673
|
+
| `@floating-ui/react` | React bindings for floating-ui |
|
|
9674
|
+
| `react-hot-toast` | Toast notifications |
|
|
9675
|
+
| `sonner` | Alternative toast notifications |
|
|
9678
9676
|
|
|
9679
9677
|
---
|
|
9680
9678
|
|
|
@@ -9789,7 +9787,7 @@ sequenceDiagram
|
|
|
9789
9787
|
|
|
9790
9788
|
### 7.5.1 Block SDK Contract (F-024)
|
|
9791
9789
|
|
|
9792
|
-
The published `@nextblock-cms/sdk` library
|
|
9790
|
+
The published `@nextblock-cms/sdk` library defines the typed extensibility contract for block authoring. Main exports from `libs/sdk/src/lib/sdk.ts`:
|
|
9793
9791
|
|
|
9794
9792
|
| Export | Role |
|
|
9795
9793
|
|:--|:--|
|
|
@@ -10514,7 +10512,7 @@ The repository declares no explicit compliance requirements (no SOC 2, ISO 27001
|
|
|
10514
10512
|
| Content security | Nonce-based CSP via `crypto.randomUUID()` | `proxy.ts` |
|
|
10515
10513
|
| Data authorization | Row-Level Security + SECURITY DEFINER helpers | 11 canonical migrations |
|
|
10516
10514
|
| Webhook authenticity | Stripe `constructEvent`; Freemius HMAC-SHA-256 | `libs/ecommerce/src/lib/stripe/webhooks.ts`; Freemius route |
|
|
10517
|
-
| Session security | `HttpOnly`/`Secure` cookies via `@supabase/ssr
|
|
10515
|
+
| Session security | `HttpOnly`/`Secure` cookies via `@supabase/ssr` | Proxy + Supabase SSR |
|
|
10518
10516
|
| Open-source licensing | AGPLv3 for public libraries; license-gated for premium | `LICENSE.md`, scope tags |
|
|
10519
10517
|
|
|
10520
10518
|
PCI-DSS scope is reduced by delegating card handling entirely to Stripe (card data never reaches NextBlock servers or Supabase). Digital-product licensing is delegated to Freemius.
|
|
@@ -10531,7 +10529,7 @@ NextBlock CMS does **not use Terraform, Pulumi, AWS CloudFormation, or any imper
|
|
|
10531
10529
|
| `libs/db/src/supabase/migrations/` (11 files) | Database schema, enums, functions, triggers, RLS, indexes, seed data |
|
|
10532
10530
|
| `libs/db/src/supabase/config.toml` | Supabase CLI local-dev ports, auth settings, rate limits, pooler config |
|
|
10533
10531
|
| `libs/db/src/supabase/templates/` (6 files) | Auth email templates (confirmation, invite, magic link, recovery, reauth, email change) |
|
|
10534
|
-
| `.env.
|
|
10532
|
+
| `.env.example` | Authoritative environment variable template (40+ variables) |
|
|
10535
10533
|
| `nx.json` | Workspace orchestration, build graph plugins, generator defaults, named inputs |
|
|
10536
10534
|
| Per-project `project.json` (10 files) | Nx project targets, scope tags, build executors, outputs |
|
|
10537
10535
|
| `.verdaccio/config.yml` | Local npm registry configuration (port 4873) |
|
|
@@ -10539,7 +10537,7 @@ NextBlock CMS does **not use Terraform, Pulumi, AWS CloudFormation, or any imper
|
|
|
10539
10537
|
|
|
10540
10538
|
#### 8.2.2.2 Configuration Management Strategy
|
|
10541
10539
|
|
|
10542
|
-
Runtime configuration is **exclusively environment-variable driven**, consumed through `process.env` at server boundaries and validated (implicitly) through TypeScript declarations in `libs/environment.d.ts`. The authoritative variable inventory from `.env.
|
|
10540
|
+
Runtime configuration is **exclusively environment-variable driven**, consumed through `process.env` at server boundaries and validated (implicitly) through TypeScript declarations in `libs/environment.d.ts`. The authoritative variable inventory from `.env.example` is grouped into seven categories:
|
|
10543
10541
|
|
|
10544
10542
|
| Category | Variable Count | Examples |
|
|
10545
10543
|
|:--|:--|:--|
|
|
@@ -10552,7 +10550,7 @@ Runtime configuration is **exclusively environment-variable driven**, consumed t
|
|
|
10552
10550
|
| Stripe | 3 | `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET`, `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` |
|
|
10553
10551
|
| Freemius | 10 | `FREEMIUS_DEVELOPER_ID`, `FREEMIUS_PUBLIC_KEY`, `FREEMIUS_SECRET_KEY`, `FREEMIUS_API_KEY`, `FREEMIUS_CHECKOUT_PRODUCTS_JSON`, `FREEMIUS_ECOMMERCE_SANDBOX_PUBLIC_KEY`, `FREEMIUS_ECOMMERCE_SANDBOX_SECRET_KEY`, `FREEMIUS_SANDBOX_ENABLED`, `FREEMIUS_ECOMMERCE_SANDBOX_KEY` |
|
|
10554
10552
|
|
|
10555
|
-
Local developer bootstrap is driven by the interactive `node tools/scripts/setup.mjs` wizard (invoked via `npm run setup`), which creates `.env.local` from `.env.
|
|
10553
|
+
Local developer bootstrap is driven by the interactive `node tools/scripts/setup.mjs` wizard (invoked via `npm run setup`), which creates `.env.local` from `.env.example` and interactively prompts for Supabase project id, connection string, anon key, service role key, and access token. Passwords are extracted from `POSTGRES_URL` where possible.
|
|
10556
10554
|
|
|
10557
10555
|
**Configuration layering order** at runtime is the Next.js default: `.env.local` > `.env.<NODE_ENV>.local` > `.env.<NODE_ENV>` > `.env`. Vercel supplies production values through its **Environment Variables** dashboard section (per-environment: Production, Preview, Development).
|
|
10558
10556
|
|
|
@@ -10602,7 +10600,7 @@ Disaster recovery relies on **four compounding recovery mechanisms**, none of wh
|
|
|
10602
10600
|
| Mechanism | Recovery Objective | Implementation |
|
|
10603
10601
|
|:--|:--|:--|
|
|
10604
10602
|
| Supabase Point-in-Time Recovery (PITR) | Catastrophic data loss | Platform-managed by Supabase |
|
|
10605
|
-
| Content revisions | Accidental edits / content rollback | `page_revisions` + `post_revisions` tables with JSON Patch diffs (via `fast-json-patch
|
|
10603
|
+
| Content revisions | Accidental edits / content rollback | `page_revisions` + `post_revisions` tables with JSON Patch diffs (via `fast-json-patch`), `UNIQUE(page_id, version)` |
|
|
10606
10604
|
| Schema reconstruction from migrations | Cold-start rebuild | 11 canonical SQL files in `libs/db/src/supabase/migrations/` applied in order |
|
|
10607
10605
|
| Nightly sandbox reset (reconstruction rehearsal) | Continuous validation that recovery pipeline works | `/api/cron/reset-sandbox` at 03:00 UTC |
|
|
10608
10606
|
|
|
@@ -10631,7 +10629,7 @@ Three distinct cloud providers compose the production footprint. The rationale f
|
|
|
10631
10629
|
|:--|:--|:--|
|
|
10632
10630
|
| Vercel | Compute + Edge + Cron + RUM | Zero-configuration Next.js 16 hosting; built-in image optimization; native App Router support; no container orchestration overhead; cron scheduling integrated with function lifecycle |
|
|
10633
10631
|
| Supabase | PostgreSQL + Auth + Storage metadata | Managed PostgreSQL 17 with built-in RLS; GoTrue auth service; SQL migration CLI; PITR included; generous free tier for open-core distribution |
|
|
10634
|
-
| Cloudflare R2 | S3-compatible object storage | Zero egress fees (superior to AWS S3 for media-heavy workloads); S3-compatible API usable via `@aws-sdk/client-s3
|
|
10632
|
+
| Cloudflare R2 | S3-compatible object storage | Zero egress fees (superior to AWS S3 for media-heavy workloads); S3-compatible API usable via `@aws-sdk/client-s3`; global edge presence |
|
|
10635
10633
|
|
|
10636
10634
|
**Documented deviations from the Default Technology Stack** (per §3.7.1):
|
|
10637
10635
|
|
|
@@ -10639,7 +10637,7 @@ Three distinct cloud providers compose the production footprint. The rationale f
|
|
|
10639
10637
|
|:--|:--|:--|
|
|
10640
10638
|
| AWS | Vercel + Cloudflare R2 | Platform simplicity + Next.js-native integration + zero egress fees for media |
|
|
10641
10639
|
| Docker | None | Vercel-native deployment eliminates container runtime requirement |
|
|
10642
|
-
| Terraform | Declarative config across `vercel.json`, migrations, `config.toml`, `.env.
|
|
10640
|
+
| Terraform | Declarative config across `vercel.json`, migrations, `config.toml`, `.env.example`, `nx.json` | No multi-service provisioning to orchestrate |
|
|
10643
10641
|
| GitHub Actions | Vercel Git integration + Node release scripts in `tools/scripts/` | No CI test suite to gate; publication handled imperatively |
|
|
10644
10642
|
| Python / Flask | TypeScript + Next.js route handlers | Unified stack across client + server |
|
|
10645
10643
|
| Auth0 | Supabase Auth (GoTrue) | Integrated with RLS at the database layer |
|
|
@@ -10649,26 +10647,26 @@ Three distinct cloud providers compose the production footprint. The rationale f
|
|
|
10649
10647
|
|
|
10650
10648
|
#### 8.3.2.1 Vercel Platform Services
|
|
10651
10649
|
|
|
10652
|
-
| Vercel Service | Integration Library |
|
|
10653
|
-
|
|
10654
|
-
| Serverless Functions | `next` (built-in) |
|
|
10655
|
-
| Edge Runtime | `next/server` (built-in) |
|
|
10656
|
-
| Cron | `vercel.json` `crons` declaration |
|
|
10657
|
-
| Image Optimization | `next/image` (built-in) |
|
|
10658
|
-
| Speed Insights | `@vercel/speed-insights` |
|
|
10659
|
-
| Third-Party Script Loader | `@next/third-parties` |
|
|
10660
|
-
| Analytics (declared, unused) | `@vercel/analytics` |
|
|
10650
|
+
| Vercel Service | Integration Library | Function |
|
|
10651
|
+
| :-- | :-- | :-- |
|
|
10652
|
+
| Serverless Functions | `next` (built-in) | Run Route Handlers, Server Actions, Server Components |
|
|
10653
|
+
| Edge Runtime | `next/server` (built-in) | Execute `proxy.ts` |
|
|
10654
|
+
| Cron | `vercel.json` `crons` declaration | Invoke scheduled endpoints |
|
|
10655
|
+
| Image Optimization | `next/image` (built-in) | AVIF + WebP transformation |
|
|
10656
|
+
| Speed Insights | `@vercel/speed-insights` | Core Web Vitals RUM |
|
|
10657
|
+
| Third-Party Script Loader | `@next/third-parties` | GTM script loader with nonce support |
|
|
10658
|
+
| Analytics (declared, unused) | `@vercel/analytics` | Reserved for future page-view enablement |
|
|
10661
10659
|
|
|
10662
10660
|
#### 8.3.2.2 Supabase Services
|
|
10663
10661
|
|
|
10664
|
-
| Supabase Service | Integration Library |
|
|
10665
|
-
|
|
10666
|
-
| PostgreSQL | `postgres` |
|
|
10667
|
-
| SSR client | `@supabase/ssr` |
|
|
10668
|
-
| Browser client | `@supabase/supabase-js` |
|
|
10669
|
-
| Auth (GoTrue) | via `@supabase/ssr` |
|
|
10670
|
-
| Realtime | bundled (enabled in `config.toml`) |
|
|
10671
|
-
| CLI | `supabase` |
|
|
10662
|
+
| Supabase Service | Integration Library | Function |
|
|
10663
|
+
| :-- | :-- | :-- |
|
|
10664
|
+
| PostgreSQL | `postgres` | Direct SQL when RPC unavailable |
|
|
10665
|
+
| SSR client | `@supabase/ssr` | Server-side cookie-based session |
|
|
10666
|
+
| Browser client | `@supabase/supabase-js` | Client components + editor |
|
|
10667
|
+
| Auth (GoTrue) | via `@supabase/ssr` | Email/password, password reset |
|
|
10668
|
+
| Realtime | bundled (enabled in `config.toml`) | WebSocket subscriptions |
|
|
10669
|
+
| CLI | `supabase` | Migrations, link, db push, config push |
|
|
10672
10670
|
|
|
10673
10671
|
**Supabase `config.toml` declarations** (`libs/db/src/supabase/config.toml`):
|
|
10674
10672
|
|
|
@@ -10702,7 +10700,7 @@ Three distinct cloud providers compose the production footprint. The rationale f
|
|
|
10702
10700
|
|
|
10703
10701
|
#### 8.3.2.3 Cloudflare R2 Configuration
|
|
10704
10702
|
|
|
10705
|
-
R2 is consumed through the S3-compatible API using `@aws-sdk/client-s3
|
|
10703
|
+
R2 is consumed through the S3-compatible API using `@aws-sdk/client-s3`. The endpoint is constructed as `https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com`. Access is dual-mode:
|
|
10706
10704
|
|
|
10707
10705
|
| Access Mode | Use Case | Credential |
|
|
10708
10706
|
|:--|:--|:--|
|
|
@@ -10716,16 +10714,16 @@ The `next.config.js` `remotePatterns` are dynamically derived from `NEXT_PUBLIC_
|
|
|
10716
10714
|
|
|
10717
10715
|
Eight external service integrations are declared across the workspace:
|
|
10718
10716
|
|
|
10719
|
-
| Service | Client Library |
|
|
10720
|
-
|
|
10721
|
-
| Supabase Postgres + Auth | `@supabase/ssr`, `@supabase/supabase-js`, `postgres` |
|
|
10722
|
-
| Cloudflare R2 | `@aws-sdk/client-s3` |
|
|
10723
|
-
| Stripe | `stripe` |
|
|
10724
|
-
| Freemius | `@freemius/checkout`, `@freemius/sdk` |
|
|
10725
|
-
| Frankfurter FX | native `fetch` |
|
|
10726
|
-
| SMTP | `nodemailer` |
|
|
10727
|
-
| Vercel Speed Insights | `@vercel/speed-insights` |
|
|
10728
|
-
| Google Tag Manager | `@next/third-parties` |
|
|
10717
|
+
| Service | Client Library | Failure Classification |
|
|
10718
|
+
| :-- | :-- | :-- |
|
|
10719
|
+
| Supabase Postgres + Auth | `@supabase/ssr`, `@supabase/supabase-js`, `postgres` | Critical path |
|
|
10720
|
+
| Cloudflare R2 | `@aws-sdk/client-s3` | Critical for media |
|
|
10721
|
+
| Stripe | `stripe` | Critical path for commerce |
|
|
10722
|
+
| Freemius | `@freemius/checkout`, `@freemius/sdk` | Best-effort (ack-only) |
|
|
10723
|
+
| Frankfurter FX | native `fetch` | Best-effort (skipped currency telemetry) |
|
|
10724
|
+
| SMTP | `nodemailer` | Best-effort degrade |
|
|
10725
|
+
| Vercel Speed Insights | `@vercel/speed-insights` | Observational |
|
|
10726
|
+
| Google Tag Manager | `@next/third-parties` | Observational (disabled if `privacy_settings.gtm_id` unset) |
|
|
10729
10727
|
|
|
10730
10728
|
### 8.3.3 High Availability Design
|
|
10731
10729
|
|
|
@@ -10817,7 +10815,7 @@ The concerns that containerization would address are handled through alternative
|
|
|
10817
10815
|
|
|
10818
10816
|
| Containerization Concern | Substitute Mechanism |
|
|
10819
10817
|
|:--|:--|
|
|
10820
|
-
| Runtime environment consistency | `packageManager
|
|
10818
|
+
| Runtime environment consistency | `packageManager` pinning + `nx.json` `defaultBase: master` + Node version managed by Vercel |
|
|
10821
10819
|
| Dependency isolation | Nx-enforced module boundaries via `@nx/enforce-module-boundaries` + scope tags (`scope:public` / `scope:premium`) |
|
|
10822
10820
|
| Local dev database parity | Supabase CLI with `libs/db/src/supabase/config.toml` (local ports 54321/54322/54323/54320) |
|
|
10823
10821
|
| Reproducible builds | `tools/scripts/release-lib.js` with `--skip-nx-cache --with-deps` |
|
|
@@ -10870,30 +10868,30 @@ NextBlock CMS operates a **hybrid CI/CD model**. There is **no `.github/workflow
|
|
|
10870
10868
|
| Repository | `git+https://github.com/nextblock-cms/nextblock.git` |
|
|
10871
10869
|
| Default base branch | `master` (declared in `nx.json` `defaultBase`) |
|
|
10872
10870
|
| Git integration | Vercel Git Integration |
|
|
10873
|
-
| Package manager | `npm
|
|
10874
|
-
| Workspace orchestrator | Nx
|
|
10871
|
+
| Package manager | `npm` (pinned in root `package.json` `packageManager`) |
|
|
10872
|
+
| Workspace orchestrator | Nx |
|
|
10875
10873
|
|
|
10876
10874
|
#### 8.6.2.2 Build Environment Requirements
|
|
10877
10875
|
|
|
10878
|
-
| Component |
|
|
10879
|
-
|
|
10880
|
-
| Node.js |
|
|
10881
|
-
| npm |
|
|
10882
|
-
| Nx CLI |
|
|
10883
|
-
| Supabase CLI (optional, for DB deploys) |
|
|
10876
|
+
| Component |
|
|
10877
|
+
| :-- |
|
|
10878
|
+
| Node.js |
|
|
10879
|
+
| npm |
|
|
10880
|
+
| Nx CLI |
|
|
10881
|
+
| Supabase CLI (optional, for DB deploys) |
|
|
10884
10882
|
|
|
10885
10883
|
#### 8.6.2.3 Nx Workspace Plugin Graph
|
|
10886
10884
|
|
|
10887
10885
|
The `nx.json` registers six plugins that together compose the build graph:
|
|
10888
10886
|
|
|
10889
|
-
| Plugin |
|
|
10890
|
-
|
|
10891
|
-
| `@nx/next/plugin` | `
|
|
10892
|
-
| `@nx/eslint/plugin` | `
|
|
10893
|
-
| `@nx/react/router-plugin` |
|
|
10894
|
-
| `@nx/vite/plugin` | `
|
|
10895
|
-
| `@nx/vitest` | `
|
|
10896
|
-
| `@nx/esbuild` | `
|
|
10887
|
+
| Plugin | Inferred Targets |
|
|
10888
|
+
| :-- | :-- |
|
|
10889
|
+
| `@nx/next/plugin` | `build`, `dev`, `start`, `serve-static`, `build-deps`, `watch-deps` |
|
|
10890
|
+
| `@nx/eslint/plugin` | `lint` |
|
|
10891
|
+
| `@nx/react/router-plugin` | router-related targets |
|
|
10892
|
+
| `@nx/vite/plugin` | `build`, `preview`, `serve`, `test` |
|
|
10893
|
+
| `@nx/vitest` | `test` (`testTargetName: "test"`) |
|
|
10894
|
+
| `@nx/esbuild` | `esbuild` executor with cache |
|
|
10897
10895
|
|
|
10898
10896
|
Key Nx configuration elements:
|
|
10899
10897
|
|
|
@@ -10919,26 +10917,26 @@ The workspace operates two build pipelines in parallel:
|
|
|
10919
10917
|
|
|
10920
10918
|
**Key build tool versions** (from `package.json`):
|
|
10921
10919
|
|
|
10922
|
-
| Tool |
|
|
10923
|
-
|
|
10924
|
-
| `vite` |
|
|
10925
|
-
| `vite-plugin-dts` |
|
|
10926
|
-
| `@vitejs/plugin-react` |
|
|
10927
|
-
| `vite-tsconfig-paths` |
|
|
10928
|
-
| `esbuild` |
|
|
10929
|
-
| `@swc/core` |
|
|
10930
|
-
| `@babel/core` |
|
|
10931
|
-
| `typescript` |
|
|
10932
|
-
| `dotenv` |
|
|
10933
|
-
| `dotenv-cli` |
|
|
10934
|
-
| `cross-env` |
|
|
10920
|
+
| Tool |
|
|
10921
|
+
| :-- |
|
|
10922
|
+
| `vite` |
|
|
10923
|
+
| `vite-plugin-dts` |
|
|
10924
|
+
| `@vitejs/plugin-react` |
|
|
10925
|
+
| `vite-tsconfig-paths` |
|
|
10926
|
+
| `esbuild` |
|
|
10927
|
+
| `@swc/core` |
|
|
10928
|
+
| `@babel/core` |
|
|
10929
|
+
| `typescript` |
|
|
10930
|
+
| `dotenv` |
|
|
10931
|
+
| `dotenv-cli` |
|
|
10932
|
+
| `cross-env` |
|
|
10935
10933
|
|
|
10936
10934
|
#### 8.6.2.5 Dependency Management
|
|
10937
10935
|
|
|
10938
10936
|
| Aspect | Implementation |
|
|
10939
10937
|
|:--|:--|
|
|
10940
10938
|
| Workspace protocol | `workspace:*` for internal packages (`@nextblock-cms/ui`, `@nextblock-cms/db`, `@nextblock-cms/editor`, `@nextblock-cms/sdk`, `@nextblock-cms/utils`) |
|
|
10941
|
-
| Version overrides | `glob
|
|
10939
|
+
| Version overrides | `glob`, `whatwg-encoding`, `node-domexception`, `keygrip` |
|
|
10942
10940
|
| Template transpilation | `transpilePackages: ['@nextblock-cms/utils', '@nextblock-cms/ui', '@nextblock-cms/editor']` in `apps/nextblock/next.config.js` |
|
|
10943
10941
|
| Local registry for testing | Verdaccio on port 4873 via root `project.json` |
|
|
10944
10942
|
| Public npm registry | `registry.npmjs.org` — default for all public packages |
|
|
@@ -10983,14 +10981,14 @@ Quality gates operate at build time only (no runtime tests in CI):
|
|
|
10983
10981
|
|
|
10984
10982
|
| Gate | Mechanism | Enforcement |
|
|
10985
10983
|
|:--|:--|:--|
|
|
10986
|
-
| Type safety | TypeScript `strict: true`
|
|
10987
|
-
| Code style | Prettier
|
|
10988
|
-
| Lint rules | ESLint flat config
|
|
10989
|
-
| Module boundaries | `@nx/enforce-module-boundaries`
|
|
10990
|
-
| Accessibility | `eslint-plugin-jsx-a11y`
|
|
10991
|
-
| React rules | `eslint-plugin-react
|
|
10992
|
-
| Next.js best practices | `eslint-config-next
|
|
10993
|
-
| Unit tests (optional) | Vitest
|
|
10984
|
+
| Type safety | TypeScript `strict: true` | Build fails on type error |
|
|
10985
|
+
| Code style | Prettier | IDE advisory / manual |
|
|
10986
|
+
| Lint rules | ESLint flat config | `npm run lint` |
|
|
10987
|
+
| Module boundaries | `@nx/enforce-module-boundaries` | Lint-time |
|
|
10988
|
+
| Accessibility | `eslint-plugin-jsx-a11y` | Lint-time |
|
|
10989
|
+
| React rules | `eslint-plugin-react`, `eslint-plugin-react-hooks` | Lint-time |
|
|
10990
|
+
| Next.js best practices | `eslint-config-next`, `@next/eslint-plugin-next` | Lint-time |
|
|
10991
|
+
| Unit tests (optional) | Vitest (6 tests in `libs/utils/tests/translation-workspace.test.ts`) | Developer-invoked |
|
|
10994
10992
|
| Vercel build | `nx build nextblock` | Build failure aborts deployment |
|
|
10995
10993
|
|
|
10996
10994
|
Note: the root `package.json` declares 51 scripts, **none of which match `test` or `spec`**; test execution is entirely developer-initiated.
|
|
@@ -11226,7 +11224,7 @@ Infrastructure monitoring is **intentionally minimal and platform-delegated**. N
|
|
|
11226
11224
|
|
|
11227
11225
|
| Pillar | Mechanism | Destination |
|
|
11228
11226
|
|:--|:--|:--|
|
|
11229
|
-
| Real User Monitoring | `@vercel/speed-insights
|
|
11227
|
+
| Real User Monitoring | `@vercel/speed-insights` via `<SpeedInsights nonce={nonce} />` in `app/layout.tsx` | Vercel Speed Insights dashboard |
|
|
11230
11228
|
| Client analytics | `@next/third-parties` `<GoogleTagManager gtmId={...} nonce={nonce} />` | Google Analytics via GTM |
|
|
11231
11229
|
| Server-side logging | Structured `console.warn` / `console.error` | Vercel log stream |
|
|
11232
11230
|
|
|
@@ -11350,7 +11348,7 @@ No dedicated alert manager is deployed. Alert pathways:
|
|
|
11350
11348
|
|
|
11351
11349
|
| Origin | Destination | Transport |
|
|
11352
11350
|
|:--|:--|:--|
|
|
11353
|
-
| CMS user feedback | `feedback@nextblock.dev` | `FeedbackModal` → `submitFeedback` → `nodemailer
|
|
11351
|
+
| CMS user feedback | `feedback@nextblock.dev` | `FeedbackModal` → `submitFeedback` → `nodemailer` → SMTP |
|
|
11354
11352
|
| Developer bug reports | `https://github.com/nextblock-cms/nextblock/issues` | Declared in root `package.json` `bugs.url` |
|
|
11355
11353
|
| Platform function failures | Vercel dashboard email/webhook | Vercel platform notification config |
|
|
11356
11354
|
| Database alerts | Supabase dashboard | Supabase platform notification config |
|
|
@@ -11468,7 +11466,7 @@ Documented gaps (per §6.4 and §6.5):
|
|
|
11468
11466
|
| Package name mismatch: `@nextblock-cms/ecom` (published) vs `@nextblock-cms/ecommerce` (workspace import) | Developer confusion | Import alias documented in §3.8 |
|
|
11469
11467
|
| Freemius webhook ack-only (no DB reconciliation) | Drift between Freemius state and local records | Manual reconciliation via Freemius dashboard |
|
|
11470
11468
|
| Postal-code shipping matching not consumed at runtime | Shipping logic incomplete | Feature pending |
|
|
11471
|
-
| `@vercel/analytics
|
|
11469
|
+
| `@vercel/analytics` declared but not imported | Page-view analytics not live | GTM provides substitute |
|
|
11472
11470
|
| No persistent audit log table | Forensic reconstruction relies on Vercel log retention | Content revisions table (partial) |
|
|
11473
11471
|
| No application-layer WAF/DDoS beyond Vercel | Abuse mitigation delegated | Platform defaults |
|
|
11474
11472
|
| MFA disabled by default | No two-factor in default config | Operator can re-enable in `config.toml` |
|
|
@@ -11492,10 +11490,10 @@ Documented gaps (per §6.4 and §6.5):
|
|
|
11492
11490
|
|
|
11493
11491
|
| API | Failure Classification | Source |
|
|
11494
11492
|
|:--|:--|:--|
|
|
11495
|
-
| Stripe (physical product checkout) | Critical path for commerce | `stripe
|
|
11496
|
-
| Freemius (digital licensing) | Best-effort (ack-only) | `@freemius/checkout
|
|
11493
|
+
| Stripe (physical product checkout) | Critical path for commerce | `stripe` |
|
|
11494
|
+
| Freemius (digital licensing) | Best-effort (ack-only) | `@freemius/checkout`, `@freemius/sdk` |
|
|
11497
11495
|
| Frankfurter FX (`api.frankfurter.dev`) | Best-effort (skipped currency telemetry) | Native `fetch` |
|
|
11498
|
-
| SMTP provider | Best-effort degrade | `nodemailer
|
|
11496
|
+
| SMTP provider | Best-effort degrade | `nodemailer` |
|
|
11499
11497
|
| Google Tag Manager | Observational | `@next/third-parties` |
|
|
11500
11498
|
|
|
11501
11499
|
### 8.9.3 Development Infrastructure Dependencies
|
|
@@ -11516,8 +11514,8 @@ Documented gaps (per §6.4 and §6.5):
|
|
|
11516
11514
|
|
|
11517
11515
|
| Resource | Minimum | Recommended |
|
|
11518
11516
|
|:--|:--|:--|
|
|
11519
|
-
| Node.js | Per Vitest
|
|
11520
|
-
| npm |
|
|
11517
|
+
| Node.js | Per Vitest + Nx compatibility (Node 20 LTS) | Node 20 LTS |
|
|
11518
|
+
| npm | | |
|
|
11521
11519
|
| Disk | ~10 GB for `node_modules` + `dist` + `.next` + Supabase local | SSD recommended |
|
|
11522
11520
|
| Memory | 8 GB | 16 GB+ |
|
|
11523
11521
|
| CPU | Single-core sufficient for 6-test Vitest suite | Multi-core for parallel Nx builds |
|
|
@@ -11546,7 +11544,7 @@ Operators should select tiers based on expected monthly active users, storage fo
|
|
|
11546
11544
|
- **Three managed platform providers** compose the production footprint: Vercel (app + edge + cron + RUM), Supabase (PostgreSQL 17 + Auth + Storage metadata), Cloudflare R2 (S3-compatible object storage).
|
|
11547
11545
|
- **Hybrid CI/CD** combines Vercel Git integration (for application deployment) with three Node.js release scripts under `tools/scripts/` (for library/CLI/DB releases).
|
|
11548
11546
|
- **Two Vercel cron schedules** in `vercel.json`: `/api/cron/reset-sandbox` at 03:00 UTC (60s max) and `/api/cron/sync-currencies` at 18:00 UTC (30s max).
|
|
11549
|
-
- **Infrastructure as Code is declarative**, distributed across `vercel.json`, `nx.json`, `libs/db/src/supabase/{migrations/, config.toml, templates/}`, `.env.
|
|
11547
|
+
- **Infrastructure as Code is declarative**, distributed across `vercel.json`, `nx.json`, `libs/db/src/supabase/{migrations/, config.toml, templates/}`, `.env.example`, and per-project `project.json` files.
|
|
11550
11548
|
- **Library publication uses a Twin Package Strategy** for `@nextblock-cms/ecom`: stub to public npm registry + real module to private GitHub Packages.
|
|
11551
11549
|
- **11 canonical SQL migrations** compose the database schema; re-running them from a fresh Supabase project deterministically reconstructs the system.
|
|
11552
11550
|
- **Monitoring is intentionally minimal**: Vercel Speed Insights for RUM, GTM for client analytics, structured `console.warn`/`console.error` logs for server-side events. No Prometheus/Grafana/Datadog/PagerDuty.
|
|
@@ -11583,15 +11581,15 @@ Operators should select tiers based on expected monthly active users, storage fo
|
|
|
11583
11581
|
|
|
11584
11582
|
**Files Examined**
|
|
11585
11583
|
|
|
11586
|
-
- `.env.
|
|
11584
|
+
- `.env.example` — Authoritative inventory of 40+ environment variables across 7 categories (Platform, Secrets, FX, Supabase, R2, SMTP, Stripe, Freemius)
|
|
11587
11585
|
- `vercel.json` — Declarative cron schedule definitions (2 crons: reset-sandbox at 03:00 UTC, sync-currencies at 18:00 UTC)
|
|
11588
|
-
- `package.json` (root) — Workspace identity (
|
|
11586
|
+
- `package.json` (root) — Workspace identity (`nextblock`), 51 npm scripts, Nx plugin versions, dependency overrides, `packageManager`
|
|
11589
11587
|
- `nx.json` — Workspace orchestration: 6 plugins, `defaultBase: master`, production named-input exclusions, `release.version.preVersionCommand`
|
|
11590
11588
|
- `apps/nextblock/next.config.js` — Image pipeline config, `compiler.removeConsole`, `transpilePackages`, dynamic `remotePatterns`, `turbopack.resolveAlias`
|
|
11591
11589
|
- `apps/nextblock/project.json` — Nx project descriptor (build / build-base / serve / start), tags `["app:nextblock", "scope:public"]`
|
|
11592
|
-
- `apps/nextblock/package.json` — `@nextblock-cms/template
|
|
11590
|
+
- `apps/nextblock/package.json` — `@nextblock-cms/template`, workspace dependencies, `@vercel/analytics` (declared but unused)
|
|
11593
11591
|
- `apps/nextblock/proxy.ts` — Edge runtime: Supabase session handling, nonce generation, RBAC `cmsRoutePermissions`, locale cookie
|
|
11594
|
-
- `apps/create-nextblock/package.json` — CLI identity (`create-nextblock`
|
|
11592
|
+
- `apps/create-nextblock/package.json` — CLI identity (`create-nextblock`), `commander`, `@clack/prompts`, `inquirer`, `execa`, `fs-extra`
|
|
11595
11593
|
- `.verdaccio/config.yml` — Local npm registry configuration (port 4873, `tmp/local-registry/storage`, `$all` perms, `allow_offline: true`)
|
|
11596
11594
|
- `tools/scripts/deploy-supabase.js` — Full Supabase deployment flow (link + db push + config push + auth sync)
|
|
11597
11595
|
- `tools/scripts/release-lib.js` — Library release pipeline: standard npm publish and Twin Package Strategy for ecom
|
|
@@ -11652,7 +11650,7 @@ This appendix catalogs supplementary reference material that supports the main b
|
|
|
11652
11650
|
|
|
11653
11651
|
### 9.1.1 Environment Variable Reference
|
|
11654
11652
|
|
|
11655
|
-
The following table enumerates environment variables declared in the `NodeJS.ProcessEnv` augmentation in `libs/environment.d.ts` and in the `.env.
|
|
11653
|
+
The following table enumerates environment variables declared in the `NodeJS.ProcessEnv` augmentation in `libs/environment.d.ts` and in the `.env.example` inventory. Variables prefixed with `NEXT_PUBLIC_` are exposed to the browser bundle; all others are server-only. Maintain all platform credentials in accordance with the Supabase, Cloudflare R2, Stripe, Freemius, and SMTP configuration contracts documented in Section 3.4.
|
|
11656
11654
|
|
|
11657
11655
|
| Variable | Category | Purpose |
|
|
11658
11656
|
|:--|:--|:--|
|
|
@@ -11783,15 +11781,15 @@ Reproduced from Section 4.12 for quick reference during operational work. Values
|
|
|
11783
11781
|
|
|
11784
11782
|
The workspace publishes the following libraries to the public npm registry. Version numbers reflect the state captured in Section 3.3 (Open Source Dependencies) and are advanced by `tools/scripts/release-lib.js`, which runs `npx nx run ${nxProject}:build --skip-nx-cache --with-deps`, bumps the version, and publishes to npm.
|
|
11785
11783
|
|
|
11786
|
-
| Package |
|
|
11787
|
-
|
|
11788
|
-
| `@nextblock-cms/ui` |
|
|
11789
|
-
| `@nextblock-cms/utils` |
|
|
11790
|
-
| `@nextblock-cms/db` |
|
|
11791
|
-
| `@nextblock-cms/editor` |
|
|
11792
|
-
| `@nextblock-cms/sdk` |
|
|
11793
|
-
| `@nextblock-cms/ecom` |
|
|
11794
|
-
| `create-nextblock` |
|
|
11784
|
+
| Package | Scope Tag | Role |
|
|
11785
|
+
| :-- | :-- | :-- |
|
|
11786
|
+
| `@nextblock-cms/ui` | `scope:public` | Design-system primitives |
|
|
11787
|
+
| `@nextblock-cms/utils` | `scope:public` | Cross-cutting helpers |
|
|
11788
|
+
| `@nextblock-cms/db` | `scope:public` | Supabase client factories |
|
|
11789
|
+
| `@nextblock-cms/editor` | `scope:public` | Tiptap-based editor |
|
|
11790
|
+
| `@nextblock-cms/sdk` | `scope:public` | Block and plugin SDK |
|
|
11791
|
+
| `@nextblock-cms/ecom` | `scope:premium` | Commerce library (stub/real Twin Package) |
|
|
11792
|
+
| `create-nextblock` | N/A (CLI) | Project scaffolding CLI |
|
|
11795
11793
|
|
|
11796
11794
|
Cross-reference: Section 3.3 (Open Source Dependencies), Section 8.11 (Summary and Cross-References).
|
|
11797
11795
|
|
|
@@ -12039,7 +12037,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12039
12037
|
|
|
12040
12038
|
**ER (Entity-Relationship) Model** — The relational schema captured in Section 6.2 (Database Design).
|
|
12041
12039
|
|
|
12042
|
-
**ESLint** — The JavaScript/TypeScript linter used in the workspace. ESLint
|
|
12040
|
+
**ESLint** — The JavaScript/TypeScript linter used in the workspace. ESLint flat config is enforced via `eslint.config.mjs` as a compile-time quality gate.
|
|
12043
12041
|
|
|
12044
12042
|
#### F
|
|
12045
12043
|
|
|
@@ -12073,7 +12071,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12073
12071
|
|
|
12074
12072
|
#### J
|
|
12075
12073
|
|
|
12076
|
-
**JSON Patch** — The diff format used in content revisioning via `fast-json-patch
|
|
12074
|
+
**JSON Patch** — The diff format used in content revisioning via `fast-json-patch`. See Section 6.2 (revisions hybrid snapshot/diff strategy).
|
|
12077
12075
|
|
|
12078
12076
|
#### L
|
|
12079
12077
|
|
|
@@ -12095,7 +12093,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12095
12093
|
|
|
12096
12094
|
**Nonce** — A single-use random token generated by `crypto.randomUUID()` in `proxy.ts` and attached to each CSP directive that permits inline scripts/styles.
|
|
12097
12095
|
|
|
12098
|
-
**Nx** — The monorepo orchestrator used
|
|
12096
|
+
**Nx** — The monorepo orchestrator used. See Section 3.2 and Section 5.3.
|
|
12099
12097
|
|
|
12100
12098
|
#### O
|
|
12101
12099
|
|
|
@@ -12129,7 +12127,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12129
12127
|
|
|
12130
12128
|
#### R
|
|
12131
12129
|
|
|
12132
|
-
**R2 (Cloudflare R2)** — The S3-compatible object storage service used for media. Accessed via `@aws-sdk/client-s3
|
|
12130
|
+
**R2 (Cloudflare R2)** — The S3-compatible object storage service used for media. Accessed via `@aws-sdk/client-s3`.
|
|
12133
12131
|
|
|
12134
12132
|
**RBAC (Role-Based Access Control)** — The authorization mechanism implemented via the `user_role` enum and `cmsRoutePermissions` in `proxy.ts`. See F-003.
|
|
12135
12133
|
|
|
@@ -12143,7 +12141,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12143
12141
|
|
|
12144
12142
|
**RPC (Remote Procedure Call)** — The primary inventory deduction path; invoked through a PostgreSQL stored procedure via `supabase.rpc()`.
|
|
12145
12143
|
|
|
12146
|
-
**RSC (React Server Components)** — The React
|
|
12144
|
+
**RSC (React Server Components)** — The React feature class in which the majority of NextBlock's pages render.
|
|
12147
12145
|
|
|
12148
12146
|
**RUM (Real User Monitoring)** — The observability approach implemented via Vercel Speed Insights.
|
|
12149
12147
|
|
|
@@ -12163,7 +12161,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12163
12161
|
|
|
12164
12162
|
**SLA (Service-Level Agreement)** — The formal commitment to a target metric. NextBlock's SLAs are codified in configuration files and summarized in Section 9.1.6.
|
|
12165
12163
|
|
|
12166
|
-
**SMTP (Simple Mail Transfer Protocol)** — The outbound email transport used via `nodemailer
|
|
12164
|
+
**SMTP (Simple Mail Transfer Protocol)** — The outbound email transport used via `nodemailer`. See Section 3.4.
|
|
12167
12165
|
|
|
12168
12166
|
**SSG (Static Site Generation)** — Next.js's build-time HTML generation.
|
|
12169
12167
|
|
|
@@ -12177,9 +12175,9 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12177
12175
|
|
|
12178
12176
|
#### T
|
|
12179
12177
|
|
|
12180
|
-
**Tailwind CSS** — The utility-first CSS framework
|
|
12178
|
+
**Tailwind CSS** — The utility-first CSS framework.
|
|
12181
12179
|
|
|
12182
|
-
**Tiptap** — The rich-text editor framework
|
|
12180
|
+
**Tiptap** — The rich-text editor framework underpinning F-005. Employs 40+ extensions.
|
|
12183
12181
|
|
|
12184
12182
|
**Translation Group ID** — A UUID linking language variants across pages, posts, products, and navigation items. See F-007.
|
|
12185
12183
|
|
|
@@ -12201,7 +12199,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12201
12199
|
|
|
12202
12200
|
**Vercel Speed Insights** — The RUM library (`@vercel/speed-insights`) loaded from the root layout to collect Core Web Vitals.
|
|
12203
12201
|
|
|
12204
|
-
**Vitest** — The JavaScript testing framework
|
|
12202
|
+
**Vitest** — The JavaScript testing framework integrated via the `@nx/vitest` plugin. See Section 6.6.
|
|
12205
12203
|
|
|
12206
12204
|
#### W
|
|
12207
12205
|
|
|
@@ -12211,7 +12209,7 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12211
12209
|
|
|
12212
12210
|
**WebP** — A modern image format generated by the NextBlock image pipeline alongside AVIF.
|
|
12213
12211
|
|
|
12214
|
-
**Workspace** — The Nx-managed repository defined by `nx.json`, `package.json` (as
|
|
12212
|
+
**Workspace** — The Nx-managed repository defined by `nx.json`, `package.json` (as `nextblock`), and `tsconfig.base.json`.
|
|
12215
12213
|
|
|
12216
12214
|
#### X
|
|
12217
12215
|
|
|
@@ -12219,13 +12217,13 @@ The glossary defines domain-specific, product-specific, and platform-specific te
|
|
|
12219
12217
|
|
|
12220
12218
|
#### Y
|
|
12221
12219
|
|
|
12222
|
-
**Yjs** — The CRDT library
|
|
12220
|
+
**Yjs** — The CRDT library underpinning collaborative editing surfaces.
|
|
12223
12221
|
|
|
12224
12222
|
#### Z
|
|
12225
12223
|
|
|
12226
12224
|
**Zod** — The TypeScript-first schema validation library used for per-block Zod schemas and form validation.
|
|
12227
12225
|
|
|
12228
|
-
**Zustand** — The state-management library
|
|
12226
|
+
**Zustand** — The state-management library used for cart state.
|
|
12229
12227
|
|
|
12230
12228
|
---
|
|
12231
12229
|
|
|
@@ -12431,7 +12429,7 @@ The appendices above synthesize material from the following sections of this spe
|
|
|
12431
12429
|
#### Primary Source Files Cross-Referenced by the Appendices
|
|
12432
12430
|
|
|
12433
12431
|
- `libs/environment.d.ts` — Typed `NodeJS.ProcessEnv` augmentation used to enumerate every environment variable listed in Section 9.1.1
|
|
12434
|
-
- `.env.
|
|
12432
|
+
- `.env.example` — Environment variable inventory and sample values cross-checked against the typed augmentation
|
|
12435
12433
|
- `libs/db/src/supabase/migrations/00000000000000_setup_foundation_and_enums.sql` — `user_role` enum definition
|
|
12436
12434
|
- `libs/db/src/supabase/migrations/00000000000002_setup_content_tables.sql` — `page_status`, `menu_location`, `revision_type` enum definitions
|
|
12437
12435
|
- `libs/db/src/supabase/migrations/00000000000003_setup_catalog_and_licensing.sql` — `product_type`, `payment_provider` enum definitions
|
|
@@ -12451,7 +12449,7 @@ The appendices above synthesize material from the following sections of this spe
|
|
|
12451
12449
|
- `libs/db/src/lib/package-validation.ts` — License gate `unstable_cache` TTL
|
|
12452
12450
|
- `vercel.json` — Cron schedule declarations
|
|
12453
12451
|
- `nx.json` — Scope tag topology and workspace orchestration
|
|
12454
|
-
- `package.json` (root) — Workspace identity (
|
|
12452
|
+
- `package.json` (root) — Workspace identity (`nextblock`) and dependency versions
|
|
12455
12453
|
- `tsconfig.base.json` — Path aliases and strict TypeScript configuration
|
|
12456
12454
|
- `eslint.config.mjs` — Flat config enforcing module boundaries and accessibility rules
|
|
12457
12455
|
- `tools/scripts/release-lib.js` — Library publication contract driving package versions in Section 9.1.7
|
|
@@ -12481,8 +12479,8 @@ The appendices above synthesize material from the following sections of this spe
|
|
|
12481
12479
|
- §2.1 Feature Catalog — F-001 through F-030 feature families
|
|
12482
12480
|
- §2.3 Feature Relationships — Dependency graph, integration points, shared components
|
|
12483
12481
|
- §2.4 Implementation Considerations — Performance, scalability, security targets
|
|
12484
|
-
- §3.1 Programming Languages — TypeScript
|
|
12485
|
-
- §3.2 Frameworks and Libraries — Next.js
|
|
12482
|
+
- §3.1 Programming Languages — TypeScript strict mode
|
|
12483
|
+
- §3.2 Frameworks and Libraries — Next.js, React, Nx, Tiptap, Yjs
|
|
12486
12484
|
- §3.3 Open Source Dependencies — Published library versions and Verdaccio
|
|
12487
12485
|
- §3.4 Third-Party Services — Supabase, R2, Stripe, Freemius, Frankfurter, SMTP, Vercel, GTM
|
|
12488
12486
|
- §3.5 Databases and Storage — PostgreSQL 17, eleven migrations, image pipeline
|