Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PledgeStack

npm version License: MIT

A full-stack React framework β€” like Next.js, but powered by PledgePack (Rust+Zig bundler) for maximum build performance.

Install

npm install pledgestack
# or
pnpm add pledgestack

The CLI command is pledge (not pledgestack). After installing, use:

npx pledge dev      # Start dev server
npx pledge build    # Build for production
npx pledge start    # Start production server

Vision

PledgeStack aims to be a production-grade full-stack React framework that uses PledgePack (a Rust+Zig bundler published on npm) for dramatically faster builds, HMR, and dev server. It follows familiar Next.js conventions (app directory, file-based routing, RSC, SSR/SSG/ISR) while being faster, leaner, and more opinionated.

Features (Implemented)

  • File-based routing β€” App directory with page.tsx, layout.tsx, route.ts, loading.tsx, error.tsx, not-found.tsx
  • Server-Side Rendering (SSR) β€” Server-rendered pages with layout chains, error boundaries, and Suspense loading states
  • Static Site Generation (SSG) β€” Pre-render pages at build time with generateStaticParams
  • React Server Components (RSC) β€” react-server-dom-webpack integration with streaming and client manifests
  • API Routes β€” File-based API handlers with GET, POST, PUT, DELETE, PATCH
  • Middleware β€” middleware.ts convention with redirect, rewrite, headers, and short-circuit
  • Edge Runtime β€” Edge handler for Cloudflare Workers, Vercel Edge, Deno Deploy
  • HMR β€” Dev server file watching with cache invalidation and module reloading
  • Tailwind CSS β€” Built-in Tailwind v4 + PostCSS pipeline
  • Server Utilities β€” cookies(), headers(), searchParams(), params(), redirect(), notFound(), after(), connection(), draftMode()
  • Data Fetching β€” cachedFetch() with force-cache, no-store, isr modes, tag-based revalidation
  • Metadata API β€” generateMetadata() export with OpenGraph, Twitter cards, canonical, icons
  • Client Routing β€” useRouter(), Link with hover prefetch, scroll restoration, replace/scroll options
  • TypeScript β€” First-class TypeScript with project references and end-to-end type safety
  • PledgePack β€” Rust+Zig bundler with dev server, HMR, Oxc transforms, JS plugins (Boa engine), and built-in test runner (npm: pledgepack) β€” used to build user apps, not the framework itself
  • Rust Native Addons β€” 8 NAPI addon crates (rust-html, rust-ssr, rust-rsc, rust-html-transformer, rust-dom-renderer, rust-rsc-deserializer, rust-ssr-profiler, rust-hydration) compiled via Cargo workspace, with automatic JS fallback when not compiled
  • PSX Integrations with JS Fallbacks β€” 15 Rust crate wrappers (SQLx, Redis, Auth, Image, PDF, Jobs, Cron, Email, HTTP, WebSocket, File Processing, Tracing, Crypto, ML) that gracefully degrade to Node.js packages when native addons are unavailable
  • PSX Audit Logging β€” PsxAuditLogger wraps Rust calls with sanitized args, execution time, route tagging via AsyncLocalStorage, file rotation, and sample rate support
  • PSX CI/CD Pipeline β€” GitHub Actions workflow with cargo audit, cargo clippy, cargo fmt, cross-compile for 6 targets, bundle analysis, and Vitest
  • PSX Production Checklist β€” pledge doctor --production checks Rust toolchain, Cargo.lock, LTO, debug symbols, stripped addons, env vars
  • PSX Bundle Analysis β€” pledge analyze CLI with per-module .node size breakdown, crate alternative suggestions, and build-to-build size tracking
  • Test Suite β€” 100+ tests covering all render modules, PSX integrations, audit logging, and bundle analysis using Vitest

Monorepo Structure

