Introduction to Dinou
A transparent, lightweight, and 100% ejectable React 19 framework. Built on web standards with intuitive file-system routing, predictable caching, and multi-runtime freedom.
1. Quick Start in 30 Seconds
The fastest way to get started with Dinou is using the official CLI starter:
# Create a new project with the interactive wizard
npx create-dinou@latest my-app
# or
npm create dinou@latest my-app
# Navigate to project and launch dev server
cd my-app
npm run devhttp://localhost:3000 with zero-fork in-process execution, WebSocket HMR, and instant CSS reload.2. Core Capabilities
Dinou provides a complete, modern toolchain focused on clarity, performance, and developer freedom:
- Components render on the server by default with zero client JavaScript overhead.
- Native support for Server Actions and Server Functions (
'use server'). - Direct integration with React 19 Suspense streaming for fast, progressive UI delivery.
- Seamlessly call asynchronous server functions directly from client components (
'use client') wrapped inside<Suspense>boundaries. - Eliminates boilerplate API routes, manual
fetchcalls, and manual loading state management. - The server executes the logic and streams the response directly to the client fallback.
- Routes are pre-rendered statically by default (SSG) for maximum performance and instant CDN delivery, with
getStaticPathspre-generating known dynamic routes at build time. - On-Demand Incremental Static Generation (ISG): Unseen dynamic parameters are generated and cached on first request by default (configurable globally via
allowISGindinou.config.*or per segment, paired withvalidateParams). - Incremental Static Regeneration (ISR) is declared simply with
revalidatein seconds (e.g.revalidate = 60) in companionpage_functions.tsorlayout_functions.tsfiles. - Live on-demand server rendering (SSR) activates whenever
revalidate = 0(or< 1) or server request APIs are read (while ClientuseSearchParams()preserves SSG/ISR/PPR/static-export cleanly), andgetPropspasses typed server data directly to your component.
- Horizontal layout caching: Layouts define their own TTLs via
layout_functions.tsand purge in O(1) viarevalidateLayout(), preserving layout state across route transitions without unmounting or re-rendering child trees. - Vertical component caching: Micro-cache expensive Server Components with
<DinouCacheSlot>(dinou/server), purge by tag viarevalidateTag(), and refresh individual slots in place from the client viarefreshSlot(). - Temporal segmentation — Partial Prerendering (PPR): Enabled globally in
dinou.config.tsor independently per layout/page segment, serving an instant cached static shell (~2.42ms TTFB) while dynamic components concurrently stream into<Suspense>holes (withnoDynamic()opt-out for static boundaries).
- Clean file structure inside
src/where only folders containingpage.tsxbecome URL routes—so active helper folders likesrc/components/stay clean without prefixes. - First-class support for nested layouts (
layout.tsxandreset_layout), dynamic segments ([slug], optional[[slug]], catch-all[...slug], optional catch-all[[...slug]]), route groups ((group)), and parallel routes (@slot). - Parked folders prefixed with
_(e.g._draft,_legacy) completely escape routing, bundlers, manifests, VFS, and Server Functions—letting you archive WIP or legacy routes safely insidesrc/.
"./dinou"- Automatic TypeScript route generation (
npx dinou typegen, synced live in dev and builds) emits.dinou/types/routes.d.tsand route-contextual./dinoumodules mapped seamlessly via TypeScriptrootDirs. - Import
Link,useRouter,ROUTE,PageProps,LayoutProps(with automatic sibling@slotprop inference),SlotProps,NotFoundProps,ErrorProps,PageFunctions, andLayoutFunctionsdirectly from"./dinou"with zero manual route string literals. - Compile-time dead-link detection, validated dynamic
paramsinterpolation, and strict relative navigation (to="sub"/from) with zero type-declaration overhead in client bundles.
- Deploy the exact same application code to Node.js servers, Netlify Functions v2 (AOT Dual-Bundle), Cloudflare Workers (with KV), Deno Deploy (with Deno KV), Bun, or single-file zero-dependency compiled native binaries (
build:node:compile,build:bun:compile,build:deno:compile). - Supports pure static site export (
dinou export-static→out/) with pre-rendered HTML and segmentedpage.rsc/layout.rscpayloads for GitHub Pages, Cloudflare Pages, AWS S3, or Surge—preserving SPA transitions without a server.
React 19 requires conflicting module conditions: "react-server" for Server Components vs. "browser" for SSR. Instead of spawning separate Node.js subprocesses via child_process.fork(), Dinou compiles both in a single in-memory process through a 3-pass pipeline:
- Pass A (RSC Engine): Bundles with
["react-server"]package export conditions, binding Server Functions and generating client reference descriptors. - Pass B (SSR Engine): Bundles with
["browser"]package export conditions, packagingreact-dom/server.edgeand client hydration manifests. - Pass C (Orchestration): Bridges RSC and SSR via standard W3C
ReadableStreamwith zero disk I/O and zero IPC serialization latency. - Deploy Anywhere: Halves memory consumption and enables native execution on serverless & edge runtimes (Cloudflare Workers, Netlify Functions v2, Deno, Bun) where process spawning is prohibited. Read architectural specification →
- Runs RSC and SSR inside a single unified Node.js process with an in-memory VFS, zero
child_process.fork()overhead, and persistent SWC transform caching. - Instant React Fast Refresh over WebSockets, FOUC-free live CSS replacement, automatic route type synchronization, and live hot-reload for
.env*,tsconfig.jsonaliases, anddinou.config.ts.
- Default to esbuild (
dinou dev,dinou build) for blazing-fast development bundling and lightning-quick compilation. - Switch seamlessly to Rollup (
dinou dev:rollup,dinou build:node:rollup) or Webpack (dinou dev:webpack,dinou build:node:webpack) with full feature parity across Tailwind v4, static media fingerprinting,tsconfigaliases, and the React Compiler (enabled by default in production across all three bundlers). - Powered by Dual-Mode Vendoring: 31 pre-bundled ESM toolchain packages for instant cold starts, or pass
-u/--unvendorizedto resolve directly fromnode_modules.
- Run
npx dinou eject(ornpm run eject) at any time: Dinou copies its complete internal engine, adapters, and bundler pipelines into./dinou/and rewrites your scripts selectively. - Inspect, customize, or recompile the 31 vendor bundles (
npm run build:vendors) with zero lock-in—and revert cleanly back tonode_modules/dinouanytime with transactionalnpm run uneject.
3. Why Dinou? Origin & Evolution
To understand Dinou, it helps to understand the real problem that sparked its creation.
Dinou started with a very concrete need in modern React development: calling Server Functions ('use server') wrapped in React Suspense directly from Client Components.
Other frameworks either did not support this pattern directly or required extra boilerplate—creating separate API routes, calling fetch manually, and managing isLoading state by hand in the client.
The initial mission of Dinou was simple and direct: build a clean execution engine where a Client Component could invoke an asynchronous Server Function naturally inside a standard React 19 <Suspense> boundary, letting React handle streaming and fallbacks the way it was designed to.
Dinou began as a focused Node.js and Express framework with file-system routing and Webpack, progressively expanding to support all three major bundlers (esbuild, Rollup, and Webpack), client-side soft navigation, and native React Flight stream deserialization.
A major architectural leap later replaced Express with standard Web APIs (Request, Response, ReadableStream), making Dinou deployable everywhere (Node.js, Bun, Deno, Cloudflare Workers, Netlify, and standalone binaries). Today, running on a pure ESM core with pre-bundled vendor dependencies, it delivers true orthogonal 3D Layered Segmentation—combining horizontal layout caching (layout_functions.ts), vertical component caching (<DinouCacheSlot>), and Partial Prerendering (PPR) simultaneously.
4. AI-Friendly by Design
In the era of AI coding assistants (such as Google Antigravity, Claude, ChatGPT, and Cursor), framework architecture must be re-evaluated. Large, monolithic frameworks with deeply nested proprietary abstractions require excessive context exploration and frequently lead to hallucinations when asking AI models to debug or extend application code.
Dinou is engineered to be readily analyzed, understood, and modified by both human developers and AI agents. Its engine is lean, transparent, and strictly adheres to standard React and web platform primitives.
While common needs like custom middlewares, request lifecycle hooks, and plugins are handled cleanly through dinou.config.ts (or dinou.config.js), Dinou offers an unmatched advantage for AI-assisted workflows:
- Immediate Context Comprehension: Because Dinou avoids layers of hidden macros and convoluted runtime indirection, coding assistants can ingest the entire execution flow in a single prompt, diagnosing errors deterministically without hallucinations.
- Reversible Ejection for Edge-Case Fixes & Customizations: In the rare scenario where your application encounters an internal engine bug or requires an unreleased low-level feature, running
npx dinou ejectcopies the complete, readable engine into./dinou/. Thanks to Dinou's lean codebase, an AI agent can ingest the internal engine in seconds, inspect the exact execution flow, and autonomously patch or extend it—and you can always revert cleanly back to npm withnpm run uneject.
5. Project Anatomy & Conventions
Dinou projects follow clean, predictable directory conventions. All application logic lives inside src/, while public assets are served directly from public/:
my-app/
├── public/ # Static root assets (served directly at /)
│ ├── favicon.ico
│ ├── robots.txt
│ └── site.webmanifest
├── src/
│ ├── page.tsx # Root page (/)
│ ├── layout.tsx # Root layout & shell
│ ├── layout_functions.ts # Independent layout data fetching & caching
│ ├── globals.css # Global styles & Tailwind
│ ├── components/ # Shared UI helpers (not routed: no page.tsx)
│ ├── _draft/ # 🚫 Parked folder (ignored by router & bundlers)
│ │ └── page.tsx # Excluded from routes, bundles & Server Functions
│ └── docs/
│ ├── page.tsx # /docs route (imports types/Link from "./dinou")
│ ├── page_functions.ts # Server data fetching, PPR & revalidate seconds
│ ├── layout.tsx # /docs nested layout & sidebar
│ └── [slug]/
│ ├── page.tsx # Dynamic segment (/docs/:slug)
│ └── page_functions.ts # getStaticPaths, allowISG, validateParams & ISR
├── dinou.config.ts # Optional AOT config (ppr, allowISG, reactCompiler, assetExtensions, storage, plugins)
├── dinou.setup.ts # Optional Line-1 pre-boot setup / polyfills
├── .env / .env.local # Server secrets & DINOU_PUBLIC_* client vars (auto-typed in routes.d.ts)
├── .dinou/ # Auto-generated build outputs (dist1/2/3), types & contextual ./dinou (gitignored)
├── package.json
└── tsconfig.json # Includes rootDirs: ["src", ".dinou/routes"]Any folder inside src/ prefixed with an underscore _ (such as _draft or _legacy) is completely excluded from Dinou's router, bundlers, manifests, VFS, and Server Functions (with a compile-time guard preventing active modules from importing from _*). Because only folders containing a page.tsx file become URL routes, active helper folders like src/components/ never need a leading underscore—reserving _ cleanly for parking work-in-progress or legacy routes.