pledgestack/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ shared/              # Shared types, config, constants (private β€” bundled into CLI)
β”‚   β”œβ”€β”€ core/                # Framework core β€” routing, rendering, FS scanner (private)
β”‚   β”œβ”€β”€ server/              # Node.js + Edge server runtime (private)
β”‚   β”œβ”€β”€ client/              # Client-side hydration + routing (private)
β”‚   β”œβ”€β”€ auth/                # Authentication & security helpers (private)
β”‚   β”œβ”€β”€ state/               # State management (private)
β”‚   β”œβ”€β”€ api/                 # API route utilities (private)
β”‚   β”œβ”€β”€ a11y/                # Accessibility audit tools (private)
β”‚   β”œβ”€β”€ overlay/             # Error overlay & DevTools (private)
β”‚   β”œβ”€β”€ seo/                 # SEO & structured data (private)
β”‚   β”œβ”€β”€ sitemap/             # Sitemap generation (private)
β”‚   β”œβ”€β”€ image/               # Image optimization (private)
β”‚   β”œβ”€β”€ font/                # Font optimization (private)
β”‚   β”œβ”€β”€ mdx/                 # MDX support (private)
β”‚   β”œβ”€β”€ og/                  # OpenGraph image generation (private)
β”‚   β”œβ”€β”€ rss/                 # RSS feed generation (private)
β”‚   β”œβ”€β”€ ws/                  # WebSocket support (private)
β”‚   β”œβ”€β”€ adapters/            # Cloudflare, Vercel, Deno, AWS, Netlify adapters (private)
β”‚   β”œβ”€β”€ privacy/             # GDPR/CCPA compliance, PII redaction, encryption, consent (private)
β”‚   β”œβ”€β”€ bundler-pledgepack/  # PledgePack bundler adapter (private)
β”‚   β”œβ”€β”€ bundler-vite/        # Vite bundler adapter (private)
β”‚   β”œβ”€β”€ bundler-rollup/      # Rollup bundler adapter (private)
β”‚   β”œβ”€β”€ bundler-turbopack/   # Turbopack bundler adapter (private)
β”‚   β”œβ”€β”€ bundler-rsbuild/     # Rsbuild bundler adapter (private)
β”‚   β”œβ”€β”€ bundler-webpack/     # Webpack bundler adapter (private)
β”‚   β”œβ”€β”€ cli/                 # CLI tool β€” published as `pledgestack` on npm
β”‚   β”œβ”€β”€ vscode-extension/    # VS Code extension β€” highlighting, IntelliSense
β”‚   └── create-pledge-app/   # Scaffolding CLI for new PledgeStack apps
β”œβ”€β”€ apps/
β”‚   └── playground/          # Example app for development
β”œβ”€β”€ examples/                # Starter templates (blog, tailwindcss, auth, api-routes)
β”œβ”€β”€ test/                    # Test suites (unit, integration, e2e)
β”œβ”€β”€ scripts/                 # Release, benchmark, workspace check scripts
β”œβ”€β”€ docs/                    # Numbered documentation directories
β”œβ”€β”€ pledge.config.ts         # Framework config (defineConfig from 'pledgestack')
└── pnpm-workspace.yaml

PledgePack is installed from npm (pledgepack@^0.1.8), not as a workspace package. CLI command: pledge.

Only the pledgestack package (CLI) is published to npm. All sub-packages are bundled into it via esbuild and marked as private. The framework itself uses esbuild to bundle the CLI package for npm publish β€” PledgePack is used to bundle user apps (the projects created with pledge create).

Getting Started

# Create a new project
npx pledge create my-app
cd my-app
npm install

# Start dev server
npx pledge dev

# Build for production
npx pledge build

# Start production server
npx pledge start

App Directory Conventions

app/
β”œβ”€β”€ layout.tsx          # Root layout (wraps all pages)
β”œβ”€β”€ page.tsx            # Home page (/)
β”œβ”€β”€ about/
β”‚   └── page.tsx        # About page (/about)
β”œβ”€β”€ blog/
β”‚   β”œβ”€β”€ layout.tsx      # Blog section layout
β”‚   β”œβ”€β”€ page.tsx        # Blog listing (/blog)
β”‚   └── [slug]/
β”‚       └── page.tsx    # Blog post (/blog/:slug)
β”œβ”€β”€ api/
β”‚   └── hello/
β”‚       └── route.ts    # API endpoint (/api/hello)
β”œβ”€β”€ loading.tsx         # Loading UI (Suspense fallback)
β”œβ”€β”€ error.tsx           # Error boundary (per-segment)
└── not-found.tsx       # 404 page

Roadmap β€” 305 Goals Across 30 Phases (253 Complete)

Full roadmap with progress tracking: docs/05-community/roadmap.md

Phase 1: Core Runtime (1–10) βœ…

Install, dev server, SSR, API routes, middleware, 404, HMR, server utilities β€” complete.

Phase 2: Routing & Conventions (11–20) βœ…

head.tsx, template.tsx, Pledge System, Server Actions, RSC streaming, parallel/intercepting routes, route groups, selective hydration, page transitions β€” complete.

Phase 3: Data & Caching (21–28) βœ…

Request context, revalidation, generateStaticParams, route config, ISR, RSC data fetching, cookie variants, fetch cache β€” complete.

Phase 4: Developer Experience (29–38) βœ…

Fast Refresh, error overlay, create/info/doctor commands, env vars, ESLint plugin, CI, VS Code extension, dev toolbar β€” complete.

Phase 5: Framework Maturity (39–46) βœ…

loading.tsx, error.tsx, middleware API, streaming responses, static export, custom error pages, i18n, route prefetching β€” complete.

Phase 6: Framework API Completeness (47–58) βœ…

Docker, standalone output, health checks, graceful shutdown, redirect(), notFound(), global-error.tsx, instrumentation.ts, after(), connection(), viewport export, middleware matcher β€” complete.

Phase 7: Framework APIs (59–66) βœ…

useActionState, server-only/client-only markers, per-route runtime config, Link prefetch strategies, revalidateTag/revalidatePath top-level, unstable_cache expose, route handler methods, headers()/cookies() mutation β€” complete.

Phase 8: Testing & Quality (67–74) βœ…

Unit tests, integration tests, E2E (Playwright), snapshot tests, benchmarks, bundle size budget, type safety audit, lint rule coverage β€” complete.

Phase 9: Ecosystem & Integrations (75–84) βœ…

Plugin system, auth, database adapters, image/font optimization, MDX, OG images, sitemaps, RSS, WebSocket β€” complete.

Phase 10: Edge & Serverless (85–90) βœ…

Cloudflare, Vercel Edge, Deno Deploy, AWS Lambda, Netlify, edge bundles β€” complete.

Phase 11: Observability & Debugging (91–95) βœ…

Structured logging, OpenTelemetry, dev profiler, cache inspector, route inspector β€” complete.

Phase 12: Documentation & Community (96–99) βœ…

Interactive tutorial, API reference auto-generation (TypeDoc), migration guide, example gallery (20+ examples) β€” complete.

Phase 13: Security Hardening (100–116) βœ…

CSP, security headers, XSS, CSRF, path traversal, clickjacking, MIME, DNS rebinding, ReDoS, Trusted Types, cross-origin isolation, CORP/COEP, referrer policy, permissions policy β€” complete.

Phase 14: Authentication & Authorization (117–126) βœ…

OAuth 2.1, session management, JWT, TOTP/2FA, WebAuthn, RBAC, ABAC, API keys, SAML SSO, audit log β€” complete.

Phase 15: Performance & Optimization (127–138) βœ…

Concurrent rendering, streaming SSR, edge cache, lazy loading, resource hints, ETag, connection pooling, query memo, image/font optimization, bundle budgets, Web Vitals β€” complete.

Phase 16: Supply Chain & Dependency Security (139–146) βœ…

Dependency audit CI, SBOM, license compliance, pinned deps, provenance attestation, Sigstore signing, dependency allowlist, secret scanning β€” complete.

Phase 17: Privacy & Compliance (147–156) βœ…

GDPR, CCPA, PII redaction, encryption, consent, data retention, compliance docs β€” complete.

Phase 18: Observability & Monitoring (157–166) βœ…

Structured JSON logging, distributed tracing, metrics export, error tracking (Sentry/Bugsnag), health check, graceful shutdown, request ID, slow request detection, cache logging, real-time dev profiler β€” complete.

Phase 19: Developer Safety Net (167–176) βœ…

Input validation, output serialization, rate limiting, bot detection, brute force protection, secure defaults, security lint rules, env types, error boundary telemetry, dev security warnings β€” complete.

Phase 20: Edge & Runtime Security (177–184) βœ…

Edge secrets, rate limiting, auth validation, CSP generation, geo-restriction, bot mitigation, cold start optimization, timeout enforcement β€” complete.

Phase 21: API & Data Security (185–194) βœ…

Schema validation, response typing, SQL/NoSQL injection prevention, SSRF, body limits, file uploads, GraphQL security, WS auth, API key rotation β€” complete.

Phase 22: PSX Format Foundation (195–205) βœ…

Rust workspace management, crate auto-detection, batch API, binary protocol (PSXB), Rust SSR, fallback support β€” complete.

Phase 23: PSX Format Maturity (206–220) β€” In Progress

Source maps βœ…, HMR βœ…, error mapping βœ…, println! bridge βœ…, cargo profiles βœ…, test runner βœ…, crate pinning βœ…, lint rules βœ…, cross-compilation βœ…, dead code elimination βœ…, fmt integration βœ…. Remaining: syn-based parser (#206), VS Code extension (#209), PSX debugger (#212), incremental compilation cache (#214).

Phase 24: Developer Experience & Tooling (221–235) βœ…

Route types, type-safe navigation, path aliases, env-aware config, route conflict detection, storybook, playground, codemods, plugin docs, dev overlay, upgrade command, streaming metadata, pledge clean, pledge init, pledge why β€” complete.

Phase 25: Native Rendering Pipeline (236–245) βœ…

Rust SSR for dynamic pages, RSC payload generation in Rust, HTML template engine, streaming HTML transformer, React DOM string renderer in Rust, hybrid SSR orchestration, RSC client deserializer in Rust, PPR via Rust SSR, SSR profiling with flamegraphs, native hydration script generator β€” complete.

Phase 26: Data & State Advanced (246–255) βœ…

useInfiniteQuery, usePaginatedQuery, optimistic updates, server-side prefetching, mutation queue, offline-first data layer, real-time useSubscription(), selective cache invalidation, cross-tab sync, Rust-backed useRustQuery() β€” complete.

Phase 27: PSX Ecosystem & Integrations (256–270) βœ…

SQLx compile-time queries, Sea-ORM integration, Redis integration, Rust auth helpers (Argon2/JWT), Rust image processing, Rust PDF generation, Rust background jobs (apalis), Rust cron scheduler, Rust email sending (lettre), Rust HTTP client (reqwest), Rust WebSocket server, Rust file processing (Excel/CSV), Rust observability (tracing/OpenTelemetry), Rust crypto helpers (AES-GCM/SHA-256), Rust ML inference (candle-core/ort) β€” complete.

License

MIT Β© 2025 PledgeStack Contributors

About

A production-grade full-stack React framework that unifies the best of Next.js, Remix, Astro, and Vite into one platform. App-directory routing, RSC streaming, SSR/SSG/ISR, edge deployment, and instant HMR powered by PledgePack, a Rust+Zig bundler for dramatically faster builds. One framework, every advantage.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages