Skip to content

SF-7: feat(datafn): add docs package#39

Merged
graphite-app[bot] merged 1 commit intodevfrom
codex/datafn-docs-pr
Mar 29, 2026
Merged

SF-7: feat(datafn): add docs package#39
graphite-app[bot] merged 1 commit intodevfrom
codex/datafn-docs-pr

Conversation

@thyaravind
Copy link
Copy Markdown
Member

@thyaravind thyaravind commented Mar 28, 2026

Summary

  • add the datafn/docs site from next
  • wire the root workspace and lockfile for the docs slice
  • include documentation content for DFQL, client/server usage, sync, storage, migrations, and CLI docs

Validation

  • cd packages/docs-theme && npm run build
  • cd datafn/docs && npm run build is currently blocked because Next resolves @superfunctions/docs-theme to workspace source files and then fails to resolve ./layout.js / ./config.js from that source path in this branch shape

Summary by cubic

Adds datafn/docs, a Next.js docs site using fumadocs-ui and @superfunctions/docs-theme, delivering comprehensive DataFn docs (DFQL, client/server, sync, storage, migrations, CLI). Satisfies SF-7.

  • New Features

    • New docs app at datafn/docs with app/ routes, global styles (imports @superfunctions/docs-theme/tokens.css), OG image, 404, root redirect, and footer attribution.
    • Theme integration via createBaseLayoutOptions/DocsRootLayout; GitHub edit links point to 21nCo/super-functions@dev.
    • Page actions: LLM copy and view options powered by /api/docs/raw/[...slug] (strict slug and path traversal checks); Mermaid MDX component.
  • Migration

    • Build steps: cd packages/docs-theme && npm run build; then cd datafn/docs && npm run build.
    • Current blocker: Next resolves @superfunctions/docs-theme to workspace source and can’t find built entrypoints; use a published/packed package or update resolution to built outputs until aliasing is fixed.

Written for commit 05f2b61. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation
    • Launched a comprehensive docs site with guides for client/server setup, DFQL, CLI, sync, storage, database adapters, security, and advanced topics
    • Added full API reference for core, client, and server packages plus many how‑to and migration guides
  • New Features
    • Docs UI enhancements: site layout, global styles, table of contents, 404 page, Open Graph image generation, Mermaid diagram support, and copy/view action controls
  • Bug Fixes / Chores
    • Updated docs packaging and build configuration for local dev and deployment

@linear
Copy link
Copy Markdown

linear bot commented Mar 28, 2026

SF-7 Datafn init

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Mar 28, 2026

Too many files changed for review. (132 files found, 100 file limit)

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @thyaravind, your pull request is larger than the review limit of 150000 diff characters

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d61224eb-2e95-4485-bd97-23315690673d

📥 Commits

Reviewing files that changed from the base of the PR and between 0d69586 and 05f2b61.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (132)
  • datafn/docs/.gitignore
  • datafn/docs/app/api/docs/raw/[...slug]/route.ts
  • datafn/docs/app/docs/[[...slug]]/page.tsx
  • datafn/docs/app/docs/layout.tsx
  • datafn/docs/app/global.css
  • datafn/docs/app/layout.config.tsx
  • datafn/docs/app/layout.tsx
  • datafn/docs/app/not-found.tsx
  • datafn/docs/app/opengraph-image.tsx
  • datafn/docs/app/page.tsx
  • datafn/docs/components/ai/page-actions.tsx
  • datafn/docs/components/mdx/mermaid.tsx
  • datafn/docs/content/docs/cli/drizzle-codegen.mdx
  • datafn/docs/content/docs/cli/generate.mdx
  • datafn/docs/content/docs/cli/index.mdx
  • datafn/docs/content/docs/cli/meta.json
  • datafn/docs/content/docs/cli/type-codegen.mdx
  • datafn/docs/content/docs/cli/validate.mdx
  • datafn/docs/content/docs/dfql/aggregations.mdx
  • datafn/docs/content/docs/dfql/filters.mdx
  • datafn/docs/content/docs/dfql/index.mdx
  • datafn/docs/content/docs/dfql/meta.json
  • datafn/docs/content/docs/dfql/mutations.mdx
  • datafn/docs/content/docs/dfql/pagination.mdx
  • datafn/docs/content/docs/dfql/queries.mdx
  • datafn/docs/content/docs/dfql/schema/fields.mdx
  • datafn/docs/content/docs/dfql/schema/index.mdx
  • datafn/docs/content/docs/dfql/schema/meta.json
  • datafn/docs/content/docs/dfql/schema/relations.mdx
  • datafn/docs/content/docs/dfql/schema/resources.mdx
  • datafn/docs/content/docs/dfql/schema/system-fields.mdx
  • datafn/docs/content/docs/dfql/search.mdx
  • datafn/docs/content/docs/dfql/select.mdx
  • datafn/docs/content/docs/dfql/sorting.mdx
  • datafn/docs/content/docs/dfql/transactions.mdx
  • datafn/docs/content/docs/documentation/advanced/change-tracking.mdx
  • datafn/docs/content/docs/documentation/advanced/debouncing.mdx
  • datafn/docs/content/docs/documentation/advanced/error-handling.mdx
  • datafn/docs/content/docs/documentation/advanced/guards.mdx
  • datafn/docs/content/docs/documentation/advanced/idempotency.mdx
  • datafn/docs/content/docs/documentation/advanced/meta.json
  • datafn/docs/content/docs/documentation/advanced/security.mdx
  • datafn/docs/content/docs/documentation/client/events.mdx
  • datafn/docs/content/docs/documentation/client/frameworks.mdx
  • datafn/docs/content/docs/documentation/client/kv.mdx
  • datafn/docs/content/docs/documentation/client/meta.json
  • datafn/docs/content/docs/documentation/client/mutations.mdx
  • datafn/docs/content/docs/documentation/client/queries.mdx
  • datafn/docs/content/docs/documentation/client/setup.mdx
  • datafn/docs/content/docs/documentation/client/signals.mdx
  • datafn/docs/content/docs/documentation/client/tables.mdx
  • datafn/docs/content/docs/documentation/client/transactions.mdx
  • datafn/docs/content/docs/documentation/concepts/capabilities.mdx
  • datafn/docs/content/docs/documentation/concepts/meta.json
  • datafn/docs/content/docs/documentation/concepts/multi-tenancy.mdx
  • datafn/docs/content/docs/documentation/concepts/overview.mdx
  • datafn/docs/content/docs/documentation/concepts/sharing-v2.mdx
  • datafn/docs/content/docs/documentation/database/adapters.mdx
  • datafn/docs/content/docs/documentation/database/drizzle.mdx
  • datafn/docs/content/docs/documentation/database/meta.json
  • datafn/docs/content/docs/documentation/database/transactions.mdx
  • datafn/docs/content/docs/documentation/index.mdx
  • datafn/docs/content/docs/documentation/meta.json
  • datafn/docs/content/docs/documentation/migrations/meta.json
  • datafn/docs/content/docs/documentation/migrations/spv2.mdx
  • datafn/docs/content/docs/documentation/plugins/client-search.mdx
  • datafn/docs/content/docs/documentation/plugins/custom-plugins.mdx
  • datafn/docs/content/docs/documentation/plugins/meta.json
  • datafn/docs/content/docs/documentation/plugins/overview.mdx
  • datafn/docs/content/docs/documentation/server/authorization.mdx
  • datafn/docs/content/docs/documentation/server/meta.json
  • datafn/docs/content/docs/documentation/server/observability.mdx
  • datafn/docs/content/docs/documentation/server/rate-limiting.mdx
  • datafn/docs/content/docs/documentation/server/rest-api.mdx
  • datafn/docs/content/docs/documentation/server/routes.mdx
  • datafn/docs/content/docs/documentation/server/setup.mdx
  • datafn/docs/content/docs/documentation/server/validation.mdx
  • datafn/docs/content/docs/documentation/server/websockets.mdx
  • datafn/docs/content/docs/documentation/storage/custom.mdx
  • datafn/docs/content/docs/documentation/storage/indexeddb.mdx
  • datafn/docs/content/docs/documentation/storage/memory.mdx
  • datafn/docs/content/docs/documentation/storage/meta.json
  • datafn/docs/content/docs/documentation/storage/overview.mdx
  • datafn/docs/content/docs/documentation/sync/clone-up.mdx
  • datafn/docs/content/docs/documentation/sync/clone.mdx
  • datafn/docs/content/docs/documentation/sync/cross-tab.mdx
  • datafn/docs/content/docs/documentation/sync/hydration.mdx
  • datafn/docs/content/docs/documentation/sync/meta.json
  • datafn/docs/content/docs/documentation/sync/offline-first.mdx
  • datafn/docs/content/docs/documentation/sync/overview.mdx
  • datafn/docs/content/docs/documentation/sync/pull-push.mdx
  • datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx
  • datafn/docs/content/docs/documentation/use-cases/meta.json
  • datafn/docs/content/docs/documentation/use-cases/sharing-patterns.mdx
  • datafn/docs/content/docs/index.mdx
  • datafn/docs/content/docs/meta.json
  • datafn/docs/content/docs/reference/client/config.mdx
  • datafn/docs/content/docs/reference/client/events.mdx
  • datafn/docs/content/docs/reference/client/meta.json
  • datafn/docs/content/docs/reference/client/mutation.mdx
  • datafn/docs/content/docs/reference/client/query.mdx
  • datafn/docs/content/docs/reference/client/signal.mdx
  • datafn/docs/content/docs/reference/client/storage.mdx
  • datafn/docs/content/docs/reference/client/svelte.mdx
  • datafn/docs/content/docs/reference/client/sync.mdx
  • datafn/docs/content/docs/reference/client/transport.mdx
  • datafn/docs/content/docs/reference/core/date.mdx
  • datafn/docs/content/docs/reference/core/errors.mdx
  • datafn/docs/content/docs/reference/core/filters.mdx
  • datafn/docs/content/docs/reference/core/hooks.mdx
  • datafn/docs/content/docs/reference/core/kv.mdx
  • datafn/docs/content/docs/reference/core/meta.json
  • datafn/docs/content/docs/reference/core/normalize.mdx
  • datafn/docs/content/docs/reference/core/schema.mdx
  • datafn/docs/content/docs/reference/core/search-provider.mdx
  • datafn/docs/content/docs/reference/core/types.mdx
  • datafn/docs/content/docs/reference/index.mdx
  • datafn/docs/content/docs/reference/meta.json
  • datafn/docs/content/docs/reference/server/config.mdx
  • datafn/docs/content/docs/reference/server/execution.mdx
  • datafn/docs/content/docs/reference/server/meta.json
  • datafn/docs/content/docs/reference/server/middleware.mdx
  • datafn/docs/content/docs/reference/server/routes.mdx
  • datafn/docs/content/docs/reference/server/websocket.mdx
  • datafn/docs/lib/source.ts
  • datafn/docs/next.config.mjs
  • datafn/docs/package.json
  • datafn/docs/postcss.config.mjs
  • datafn/docs/source.config.ts
  • datafn/docs/tsconfig.json
  • datafn/docs/vercel.json
  • package.json

📝 Walkthrough

Walkthrough

This PR adds a complete Next.js documentation site for DataFn: app layouts/pages (MDX rendering, metadata, OpenGraph image), numerous MDX documentation pages and manifests, client-side MDX helpers (Mermaid, action buttons), build/config files (Next, Tailwind/PostCSS, TypeScript, Vercel), and a raw-markdown API route plus fumadocs source loader.

Changes

Cohort / File(s) Summary
Docs content (MDX + manifests)
datafn/docs/content/docs/..., datafn/docs/content/docs/**/.../*.mdx, datafn/docs/content/docs/**/.../*.meta.json
Added comprehensive documentation pages and meta.json manifests for DFQL, CLI, concepts, documentation, sync, storage, database, plugins, reference sections, and many topic-level MDX files (hundreds of new docs).
Next.js app pages & layouts
datafn/docs/app/docs/[[...slug]]/page.tsx, datafn/docs/app/docs/layout.tsx, datafn/docs/app/layout.tsx, datafn/docs/app/page.tsx, datafn/docs/app/not-found.tsx, datafn/docs/app/opengraph-image.tsx
New dynamic docs route rendering MDX via fumadocs-ui, site root/layout with metadata and providers, redirect home to /docs, custom 404, and OG image generator (Edge).
Client components
datafn/docs/components/ai/page-actions.tsx, datafn/docs/components/mdx/mermaid.tsx
Added LLMCopyButton and ViewOptions (clipboard, cached fetch, external links) and a client-mounted Mermaid renderer with lazy import, caching, and theme-aware rendering.
Fumadocs source & loader
datafn/docs/lib/source.ts, datafn/docs/source.config.ts
Added docs source loader converting upstream docs to fumadocs source and MDX remark plugin (Mermaid) wiring.
Styling & global assets
datafn/docs/app/global.css, datafn/docs/app/layout.config.tsx, datafn/docs/tsconfig.json
Global CSS imports (Tailwind + docs theme tokens), git/gitConfig wiring for GitHub blob links, and TypeScript config for the docs app.
Build / tooling / package
datafn/docs/next.config.mjs, datafn/docs/postcss.config.mjs, datafn/docs/package.json, datafn/docs/vercel.json, package.json
Next/MDX config, PostCSS/Tailwind plugin, package.json for @datafn/docs (scripts/deps), Vercel build config, and monorepo workspace registration.
API route (raw MDX fetch)
datafn/docs/app/api/docs/raw/[...slug]/route.ts
New GET API route that securely reads markdown files from docs content by slug with path-traversal protections.
Vercel ignore
datafn/docs/.gitignore
Added .vercel entry to ignore Vercel artifacts.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Browser Client
    participant NextApp as Next.js App
    participant Source as Fumadocs Source
    participant Storage as MDX Files
    participant FumaUI as Fumadocs UI

    Client->>NextApp: GET /docs/some/path
    NextApp->>Source: getPage(params.slug)
    Source->>Storage: read MDX + meta (content/docs/*)
    Storage-->>Source: MDX body, toc, frontmatter
    Source-->>NextApp: page object { body, data, toc, path }
    NextApp->>FumaUI: render DocsLayout + MDX components
    FumaUI-->>NextApp: rendered HTML
    NextApp-->>Client: HTML response

    Note over Client,NextApp: Client clicks "Copy Markdown"
    Client->>NextApp: LLMCopyButton event (fetch markdownUrl)
    NextApp->>NextApp: fetch cached markdown -> copy to clipboard
    NextApp-->>Client: success feedback
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

Review effort 4/5

Poem

🐇 I nibble markdown by moonlit light,
Pages sprout wings and diagrams take flight,
Mermaid curls, copy buttons hum bright,
Docs stitched together — hops of delight!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/datafn-docs-pr

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add comprehensive DataFn documentation site with Fumadocs MDX

📝 Documentation ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add comprehensive datafn/docs documentation site with Fumadocs MDX configuration
• Include complete DFQL language reference covering queries, mutations, filters, aggregations,
  pagination, sorting, transactions, and schema definitions
• Document DataFn client setup, configuration, signals, queries, mutations, events, and framework
  adapters (Svelte, React, Vue, Solid, Angular)
• Document DataFn server setup, authorization, validation, rate limiting, WebSocket configuration,
  and database adapters (Drizzle, Memory, Custom)
• Document sync architecture including pull/push operations, offline-first model, clone/clone-up,
  hydration, and sharing permission lifecycle
• Document storage layer with adapter interface, IndexedDB and memory implementations, and custom
  adapter development
• Document advanced features including change tracking, error handling, security measures, guards,
  debouncing, and idempotency
• Document plugin system with before/after hooks and client search plugin
• Document multi-tenancy, capabilities system (timestamps, audit, trash, archivable, shareable), and
  sharing permissions v2 (SPV2)
• Add AI-powered page action components for copying markdown and accessing external tools (GitHub,
  Scira, ChatGPT, Claude, Cursor)
• Configure global styling with Tailwind CSS and Fumadocs UI theme
• Set up TypeScript configuration with path aliases for documentation build
Diagram
flowchart LR
  A["datafn/docs<br/>Documentation Site"] --> B["Fumadocs MDX<br/>Configuration"]
  A --> C["Content<br/>Documentation"]
  A --> D["Components<br/>AI Actions"]
  B --> E["source.config.ts<br/>MDX Setup"]
  B --> F["lib/source.ts<br/>Loader"]
  C --> G["DFQL<br/>Language Ref"]
  C --> H["Client<br/>Setup & API"]
  C --> I["Server<br/>Setup & API"]
  C --> J["Sync<br/>Architecture"]
  C --> K["Storage<br/>Layer"]
  C --> L["Advanced<br/>Features"]
  D --> M["LLMCopyButton<br/>ViewOptions"]
Loading

Grey Divider

File Changes

1. datafn/docs/source.config.ts ⚙️ Configuration changes +12/-0

Fumadocs MDX configuration for docs source

• Configures Fumadocs MDX documentation source with defineDocs() pointing to content/docs
 directory
• Enables remarkMdxMermaid plugin for rendering Mermaid diagrams in MDX content
• Exports configuration for the documentation build system

datafn/docs/source.config.ts


2. datafn/docs/lib/source.ts ⚙️ Configuration changes +11/-0

Documentation source loader setup

• Loads documentation source from @/.source (generated from source.config.ts)
• Converts Fumadocs source to loader format with /docs base URL
• Exposes source object for page tree generation in layouts

datafn/docs/lib/source.ts


3. datafn/docs/app/global.css ⚙️ Configuration changes +6/-0

Global CSS imports for docs styling

• Imports Tailwind CSS and Fumadocs UI theme stylesheets
• Imports shared theme tokens from @superfunctions/docs-theme package
• Establishes global styling foundation for documentation site

datafn/docs/app/global.css


View more (128)
4. datafn/docs/components/ai/page-actions.tsx ✨ Enhancement +244/-0

AI-powered page action components for docs

• Implements LLMCopyButton component to copy page markdown content to clipboard with caching
• Implements ViewOptions popover component with links to GitHub, Markdown view, and AI assistants
 (Scira, ChatGPT, Claude, Cursor)
• Provides convenient access to external tools for documentation content

datafn/docs/components/ai/page-actions.tsx


5. datafn/docs/content/docs/dfql/schema/relations.mdx 📝 Documentation +526/-0

Complete relations schema and query documentation

• Comprehensive documentation of DataFn relation types: one-many, many-one, many-many, and
 htree (hierarchical tree)
• Documents relation capabilities (timestamps, audit), metadata fields, and payload
 normalization
• Covers querying relations with select tokens, quantifier filters ($any, $all, $none), and
 mutation operations (relate, modifyRelation, unrelate)

datafn/docs/content/docs/dfql/schema/relations.mdx


6. datafn/docs/content/docs/documentation/concepts/multi-tenancy.mdx 📝 Documentation +346/-0

Multi-tenancy and namespace isolation guide

• Documents namespace-based row-level data isolation for multi-tenancy
• Explains ns() helper function for composing namespace strings with segment filtering
• Covers server-side namespaceProvider configuration, client-side namespace setup, and storage
 factory patterns

datafn/docs/content/docs/documentation/concepts/multi-tenancy.mdx


7. datafn/docs/content/docs/documentation/server/routes.mdx 📝 Documentation +477/-0

HTTP routes and server endpoints reference

• Documents all DataFn HTTP endpoints with request/response envelopes and examples
• Covers framework integration for TypeScript, FastAPI, and Starlette
• Details routes: /datafn/query, /datafn/mutation, /datafn/transact, /datafn/seed,
 /datafn/clone, /datafn/pull, /datafn/push, /datafn/status, /datafn/reconcile

datafn/docs/content/docs/documentation/server/routes.mdx


8. datafn/docs/content/docs/dfql/filters.mdx 📝 Documentation +312/-0

DFQL filters and query operators reference

• Documents DFQL filter operators: comparison, set, string, null/empty, range, and logical operators
• Explains operator normalization (with/without $ prefix) and shorthand syntax
• Covers relation quantifier filters ($any, $all, $none), dot-path filters, and programmatic
 filter evaluation

datafn/docs/content/docs/dfql/filters.mdx


9. datafn/docs/content/docs/documentation/server/setup.mdx 📝 Documentation +259/-0

Server setup and configuration guide

• Installation instructions for TypeScript and Python DataFn servers
• Comprehensive createDatafnServer() configuration reference with all options documented
• Covers authorization, namespacing, rate limiting, retention, observability, and graceful shutdown

datafn/docs/content/docs/documentation/server/setup.mdx


10. datafn/docs/content/docs/documentation/database/adapters.mdx 📝 Documentation +283/-0

Database adapter interface and implementation

• Documents database adapter interface for TypeScript and Python implementations
• Explains CRUD operations, transactions, namespace support, and where clause operators
• Lists available adapters (Drizzle, Memory, Custom) and internal table management

datafn/docs/content/docs/documentation/database/adapters.mdx


11. datafn/docs/content/docs/documentation/concepts/sharing-v2.mdx 📝 Documentation +171/-0

Sharing permissions v2 (SPV2) model documentation

• Documents SPV2 (Sharing Permissions v2) model with principal-based access control
• Explains principal hierarchy, membership resolution, and global permissions table schema
• Covers scope grants, relation inheritance, and legacy compatibility patterns

datafn/docs/content/docs/documentation/concepts/sharing-v2.mdx


12. datafn/docs/content/docs/documentation/concepts/capabilities.mdx 📝 Documentation +224/-0

Resource capabilities and lifecycle behaviors

• Documents DataFn capability model: timestamps, audit, trash, archivable, shareable
• Explains schema declaration, server-owned field stripping, and capability operations
• Covers query auto-filters, shareable configuration, and client API surface

datafn/docs/content/docs/documentation/concepts/capabilities.mdx


13. datafn/docs/content/docs/dfql/mutations.mdx 📝 Documentation +250/-0

DFQL mutations and write operations reference

• Documents DFQL mutation operations: core (insert, merge, replace, delete) and
 capability-aware operations
• Explains relation operations (relate, modifyRelation, unrelate) and mutation payload
 structure
• Covers guard clauses, batch mutations, and readonly capability field stripping

datafn/docs/content/docs/dfql/mutations.mdx


14. datafn/docs/app/docs/layout.tsx ⚙️ Configuration changes +31/-0

Documentation layout component setup

• Creates docs layout component using Fumadocs DocsLayout wrapper
• Configures sidebar with footer link to "21n.co" and base layout options
• Generates page tree from documentation source for navigation

datafn/docs/app/docs/layout.tsx


15. datafn/docs/content/docs/documentation/server/authorization.mdx 📝 Documentation +205/-0

Server Authorization and Field-Level Access Control Documentation

• Comprehensive guide on field-level authorization enforcement in DataFn server
• Covers permissions policy definition with read/write field lists per resource
• Details query and mutation authorization checks for all operation types
• Includes request-level authorization via authorize callback with TypeScript and Python examples
• Documents allowUnknownResources flag and debug mode error message redaction

datafn/docs/content/docs/documentation/server/authorization.mdx


16. datafn/docs/content/docs/documentation/client/setup.mdx 📝 Documentation +178/-0

DataFn Client Initialization and Configuration Guide

• Guide for creating and configuring DataFn client instances with createDatafnClient()
• Complete configuration reference for schema, clientId, storage, sync, and plugins
• Detailed sync configuration options including remote URL, WebSocket, offline mode, and hydration
• Storage adapter documentation with built-in MemoryStorageAdapter and IndexedDbStorageAdapter
• Framework integration overview and client lifecycle methods (destroy(), clear())

datafn/docs/content/docs/documentation/client/setup.mdx


17. datafn/docs/content/docs/documentation/server/validation.mdx 📝 Documentation +141/-0

Request Validation and Schema Compliance Checks Documentation

• Comprehensive validation documentation for queries and mutations against schema
• Query validation checks including resource/field existence, relation validation, and prototype
 pollution protection
• Mutation validation with operation types, ID prefix matching, and required field checks
• Configurable limits for select tokens, filter depth, sort fields, and payload size
• Batch validation and push validation with error collection and structured error codes

datafn/docs/content/docs/documentation/server/validation.mdx


18. datafn/docs/content/docs/documentation/advanced/change-tracking.mdx 📝 Documentation +197/-0

Change Tracking Service and Incremental Sync Architecture

• Architecture overview of ChangeTrackingService for recording mutations with monotonic
 serverSeq
• Multiple sequence store implementations including Redis, KV Store, and database CAS-based
 allocation
• Internal table schemas for __datafn_meta and __datafn_changes with column definitions
• Methods for recording, querying, and pruning change entries with retention management
• Transaction support via withDb() for atomic change recording within mutations

datafn/docs/content/docs/documentation/advanced/change-tracking.mdx


19. datafn/docs/content/docs/documentation/storage/custom.mdx 📝 Documentation +163/-0

Custom Storage Adapter Implementation Guide

• Complete DatafnStorageAdapter interface specification with all required methods
• Key implementation requirements including atomic mergeRecord, monotonic changelog sequences, and
 deduplication
• Detailed guidance on cursor persistence, deterministic ordering, and transaction support
• SQLite adapter skeleton example demonstrating interface implementation
• Registration patterns for direct instances and namespace-based factory functions

datafn/docs/content/docs/documentation/storage/custom.mdx


20. datafn/docs/content/docs/dfql/schema/fields.mdx 📝 Documentation +174/-0

DFQL Field Schema Types and Validation Constraints

• Complete field schema type definition with all constraint options
• Field types documentation including string, number, boolean, date, object, array, file, and json
• Constraint documentation for required, nullable, readonly, default, enum, min/max, pattern,
 unique, encrypt, and volatile
• Comprehensive example schema showing all field types and constraints in practice

datafn/docs/content/docs/dfql/schema/fields.mdx


21. datafn/docs/content/docs/dfql/search.mdx 📝 Documentation +206/-0

Full-Text Search Provider Integration and Configuration

• Provider-backed full-text search with local-first execution model for DFQL and cross-resource
 queries
• Search options including prefix matching, fuzzy matching, and field boosts
• Resource search within DFQL queries and cross-resource client.search() API
• Server-side /datafn/search endpoint with option parity
• Complete setup guide for SearchFn adapters with IndexedDB, memory, Meilisearch, and PostgreSQL
 backends

datafn/docs/content/docs/dfql/search.mdx


22. datafn/docs/content/docs/documentation/plugins/custom-plugins.mdx 📝 Documentation +243/-0

Custom DataFn Plugin Development and Hook Patterns

• Plugin structure implementing DatafnPlugin interface with optional hooks
• Before hook behavior with pass-through, transform, and rejection patterns
• After hook fail-open semantics with result transformation on server
• Hook utilities runBeforeHook and runAfterHook with environment filtering
• Three complete plugin examples: audit logging, email normalization, and query limit enforcement

datafn/docs/content/docs/documentation/plugins/custom-plugins.mdx


23. datafn/docs/content/docs/reference/client/config.mdx 📝 Documentation +206/-0

Complete DataFn Client Configuration Reference

• Complete DatafnClientConfig interface with all top-level configuration options
• Detailed DatafnSyncConfig with connection, mode, push tuning, hydration, and reconnection
 settings
• Hydration configuration for boot and background resources with per-resource page size mapping
• Storage factory pattern for namespace-based isolation with ns() helper
• SearchProvider interface for pluggable search backends with initialization and disposal hooks

datafn/docs/content/docs/reference/client/config.mdx


24. datafn/docs/content/docs/reference/core/search-provider.mdx 📝 Documentation +185/-0

SearchProvider Interface Contract and Implementation Guide

SearchProvider interface contract with required and optional members
• search() method for single-resource search with full-text and semantic modes
• searchAll() optional method for cross-resource ranked search
• updateIndices() for keeping search index current after mutations
• initialize() and dispose() lifecycle hooks with custom provider implementation example

datafn/docs/content/docs/reference/core/search-provider.mdx


25. datafn/docs/content/docs/reference/server/config.mdx 📝 Documentation +177/-0

Complete DataFn Server Configuration Reference

• Complete DatafnServerConfig interface with schema, database, plugins, and authorization
• Configurable limits for queries, mutations, and payload sizes with defaults table
• Retention configuration for change log and idempotency record pruning
• Rate limiting configuration with per-endpoint overrides and key extraction
• WebSocket manager configuration for connection limits and heartbeat settings

datafn/docs/content/docs/reference/server/config.mdx


26. datafn/docs/content/docs/reference/core/types.mdx 📝 Documentation +215/-0

Core Type Definitions and Interfaces Reference

• Capability types including simple capabilities, access levels, and shareable capability
 definitions
• Core schema types: DatafnSchema, DatafnResourceSchema, DatafnFieldSchema,
 DatafnRelationSchema
• Event types with DatafnEvent and DatafnEventFilter for mutation and sync events
• DatafnSignal<T> interface with reactive properties and lifecycle methods
• Plugin, limits, and permissions policy type definitions

datafn/docs/content/docs/reference/core/types.mdx


27. datafn/docs/content/docs/documentation/advanced/error-handling.mdx 📝 Documentation +194/-0

Structured Error Handling and Error Code Reference

• Comprehensive error code enumeration with descriptions for all DataFn error types
• DatafnError structure with code, message, and details fields
• DatafnEnvelope wrapper for success and failure responses with helper functions
• Client-side error handling with throwClientError and isTransportError utilities
• Error handling patterns for queries, mutations, and push operations with code examples

datafn/docs/content/docs/documentation/advanced/error-handling.mdx


28. datafn/docs/content/docs/dfql/aggregations.mdx 📝 Documentation +171/-0

DFQL Aggregation Queries and Grouped Result Computation

• Aggregation operations documentation: count, sum, min, max, avg with null semantics
• Basic aggregation with groupBy and aggregations mapping
• Multiple group keys for composite grouping and having clause for post-aggregation filtering
• Combining filters with aggregations and sorting aggregated results
• Pagination support and calculateAggregation utility function for programmatic use

datafn/docs/content/docs/dfql/aggregations.mdx


29. datafn/docs/content/docs/documentation/client/frameworks.mdx 📝 Documentation +154/-0

Framework Adapter Packages for UI Integration

• Framework adapter pattern overview converting DatafnSignal<T> to native reactive primitives
• Available adapters table with status for Svelte, React, Vue, Solid, and Angular
• Complete @datafn/svelte documentation with toSvelteStore() conversion and template usage
• State properties documentation (data, loading, error, refreshing, nextCursor)
• Planned API examples for React, Vue, Solid, and Angular adapters

datafn/docs/content/docs/documentation/client/frameworks.mdx


30. datafn/docs/content/docs/dfql/select.mdx 📝 Documentation +168/-0

DFQL Select Tokens and Relation Expansion Syntax

• Field selection with select and omit arrays with wildcard support
• Select token syntax for relation expansion: bare relation, relation.*, relation.#,
 relation.*#
• Nested relation expansion using dot notation for multi-level traversal
• Foreign key auto-omission when relations are expanded
• parseSelectToken() utility for decomposing select token strings into components

datafn/docs/content/docs/dfql/select.mdx


31. datafn/docs/content/docs/documentation/advanced/security.mdx 📝 Documentation +157/-0

Security Measures and Best Practices in DataFn

• Deny-by-default authorization with required permissions policies per resource
• Server-derived namespaces preventing client namespace spoofing
• Prototype pollution protection blocking __proto__, constructor, prototype keys
• Path traversal protection rejecting .., /, \ in resource names and IDs
• Sensitive field redaction, WebSocket authentication, error message redaction, and rate limiting

datafn/docs/content/docs/documentation/advanced/security.mdx


32. datafn/docs/content/docs/dfql/schema/resources.mdx 📝 Documentation +182/-0

DFQL Resource Schema Definition and Configuration

DatafnResourceSchema type definition with name, version, idPrefix, and capabilities
• Resource capability declarations with additive and exclusion patterns
• Index configuration for base, search, and vector indices
• Permissions policy with read/write field lists and optional ownerField
• Remote-only resources for server-side only data with isRemoteOnly: true

datafn/docs/content/docs/dfql/schema/resources.mdx


33. datafn/docs/content/docs/documentation/client/signals.mdx 📝 Documentation +164/-0

Reactive Signals for Auto-Refreshing Query Results

• Signal creation through table handles with lazy fetching on first subscribe
• DatafnSignal<T> interface with get(), subscribe(), and lifecycle properties
• Auto-refresh behavior on mutations with footprint derivation and optimistic patching
• Signal caching by normalized query key for referential stability
• Cursor-based pagination with nextCursor and framework integration via adapters

datafn/docs/content/docs/documentation/client/signals.mdx


34. datafn/docs/tsconfig.json ⚙️ Configuration changes +50/-0

TypeScript Configuration for Documentation Build

• TypeScript configuration for Next.js documentation site
• Path aliases for @/*, @superfunctions/docs-theme, and fumadocs-mdx:collections/*
• Compiler options targeting ES2017 with strict mode and JSX preservation
• Include patterns for TypeScript files and Next.js generated types

datafn/docs/tsconfig.json


35. datafn/docs/content/docs/documentation/concepts/overview.mdx 📝 Documentation +113/-0

DataFn ecosystem architecture and concepts overview

• Introduces high-level overview of DataFn ecosystem with architecture diagram
• Explains DFQL protocol, client/server components, and framework adapters
• Documents sync model, multi-tenancy, and capabilities system

datafn/docs/content/docs/documentation/concepts/overview.mdx


36. datafn/docs/content/docs/documentation/sync/pull-push.mdx 📝 Documentation +164/-0

Incremental sync pull and push operations guide

• Details incremental synchronization with pull and push operations
• Explains pull request/response format and catch-up loop mechanism
• Documents push batching, idempotent deduplication, and retry backoff

datafn/docs/content/docs/documentation/sync/pull-push.mdx


37. datafn/docs/content/docs/documentation/advanced/guards.mdx 📝 Documentation +171/-0

Guards for conditional mutations and concurrency control

• Introduces guards for optimistic concurrency control with conditional mutations
• Explains guard evaluation, TOCTOU prevention, and filter syntax
• Provides use cases for stale updates, state machines, and double-processing prevention

datafn/docs/content/docs/documentation/advanced/guards.mdx


38. datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx 📝 Documentation +119/-0

Sharing permissions sync lifecycle and visibility changes

• Documents sharing permission changes through sync lifecycle
• Explains grant backfill, revoke tombstones, and actor feed mechanism
• Details bounded k-way merge and WebSocket principal-targeted invalidation

datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx


39. datafn/docs/content/docs/documentation/storage/overview.mdx 📝 Documentation +114/-0

Storage adapter interface and offline persistence layer

• Defines DatafnStorageAdapter interface with record, join row, and changelog operations
• Explains merge semantics, hydration state tracking, and storage factory pattern
• Lists available adapters (IndexedDB, Memory, Custom)

datafn/docs/content/docs/documentation/storage/overview.mdx


40. datafn/docs/content/docs/dfql/transactions.mdx 📝 Documentation +166/-0

DFQL transactions with atomic execution semantics

• Defines DFQL transaction structure with atomic semantics
• Explains mixing queries and mutations, response format, and step limits
• Documents database transaction support and error handling

datafn/docs/content/docs/dfql/transactions.mdx


41. datafn/docs/content/docs/documentation/index.mdx 📝 Documentation +149/-0

DataFn getting started and quick start guide

• Provides getting started guide with schema definition, server/client setup
• Demonstrates query, mutation, and reactive signal usage
• Lists capability operations and next steps for learning

datafn/docs/content/docs/documentation/index.mdx


42. datafn/docs/content/docs/documentation/database/drizzle.mdx 📝 Documentation +144/-0

Drizzle ORM database adapter configuration and usage

• Documents Drizzle ORM adapter for PostgreSQL, MySQL, SQLite
• Explains type mapping, namespace column handling, and CLI codegen
• Details internal tables, dialect-aware execution, and transaction support

datafn/docs/content/docs/documentation/database/drizzle.mdx


43. datafn/docs/content/docs/documentation/server/rate-limiting.mdx 📝 Documentation +166/-0

Server rate limiting with configurable backends

• Configures per-endpoint rate limiting with Redis and in-memory backends
• Explains key format, custom key extraction, and rate limit response
• Documents cleanup and graceful shutdown behavior

datafn/docs/content/docs/documentation/server/rate-limiting.mdx


44. datafn/docs/content/docs/documentation/plugins/overview.mdx 📝 Documentation +155/-0

Plugin system for extending DataFn operations

• Defines DatafnPlugin interface with before/after hooks for queries, mutations, sync
• Explains hook semantics (fail-closed vs fail-open) and environment filtering
• Documents plugin registration and execution order

datafn/docs/content/docs/documentation/plugins/overview.mdx


45. datafn/docs/content/docs/documentation/sync/overview.mdx 📝 Documentation +114/-0

Sync engine architecture and lifecycle overview

• Outlines sync engine lifecycle phases (seed, clone, pull, push, cloneUp, reconcile)
• Explains WebSocket real-time updates with exponential backoff reconnection
• Documents event-driven architecture and automatic trigger conditions

datafn/docs/content/docs/documentation/sync/overview.mdx


46. datafn/docs/content/docs/documentation/advanced/debouncing.mdx 📝 Documentation +140/-0

Debouncing rapid mutations for performance optimization

• Explains DebouncerMap for coalescing rapid mutations on same record
• Documents API methods (set, flush, flushAll, destroy) and record merging
• Provides examples for live text editing and slider controls

datafn/docs/content/docs/documentation/advanced/debouncing.mdx


47. datafn/docs/content/docs/documentation/server/websockets.mdx 📝 Documentation +130/-0

WebSocket real-time updates server configuration

• Configures WebSocket connections with authentication and namespace derivation
• Explains connection limits, heartbeat mechanism, and message types
• Documents namespace-scoped broadcast and graceful shutdown

datafn/docs/content/docs/documentation/server/websockets.mdx


48. datafn/docs/content/docs/documentation/database/transactions.mdx 📝 Documentation +144/-0

Database transactions for atomic operations

• Explains database transaction usage with adapter.transaction() callback
• Documents internal usage in transact endpoint, guard evaluation, and sequence store
• Details isolation levels, error handling, and limitations

datafn/docs/content/docs/documentation/database/transactions.mdx


49. datafn/docs/content/docs/documentation/client/events.mdx 📝 Documentation +149/-0

Client event bus and mutation/sync event subscriptions

• Documents EventBus with event types (mutation_applied, sync_applied, etc.)
• Explains DatafnEvent structure and subscription filtering
• Provides filter examples and fault-tolerant dispatch behavior

datafn/docs/content/docs/documentation/client/events.mdx


50. datafn/docs/content/docs/documentation/client/queries.mdx 📝 Documentation +144/-0

Client query API with filtering and pagination

• Covers basic queries, filters, sorting, pagination, and field selection
• Explains batch queries and intelligent query routing based on hydration state
• Documents full-text search and count queries

datafn/docs/content/docs/documentation/client/queries.mdx


51. datafn/docs/content/docs/documentation/client/mutations.mdx 📝 Documentation +160/-0

Client mutation API with core and capability operations

• Documents core mutations (insert, merge, replace, delete) and capability operations
• Explains batch mutations, field sanitization, and optimistic capability injection
• Covers context, silent/system flags, debouncing, and event emission

datafn/docs/content/docs/documentation/client/mutations.mdx


52. datafn/docs/content/docs/documentation/sync/offline-first.mdx 📝 Documentation +117/-0

Offline-first architecture and local-first data model

• Explains offline-first architecture with local-first reads and optimistic mutations
• Documents query routing based on hydration state and changelog as write-ahead log
• Details conflict resolution, push retry backoff, and online/offline detection

datafn/docs/content/docs/documentation/sync/offline-first.mdx


53. datafn/docs/reference/core/errors.mdx 📝 Documentation +0/-0

Error types and envelope structures reference

• Defines DatafnErrorCode enum with all possible error codes
• Explains DatafnError structure and DatafnEnvelope<T> discriminated union
• Documents helper functions (ok, err, unwrapEnvelope)

datafn/docs/reference/core/errors.mdx


54. datafn/docs/content/docs/documentation/plugins/client-search.mdx 📝 Documentation +116/-0

Client search plugin for full-text search

• Documents createClientSearchPlugin for client-side full-text search
• Explains provider-backed and legacy MiniSearch modes
• Details hook lifecycle (afterSync, afterMutation, beforeQuery)

datafn/docs/content/docs/documentation/plugins/client-search.mdx


55. datafn/docs/content/docs/dfql/pagination.mdx 📝 Documentation +122/-0

DFQL pagination with limit/offset and cursors

• Explains limit/offset and cursor-based pagination modes
• Documents cursor structure, forward/backward pagination, and performance
• Details count queries and sort requirement for cursors

datafn/docs/content/docs/dfql/pagination.mdx


56. datafn/docs/content/docs/documentation/sync/clone-up.mdx 📝 Documentation +122/-0

Clone Up bulk upload of offline-created records

• Documents Clone Up for uploading offline-created data to server
• Explains two-stage process (records, then join rows) and finalization
• Details idempotency, error handling, and event emission

datafn/docs/content/docs/documentation/sync/clone-up.mdx


57. datafn/docs/content/docs/dfql/queries.mdx 📝 Documentation +126/-0

DFQL query language reference and structure

• Defines DFQL query structure with all supported options
• Explains basic queries, count queries, batch queries, and cancellation
• Documents query normalization and server-side classification strategies

datafn/docs/content/docs/dfql/queries.mdx


58. datafn/docs/content/docs/documentation/storage/indexeddb.mdx 📝 Documentation +132/-0

IndexedDB storage adapter for browser persistence

• Documents IndexedDbStorageAdapter for browser IndexedDB persistence
• Explains namespace isolation, schema-aware store creation, and auto-version bumping
• Details changelog deduplication, internal stores, and health checks

datafn/docs/content/docs/documentation/storage/indexeddb.mdx


59. datafn/docs/content/docs/documentation/client/kv.mdx 📝 Documentation +136/-0

Key-value store API with reactive signals

• Documents built-in key-value API with get, set, merge, delete operations
• Explains getOrSeed, flush, and signal for reactive KV updates
• Provides practical example with preferences and debouncing

datafn/docs/content/docs/documentation/client/kv.mdx


60. datafn/docs/content/docs/dfql/sorting.mdx 📝 Documentation +89/-0

DFQL sorting with multiple fields and null handling

• Explains sort term formats and multiple sort field usage
• Documents null semantics and stable sort with ID tiebreaker
• Provides parsing and in-memory sorting utilities

datafn/docs/content/docs/dfql/sorting.mdx


61. datafn/docs/app/docs/[[...slug]]/page.tsx Additional files +90/-0

...

datafn/docs/app/docs/[[...slug]]/page.tsx


62. datafn/docs/app/layout.config.tsx Additional files +14/-0

...

datafn/docs/app/layout.config.tsx


63. datafn/docs/app/layout.tsx Additional files +55/-0

...

datafn/docs/app/layout.tsx


64. datafn/docs/app/not-found.tsx Additional files +8/-0

...

datafn/docs/app/not-found.tsx


65. datafn/docs/app/opengraph-image.tsx Additional files +46/-0

...

datafn/docs/app/opengraph-image.tsx


66. datafn/docs/app/page.tsx Additional files +5/-0

...

datafn/docs/app/page.tsx


67. datafn/docs/components/mdx/mermaid.tsx Additional files +55/-0

...

datafn/docs/components/mdx/mermaid.tsx


68. datafn/docs/content/docs/cli/drizzle-codegen.mdx Additional files +97/-0

...

datafn/docs/content/docs/cli/drizzle-codegen.mdx


69. datafn/docs/content/docs/cli/generate.mdx Additional files +86/-0

...

datafn/docs/content/docs/cli/generate.mdx


70. datafn/docs/content/docs/cli/index.mdx Additional files +78/-0

...

datafn/docs/content/docs/cli/index.mdx


71. datafn/docs/content/docs/cli/meta.json Additional files +12/-0

...

datafn/docs/content/docs/cli/meta.json


72. datafn/docs/content/docs/cli/type-codegen.mdx Additional files +120/-0

...

datafn/docs/content/docs/cli/type-codegen.mdx


73. datafn/docs/content/docs/cli/validate.mdx Additional files +54/-0

...

datafn/docs/content/docs/cli/validate.mdx


74. datafn/docs/content/docs/dfql/index.mdx Additional files +95/-0

...

datafn/docs/content/docs/dfql/index.mdx


75. datafn/docs/content/docs/dfql/meta.json Additional files +18/-0

...

datafn/docs/content/docs/dfql/meta.json


76. datafn/docs/content/docs/dfql/schema/index.mdx Additional files +104/-0

...

datafn/docs/content/docs/dfql/schema/index.mdx


77. datafn/docs/content/docs/dfql/schema/meta.json Additional files +10/-0

...

datafn/docs/content/docs/dfql/schema/meta.json


78. datafn/docs/content/docs/dfql/schema/system-fields.mdx Additional files +121/-0

...

datafn/docs/content/docs/dfql/schema/system-fields.mdx


79. datafn/docs/content/docs/documentation/advanced/idempotency.mdx Additional files +113/-0

...

datafn/docs/content/docs/documentation/advanced/idempotency.mdx


80. datafn/docs/content/docs/documentation/advanced/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/advanced/meta.json


81. datafn/docs/content/docs/documentation/client/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/client/meta.json


82. datafn/docs/content/docs/documentation/client/tables.mdx Additional files +128/-0

...

datafn/docs/content/docs/documentation/client/tables.mdx


83. datafn/docs/content/docs/documentation/client/transactions.mdx Additional files +134/-0

...

datafn/docs/content/docs/documentation/client/transactions.mdx


84. datafn/docs/content/docs/documentation/concepts/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/concepts/meta.json


85. datafn/docs/content/docs/documentation/database/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/database/meta.json


86. datafn/docs/content/docs/documentation/meta.json Additional files +17/-0

...

datafn/docs/content/docs/documentation/meta.json


87. datafn/docs/content/docs/documentation/migrations/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/migrations/meta.json


88. datafn/docs/content/docs/documentation/migrations/spv2.mdx Additional files +56/-0

...

datafn/docs/content/docs/documentation/migrations/spv2.mdx


89. datafn/docs/content/docs/documentation/plugins/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/plugins/meta.json


90. datafn/docs/content/docs/documentation/server/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/server/meta.json


91. datafn/docs/content/docs/documentation/server/observability.mdx Additional files +132/-0

...

datafn/docs/content/docs/documentation/server/observability.mdx


92. datafn/docs/content/docs/documentation/server/rest-api.mdx Additional files +139/-0

...

datafn/docs/content/docs/documentation/server/rest-api.mdx


93. datafn/docs/content/docs/documentation/storage/memory.mdx Additional files +72/-0

...

datafn/docs/content/docs/documentation/storage/memory.mdx


94. datafn/docs/content/docs/documentation/storage/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/storage/meta.json


95. datafn/docs/content/docs/documentation/sync/clone.mdx Additional files +134/-0

...

datafn/docs/content/docs/documentation/sync/clone.mdx


96. datafn/docs/content/docs/documentation/sync/cross-tab.mdx Additional files +83/-0

...

datafn/docs/content/docs/documentation/sync/cross-tab.mdx


97. datafn/docs/content/docs/documentation/sync/hydration.mdx Additional files +101/-0

...

datafn/docs/content/docs/documentation/sync/hydration.mdx


98. datafn/docs/content/docs/documentation/sync/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/sync/meta.json


99. datafn/docs/content/docs/documentation/use-cases/meta.json Additional files +4/-0

...

datafn/docs/content/docs/documentation/use-cases/meta.json


100. datafn/docs/content/docs/documentation/use-cases/sharing-patterns.mdx Additional files +76/-0

...

datafn/docs/content/docs/documentation/use-cases/sharing-patterns.mdx


101. datafn/docs/content/docs/index.mdx Additional files +56/-0

...

datafn/docs/content/docs/index.mdx


102. datafn/docs/content/docs/meta.json Additional files +4/-0

...

datafn/docs/content/docs/meta.json


103. datafn/docs/content/docs/reference/client/events.mdx Additional files +97/-0

...

datafn/docs/content/docs/reference/client/events.mdx


104. datafn/docs/content/docs/reference/client/meta.json Additional files +4/-0

...

datafn/docs/content/docs/reference/client/meta.json


105. datafn/docs/content/docs/reference/client/mutation.mdx Additional files +55/-0

...

datafn/docs/content/docs/reference/client/mutation.mdx


106. datafn/docs/content/docs/reference/client/query.mdx Additional files +41/-0

...

datafn/docs/content/docs/reference/client/query.mdx


107. datafn/docs/content/docs/reference/client/signal.mdx Additional files +56/-0

...

<a href='https://github.c...

@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 28, 2026

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 28, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Docs-theme alias breaks build🐞 Bug ✓ Correctness
Description
datafn/docs/tsconfig.json aliases @superfunctions/docs-theme to the workspace source
packages/docs-theme/src/index.ts, but that index exports from ./layout.js and ./config.js
which don't exist in src, causing module resolution failures and blocking the docs app build.
Code

datafn/docs/tsconfig.json[R25-34]

+    "paths": {
+      "@/*": [
+        "./*"
+      ],
+      "@superfunctions/docs-theme": [
+        "../../packages/docs-theme/src/index.ts"
+      ],
+      "@superfunctions/docs-theme/tokens.css": [
+        "../../packages/docs-theme/src/tokens.css"
+      ],
Evidence
The docs app forces @superfunctions/docs-theme to resolve to the theme package’s src/index.ts.
That file imports ./layout.js and ./config.js, but the theme package’s source files are
layout.tsx and config.ts, so the .js targets are missing when resolving against src.

datafn/docs/tsconfig.json[25-34]
packages/docs-theme/src/index.ts[1-4]
packages/docs-theme/src/layout.tsx[1-20]
packages/docs-theme/src/config.ts[1-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`@superfunctions/docs-theme` is being resolved to `packages/docs-theme/src/index.ts`, but that source index imports `./layout.js`/`./config.js` which do not exist in the source tree. This breaks Next/TS module resolution and prevents building `@datafn/docs`.
## Issue Context
`@superfunctions/docs-theme` is already a workspace package with `dist/` outputs and proper `exports`. The docs app should import it through normal package resolution (or point to `dist/`) rather than forcing `src/`.
## Fix Focus Areas
- datafn/docs/tsconfig.json[25-34]
- packages/docs-theme/src/index.ts[1-4]
- packages/docs-theme/package.json[6-14]
## Implementation notes
- Prefer removing the `paths` override for `@superfunctions/docs-theme` (and `tokens.css`) so Next uses the package `exports`.
- Ensure the docs-theme build runs before `@datafn/docs` build (e.g., via turbo pipeline dependencies), or alternatively point the alias to `../../packages/docs-theme/dist/index.js` + `dist/index.d.ts` if you must keep a path mapping.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. External CSS import breaks build🐞 Bug ⛯ Reliability
Description
datafn/docs/app/global.css imports ../../../packages/docs-theme/src/tokens.css from outside the
Next app root and bypasses the theme package export; without Next external-directory configuration
this commonly fails during build/file tracing and prevents deployment builds.
Code

datafn/docs/app/global.css[R5-6]

+/* Shared theme package source: @superfunctions/docs-theme/tokens.css */
+@import "../../../packages/docs-theme/src/tokens.css";
Evidence
The docs app pulls CSS from outside datafn/docs via a relative filesystem path, while the Next
config doesn’t enable external directory imports; additionally, the theme package already exports
./tokens.css from dist, which is the correct supported import path.

datafn/docs/app/global.css[1-6]
datafn/docs/next.config.mjs[1-10]
packages/docs-theme/package.json[6-17]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs app imports theme tokens CSS using a relative path that escapes the Next app root (`../../../packages/...`). This is brittle and often breaks Next builds and output file tracing in monorepos.
## Issue Context
`@superfunctions/docs-theme` already exports `./tokens.css` from `dist`, so consumers should import `@superfunctions/docs-theme/tokens.css`.
## Fix Focus Areas
- datafn/docs/app/global.css[1-6]
- packages/docs-theme/package.json[6-17]
- datafn/docs/next.config.mjs[1-10]
## Implementation notes
- Replace the relative import with: `@import "@superfunctions/docs-theme/tokens.css";`
- Ensure `packages/docs-theme` is built so `dist/tokens.css` exists in CI/deploy builds (e.g., turbo pipeline dependency), or adjust Next config only if you intentionally want to consume workspace source.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Broken GitHub edit links 🐞 Bug ✓ Correctness
Description
The docs page builds GitHub/edit paths that don’t match where the MDX files live
(editOnGithub.path points at datafn/docs/app/docs/... and githubUrl points at repo-root
content/docs/...), so “Edit on GitHub” and “Open in GitHub” will 404.
Code

datafn/docs/app/docs/[[...slug]]/page.tsx[R25-40]

+    <DocsPage toc={data.toc} full={data.full}
+    editOnGithub={{
+      owner: gitConfig.user,
+      repo: gitConfig.repo,
+      path: `datafn/docs/app/docs/${page.path}`,
+      sha: gitConfig.branch,
+    }}
+    >
+      <DocsTitle>{data.title}</DocsTitle>
+      <DocsDescription className="mb-0">{data.description}</DocsDescription>
+      <div className="flex flex-row gap-2 items-center border-b pb-6">
+        <LLMCopyButton markdownUrl={`${page.url}.mdx`} />
+        <ViewOptions
+          markdownUrl={`${page.url}.mdx`}
+          githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${page.path}`}
+        />
Evidence
Fumadocs is configured to read documentation from datafn/docs/content/docs, but the page
constructs GitHub links targeting different directories (app/docs and repo-root content/docs).

datafn/docs/source.config.ts[4-6]
datafn/docs/app/docs/[[...slug]]/page.tsx[25-40]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The generated GitHub URLs for editing/viewing documentation files point to the wrong directories and will not match the actual MDX content location.
## Issue Context
Docs content is configured under `datafn/docs/content/docs`.
## Fix Focus Areas
- datafn/docs/app/docs/[[...slug]]/page.tsx[25-40]
- datafn/docs/source.config.ts[4-6]
## Implementation notes
- Update `editOnGithub.path` to target `datafn/docs/content/docs/${page.path}` (or whatever `page.path` is relative to).
- Update `githubUrl` similarly to include the `datafn/docs/` prefix: `.../blob/${branch}/datafn/docs/content/docs/${page.path}`.
- If `page.path` already includes `content/docs`, avoid double-prefixing—use the exact path format returned by `source.getPage()`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. Invalid .mdx copy URLs 🐞 Bug ✓ Correctness
Description
LLMCopyButton/ViewOptions fetch ${page.url}.mdx, but the app doesn’t define any route/static
asset that serves raw MDX at that URL; users will likely get a 404 or copy rendered HTML instead of
markdown.
Code

datafn/docs/app/docs/[[...slug]]/page.tsx[R35-40]

+      <div className="flex flex-row gap-2 items-center border-b pb-6">
+        <LLMCopyButton markdownUrl={`${page.url}.mdx`} />
+        <ViewOptions
+          markdownUrl={`${page.url}.mdx`}
+          githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${page.path}`}
+        />
Evidence
The only docs handler is the rendered /docs/* page component which looks up pages by slug, and
docs content is stored under content/docs; appending .mdx changes the slug and does not
correspond to a declared raw-content endpoint.

datafn/docs/app/docs/[[...slug]]/page.tsx[14-20]
datafn/docs/app/docs/[[...slug]]/page.tsx[35-40]
datafn/docs/source.config.ts[4-6]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The UI attempts to fetch `.../docs/<slug>.mdx`, but there is no raw MDX endpoint implemented. This breaks copy/view actions.
## Issue Context
MDX files exist on disk under `datafn/docs/content/docs`, and the current `/docs/*` route renders MDX rather than exposing the source.
## Fix Focus Areas
- datafn/docs/app/docs/[[...slug]]/page.tsx[35-40]
- datafn/docs/components/ai/page-actions.tsx[11-45]
## Implementation notes
Choose one:
1) Point `markdownUrl` to GitHub raw content using `page.path` (and the correct repo path prefix).
2) Add a Next route (e.g., `app/docs/raw/[...slug]/route.ts`) that reads the MDX file and returns `text/plain` (be explicit about allowed paths to avoid traversal), then set `markdownUrl` to that route.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Unsafe Mermaid rendering 🐞 Bug ⛨ Security
Description
Mermaid rendering uses securityLevel: 'loose' and injects the resulting SVG via
dangerouslySetInnerHTML, so a malicious diagram embedded in MDX can result in XSS in the docs
site.
Code

datafn/docs/components/mdx/mermaid.tsx[R33-53]

+  mermaid.initialize({
+    startOnLoad: false,
+    securityLevel: 'loose',
+    fontFamily: 'inherit',
+    themeCSS: 'margin: 1.5rem auto 0;',
+    theme: resolvedTheme === 'dark' ? 'dark' : 'default',
+  });
+
+  const { svg, bindFunctions } = use(
+    cachePromise(`${chart}-${resolvedTheme}`, () => {
+      return mermaid.render(id, chart.replaceAll('\\n', '\n'));
+    }),
+  );
+
+  return (
+    <div
+      ref={(container) => {
+        if (container) bindFunctions?.(container);
+      }}
+      dangerouslySetInnerHTML={{ __html: svg }}
+    />
Evidence
Mermaid is explicitly configured to use the least restrictive security level and its generated SVG
is inserted directly into the DOM. Mermaid charts originate from MDX content via the configured
remark plugin, so any unsafe output flows to the client.

datafn/docs/components/mdx/mermaid.tsx[28-54]
datafn/docs/source.config.ts[8-12]
datafn/docs/app/docs/[[...slug]]/page.tsx[42-44]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Mermaid output is injected with `dangerouslySetInnerHTML` while Mermaid is configured with `securityLevel: 'loose'`, which can allow unsafe HTML/links in generated SVG.
## Issue Context
Charts come from MDX content (via `remarkMdxMermaid`) and are rendered on the client.
## Fix Focus Areas
- datafn/docs/components/mdx/mermaid.tsx[33-53]
- datafn/docs/source.config.ts[8-12]
## Implementation notes
- Prefer `securityLevel: 'strict'` (or Mermaid’s safest available setting compatible with your diagrams).
- If you need looser rendering, sanitize the generated SVG before injecting, or render Mermaid in a sandboxed way.
- Consider moving `mermaid.initialize` behind a stable one-time init to reduce re-init surface area.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 132 files

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="datafn/docs/content/docs/dfql/queries.mdx">

<violation number="1" location="datafn/docs/content/docs/dfql/queries.mdx:122">
P3: The execution-strategy table is inaccurate: it omits several query shapes that force `IN_MEMORY` and overstates when `FULL_PUSHDOWN` is selected.</violation>
</file>

<file name="datafn/docs/content/docs/dfql/pagination.mdx">

<violation number="1" location="datafn/docs/content/docs/dfql/pagination.mdx:118">
P2: The docs claim `offset` is ignored when `cursor` is provided, but the in-memory execution path still applies `offset` after cursor slicing. Update this sentence to reflect the actual behavior (or warn that combining them will still skip items) so users aren't misled.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

Note

Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.

🟡 Minor comments (15)
datafn/docs/.gitignore-1-1 (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Add .next and out directories to the .gitignore.

This is a Next.js project with next.config.mjs and a build command that generates .next/ in the datafn/docs directory. The current .gitignore only contains .vercel. Add .next and out/ to prevent build artifacts from being committed:

.vercel
.next
out/

The root .gitignore does not cover these patterns for the docs subdirectory.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/.gitignore` at line 1, Update the docs .gitignore to include
Next.js build and export artifacts by adding the patterns ".next" and "out/"
alongside the existing ".vercel" entry in the datafn/docs/.gitignore so build
outputs from next.config.mjs (the .next directory) and static export (out/) are
ignored and not committed.
datafn/docs/content/docs/documentation/index.mdx-108-109 (1)

108-109: ⚠️ Potential issue | 🟡 Minor

Filter operator syntax is inconsistent with other docs in this PR.

This page uses $eq, while other new pages use eq. Please standardize on one DFQL operator style to avoid confusing readers and broken copy/paste examples.

Proposed consistency fix (if `eq` is canonical)
-  filters: { completed: { $eq: false } },
+  filters: { completed: { eq: false } },
...
-  filters: { completed: { $eq: false } },
+  filters: { completed: { eq: false } },

Also applies to: 115-116

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/index.mdx` around lines 108 - 109, The
filter uses the BSON-style operator "$eq" which is inconsistent with the rest of
the docs; change the operator to the canonical DFQL form "eq" in the filters
object (e.g., replace filters: { completed: { $eq: false } } with filters: {
completed: { eq: false } } ) and apply the same replacement for the other
occurrence that mirrors this example (also update any similar uses of "$eq" to
"eq"); ensure keys like filters, completed, sort and sort entries
("priority:asc", "id:asc") remain unchanged.
datafn/docs/content/docs/documentation/server/websockets.mdx-94-94 (1)

94-94: ⚠️ Potential issue | 🟡 Minor

Use a consistent argument name for handlePong.

The earlier snippet passes ws, but this line uses client. Align this to handlePong(ws) to avoid copy/paste mistakes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/server/websockets.mdx` at line 94, The
docs use inconsistent parameter names for handlePong: earlier snippets call
server.websocketHandler.handlePong(ws) but the line at step 3 uses client;
update the step to call server.websocketHandler.handlePong(ws) so the argument
name matches the prior examples and avoids copy/paste errors, referencing the
handlePong method and the ws variable.
datafn/docs/content/docs/documentation/server/rest-api.mdx-26-30 (1)

26-30: ⚠️ Potential issue | 🟡 Minor

Example should match the stated URL-encoding requirement.

The text says q must be URL-encoded JSON, but the sample uses raw JSON. Please update the example to an encoded query string to avoid malformed request copy/paste.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/server/rest-api.mdx` around lines 26 -
30, The example GET request uses raw JSON for the q query parameter but the docs
require URL-encoded JSON; update the example so the q value is URL-encoded
(percent-encoded) JSON instead of raw braces, e.g. encode the payload
{"filters":{"status":{"$eq":"active"}},"limit":10} and replace the path in the
sample `GET /datafn/resources/tasks?q=...` accordingly so the q parameter
contains the percent-encoded string; ensure the text still references the `q`
query parameter and DFQL query parameters.
datafn/docs/content/docs/reference/server/execution.mdx-28-28 (1)

28-28: ⚠️ Potential issue | 🟡 Minor

Use filters (plural) in the classification rule.

This line uses filter.id.$eq, which is inconsistent with the documented query shape elsewhere (filters). Please align naming to avoid API confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/server/execution.mdx` at line 28, The
table entry uses the singular key `filter.id.$eq` but the API and docs use
`filters`; update the classification rule example to use `filters.id.$eq` so it
matches the documented query shape (search for the table row containing "Find by
ID" and the string `filter.id.$eq` and replace it with `filters.id.$eq`).
datafn/docs/content/docs/reference/server/execution.mdx-18-18 (1)

18-18: ⚠️ Potential issue | 🟡 Minor

Documentation uses invalid TypeScript notation—update to match actual implementation.

The documentation on line 18 simplifies the type as Map<string, Map<string, Record>>, but Record requires type parameters. The actual MemoryStore implementation (memory-store.ts:8) uses Record<string, Record<string, Record<string, unknown>>>. Update the documentation to use valid TypeScript: Map<string, Map<string, Record<string, unknown>>>.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/server/execution.mdx` at line 18, The docs
line describing the in-memory store uses an invalid TypeScript type; update the
sentence to match the actual MemoryStore implementation by replacing
`Map<string, Map<string, Record>>` with a valid type `Map<string, Map<string,
Record<string, unknown>>>` so it aligns with the MemoryStore (memory-store.ts)
shape and valid TypeScript syntax.
datafn/docs/content/docs/documentation/client/setup.mdx-124-124 (1)

124-124: ⚠️ Potential issue | 🟡 Minor

Polish two wording issues in user-facing docs.

Line 124 reads as a sentence fragment after the dash, and Line 161 should hyphenate “Svelte-readable stores.”

Also applies to: 161-161

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/client/setup.mdx` at line 124, Fix two
wording issues: make the clonePageSize bullet a complete sentence (referencing
the `clonePageSize` option) by turning the fragment after the dash into a full
sentence like "Page size for paginated clone requests; can be a single number or
a per-resource map (e.g., { todos: 500, users: 200 })." and hyphenate
"Svelte-readable stores" wherever that phrase appears (search for the exact
phrase "Svelte readable stores" and change it to "Svelte-readable stores") so
both user-facing lines (`clonePageSize` and the Svelte-readable stores mention)
read correctly.
datafn/docs/content/docs/reference/client/events.mdx-15-15 (1)

15-15: ⚠️ Potential issue | 🟡 Minor

Use one filter type name consistently.

Lines 15 and 82 reference EventFilter, but the documented type is DatafnEventFilter. Align these names to prevent copy/paste confusion.

✏️ Suggested doc fix
-  subscribe(handler: EventHandler, filter?: EventFilter): () => void;
+  subscribe(handler: EventHandler, filter?: DatafnEventFilter): () => void;

-function matchesFilter(event: DatafnEvent, filter?: EventFilter): boolean;
+function matchesFilter(event: DatafnEvent, filter?: DatafnEventFilter): boolean;

Also applies to: 82-82

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/client/events.mdx` at line 15, The docs
use two different filter type names causing confusion; update the signature and
all references to use a single consistent type name (replace occurrences of
EventFilter with DatafnEventFilter or vice versa) so the documented type matches
the API; specifically update the subscribe method signature (subscribe(handler:
EventHandler, filter?: EventFilter)) and the other reference (around the second
occurrence) to the chosen canonical type name (DatafnEventFilter) so examples
and typings align with the actual EventHandler/EventFilter types.
datafn/docs/content/docs/documentation/storage/custom.mdx-17-17 (1)

17-17: ⚠️ Potential issue | 🟡 Minor

Keep constructor usage consistent across examples.

The interface example shows CustomStorageAdapter without constructor params, but Line 161 instantiates it with namespace. Align both snippets to avoid copy/paste type errors.

Also applies to: 161-162

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/storage/custom.mdx` at line 17, The
class example for CustomStorageAdapter is inconsistent with its use: add a
constructor to the CustomStorageAdapter class signature that accepts the same
parameter used where it’s instantiated (e.g., namespace) and store it on the
instance so the class implements DatafnStorageAdapter and matches the usage;
update the class definition (CustomStorageAdapter, constructor) to accept and
assign the namespace parameter or alternatively remove the namespace from the
instantiation so both snippets match—prefer adding a constructor(namespace:
string) to the class example to align with the existing instantiation.
datafn/docs/content/docs/documentation/database/drizzle.mdx-81-81 (1)

81-81: ⚠️ Potential issue | 🟡 Minor

Fix relation terminology typo.

Line 81 says “many-many relations”; this should be “many-to-many relations” for correctness and readability.

✏️ Suggested doc fix
-- Join tables for many-many relations.
+- Join tables for many-to-many relations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/database/drizzle.mdx` at line 81,
Replace the incorrect phrase "many-many relations" with the correct
"many-to-many relations" in the documentation sentence "Join tables for
many-many relations."; search for and update any other occurrences of
"many-many" in the same document (e.g., the line containing that exact sentence)
to ensure consistent terminology.
datafn/docs/content/docs/documentation/storage/custom.mdx-133-137 (1)

133-137: ⚠️ Potential issue | 🟡 Minor

Await the write operation in upsertRecord.

Line 133 starts an async DB write but does not await it. This can cause non-deterministic sequencing in callers.

✅ Suggested fix
-    this.db.run(
+    await this.db.run(
       `INSERT INTO ${resource} (${keys.join(", ")}) VALUES (${placeholders})
        ON CONFLICT(id) DO UPDATE SET ${updates}`,
       values,
     );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/storage/custom.mdx` around lines 133 -
137, In upsertRecord, the async database write using this.db.run(...) is not
awaited; change the call in the upsertRecord function to await
this.db.run(`INSERT INTO ${resource} (${keys.join(", ")}) VALUES
(${placeholders}) ON CONFLICT(id) DO UPDATE SET ${updates}`, values) so the
operation completes before the function returns (and propagate or handle any
errors as appropriate).
datafn/docs/content/docs/documentation/server/setup.mdx-232-239 (1)

232-239: ⚠️ Potential issue | 🟡 Minor

Clarify async vs synchronous error behavior.

Line 234 states that createDatafnServer() "throws synchronously" on schema validation failure, but the example on line 48 uses await createDatafnServer(), indicating it's an async function. This could confuse readers about when and how errors are thrown.

Consider clarifying whether the schema validation happens during the async initialization (rejecting the promise) or if there's a synchronous phase before the async operations begin.

📝 Suggested clarification
 ## Schema Validation

-The schema is validated at startup using `validateSchema()`. If validation fails, `createDatafnServer()` throws synchronously with a descriptive error:
+The schema is validated at startup using `validateSchema()`. If validation fails, `createDatafnServer()` rejects with a descriptive error:

Schema validation failed:

Details

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @datafn/docs/content/docs/documentation/server/setup.mdx around lines 232 -
239, Update the wording to clarify that schema validation performed by
validateSchema() happens during createDatafnServer()'s async initialization and
will cause the returned Promise to reject (so awaiting createDatafnServer() will
throw via rejected promise), rather than a synchronous throw; mention
createDatafnServer() and validateSchema() by name and add a brief note advising
callers to handle the error with try/catch around await createDatafnServer() or
.catch() on the Promise.


</details>

</blockquote></details>
<details>
<summary>datafn/docs/content/docs/dfql/schema/relations.mdx-263-267 (1)</summary><blockquote>

`263-267`: _⚠️ Potential issue_ | _🟡 Minor_

**Remove duplicate heading.**

There's a duplicate "## Querying Relations" heading. Line 263 already introduces the section, and line 267 repeats it.


<details>
<summary>📝 Suggested fix</summary>

```diff
 ---

 ## Querying Relations

-DFQL supports querying and mutating relationships between records. Relations are defined in the schema and can be traversed in queries or modified through mutation operations.
-
-## Querying Relations

 ### Select Expansion Tokens
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/dfql/schema/relations.mdx` around lines 263 - 267,
Remove the duplicate "## Querying Relations" heading that appears immediately
after the introductory paragraph (the second occurrence of the "## Querying
Relations" heading); keep the first instance and delete the repeated heading
text so the section title appears only once.
datafn/docs/content/docs/documentation/server/routes.mdx-112-129 (1)

112-129: ⚠️ Potential issue | 🟡 Minor

limits example is missing maxPullLimit while it is referenced later.

Line 399 references limits.maxPullLimit, but the GET /datafn/status example payload (Lines 124-128) omits it. Please align these sections so the status contract is self-consistent.

✏️ Suggested doc fix
     limits: {
       maxLimit: 100,
       maxTransactSteps: 100,
+      maxPullLimit: 1000,
       maxPayloadBytes: 5242880
     },

Also applies to: 399-399

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/server/routes.mdx` around lines 112 -
129, The example JSON for the GET /datafn/status response is missing the
limits.maxPullLimit field referenced elsewhere; update the example payload in
the documentation (the GET /datafn/status example object) to include a
maxPullLimit entry under result.limits (e.g., alongside maxLimit,
maxTransactSteps, maxPayloadBytes) so that limits.maxPullLimit exists and
matches the expected type and value used later in the docs; ensure you modify
the example object that contains schemaHash, capabilities and limits to add the
maxPullLimit property.
datafn/docs/content/docs/reference/core/search-provider.mdx-103-106 (1)

103-106: ⚠️ Potential issue | 🟡 Minor

Fallback behavior wording is inconsistent with the documented contract.

Line 105 says fallback merges by score, but search() (Lines 40-50) returns only IDs. Please clarify fallback ordering semantics to avoid implying score availability where none is documented.

✏️ Suggested doc fix
-If not implemented, DataFn falls back to calling `search()` per resource and merging results by score.
+If not implemented, DataFn falls back to calling `search()` per resource and combining results using provider/native ordering (since `search()` returns IDs, not explicit scores).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/core/search-provider.mdx` around lines 103
- 106, The doc's fallback wording is inconsistent: update the Cross-resource
search paragraph to remove "merging results by score" and instead state the
actual fallback ordering semantics given that search() (and client.search())
return only IDs — e.g., "DataFn falls back to calling search() per resource and
concatenating/ordering results deterministically (by resource priority or stable
resource name order) since scores are not available." Also ensure the
description of search()/client.search() remains clear that only IDs are returned
so the fallback behavior matches that contract.
🧹 Nitpick comments (16)
datafn/docs/app/not-found.tsx (1)

1-8: Consider using Tailwind CSS classes instead of inline styles.

The 404 page is functional but uses inline styles. For consistency with the project's styling approach (Tailwind CSS v4), consider refactoring to use utility classes.

♻️ Proposed refactor using Tailwind CSS
 export default function NotFound() {
   return (
-    <div style={{ textAlign: "center", padding: "4rem" }}>
-      <h1>404 - Page Not Found</h1>
-      <p>The page you are looking for does not exist.</p>
+    <div className="text-center p-16">
+      <h1 className="text-4xl font-bold mb-4">404 - Page Not Found</h1>
+      <p className="text-gray-600">The page you are looking for does not exist.</p>
     </div>
   );
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/app/not-found.tsx` around lines 1 - 8, The NotFound component
uses inline styles; replace them with Tailwind utility classes: remove the style
prop on the root div in the NotFound function and apply classes such as
"text-center", "py-16" or "p-16" (or "px-4 py-16" as preferred) to center
content and add spacing, and use Tailwind heading/paragraph classes (e.g.,
"text-2xl font-semibold" for the h1 and "mt-4 text-base text-muted-foreground"
for the p) to match project styling conventions.
datafn/docs/app/global.css (1)

5-6: Fragile relative path for theme tokens.

The relative path ../../../packages/docs-theme/src/tokens.css is brittle and will break if the directory structure changes. The comment acknowledges this is meant to reference @superfunctions/docs-theme/tokens.css. Once the workspace resolution blocker mentioned in the PR description is resolved, consider switching to the package import:

-/* Shared theme package source: `@superfunctions/docs-theme/tokens.css` */
-@import "../../../packages/docs-theme/src/tokens.css";
+@import "@superfunctions/docs-theme/tokens.css";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/app/global.css` around lines 5 - 6, Replace the fragile relative
import "../../../packages/docs-theme/src/tokens.css" with the package import
"@superfunctions/docs-theme/tokens.css" in the CSS where tokens are imported
(the line currently importing tokens.css); keep the existing comment about the
shared theme, and switch to the package path once the workspace resolution
blocker is resolved so the import uses `@superfunctions/docs-theme/tokens.css`
instead of the relative path.
datafn/docs/package.json (1)

32-33: autoprefixer is unnecessary with Tailwind CSS v4.

Tailwind CSS v4 uses Lightning CSS internally which handles vendor prefixes automatically. The autoprefixer dependency can be removed.

♻️ Suggested change
   "devDependencies": {
     "@types/mdx": "^2",
     "@types/node": "^22",
     "@types/react": "^19",
     "@types/react-dom": "^19",
-    "autoprefixer": "^10",
     "postcss": "^8",
     "typescript": "^5"
   }

As per coding guidelines from Tailwind v4 documentation: "Built-in Lightning CSS integration handles vendor prefixes, nesting, minification, and imports automatically. No need for separate PostCSS plugins like autoprefixer."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/package.json` around lines 32 - 33, The package.json currently
lists "autoprefixer" which is unnecessary with Tailwind CSS v4; remove the
"autoprefixer" entry from the dependencies section (leaving "postcss" if still
required) and update the lockfile by running your package manager
(npm/yarn/pnpm) to remove it from the install graph; verify there are no
explicit uses of autoprefixer in PostCSS config files (e.g., postcss.config.js)
and remove any references to the "autoprefixer" plugin if present.
datafn/docs/app/layout.config.tsx (1)

6-10: Consider parameterizing the branch for different environments.

The branch is hardcoded to "dev". If docs are deployed from different branches (e.g., main for production), GitHub "Edit on GitHub" links will point to the wrong branch.

💡 Suggested approach
+const DOCS_BRANCH = process.env.DOCS_GIT_BRANCH || "dev";
+
 export const gitConfig: DocsGitConfig = {
   user: "21nCo",
   repo: "super-functions",
-  branch: "dev",
+  branch: DOCS_BRANCH,
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/app/layout.config.tsx` around lines 6 - 10, The gitConfig
currently hardcodes branch = "dev" which breaks "Edit on GitHub" links for other
environments; update the gitConfig creation (symbol: gitConfig of type
DocsGitConfig) to read the branch from configuration or an environment variable
(e.g., process.env.DOCS_GIT_BRANCH or a small helper that maps NODE_ENV to a
branch) and fall back to "dev" if unset, so the branch value is parameterized
per environment and used wherever gitConfig.branch is referenced.
datafn/docs/content/docs/reference/client/config.mdx (1)

166-166: Clarify the return type documentation.

Line 166 states "Each method returns a DatafnEnvelope as a plain object," but the interface definition above (lines 154-164) shows each method returning Promise<unknown>. Consider rewording to clarify that the resolved value is a DatafnEnvelope:

-Each method returns a `DatafnEnvelope` as a plain object.
+Each method returns a Promise that resolves to a `DatafnEnvelope` plain object.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/client/config.mdx` at line 166, Update the
sentence that currently reads "Each method returns a `DatafnEnvelope` as a plain
object" to clarify that the methods return a Promise that resolves to a
`DatafnEnvelope` (i.e., the resolved value is a plain object conforming to the
`DatafnEnvelope` interface), matching the interface signatures that show
Promise<unknown>; reference the `DatafnEnvelope` type and the methods in the
interface so the wording explicitly states "returns a Promise that resolves to a
DatafnEnvelope."
datafn/docs/content/docs/documentation/server/authorization.mdx (1)

191-204: Consider relocating Python handler architecture section.

The "Python Handler Architecture" table (lines 191-204) documents the internal handler module structure for the Python SDK. This implementation detail doesn't directly relate to authorization concepts covered in the rest of this page.

Consider moving this section to a dedicated Python implementation reference page (e.g., /docs/reference/python/handlers or /docs/documentation/server/python-handlers) to improve topical coherence.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/server/authorization.mdx` around lines
191 - 204, Remove the "Python Handler Architecture" heading and its table (the
block starting with "Python Handler Architecture" and listing handlers like
handle_query, handle_mutation, handle_transact, handle_seed, handle_clone,
handle_pull, handle_push) from the authorization page and create a new dedicated
Python reference doc for it (e.g., a new markdown/MDX page titled "Python
Handlers" under the Python reference/docs area); move the full table content
into that new page, add a short cross-link from the original authorization page
to the new reference page, and update any local links or sidebar/navigation
entries to include the new page so the handlers' implementation details are
documented in the correct topical area.
datafn/docs/content/docs/documentation/storage/indexeddb.mdx (1)

69-73: Optional: Consider varying sentence structure in the numbered list.

The numbered list items 3–5 begin with "Creates," which creates a repetitive pattern. While the content is clear and accurate, you could optionally vary the structure for stylistic flow.

✍️ Suggested rewording
 1. Creates an object store for each resource (keyed by `id`).
 2. Creates indices from the resource schema (e.g., fields listed in `indices`).
-3. Creates foreign key indices inferred from relations.
-4. Creates join stores for many-many relations with composite keys `[from, to]` and indices on both columns.
-5. Creates the built-in `kv` store for key-value operations.
+3. Infers and creates foreign key indices from relations.
+4. Generates join stores for many-to-many relations with composite keys `[from, to]` and indices on both columns.
+5. Initializes the built-in `kv` store for key-value operations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/storage/indexeddb.mdx` around lines 69
- 73, The three list items that currently begin with "Creates" should be
rephrased to reduce repetition: change item 3 to something like "Infers foreign
key indices from relations" (referencing "foreign key indices"), item 4 to "Adds
join stores for many-many relations with composite keys [from, to] and indices
on both columns" (referencing "join stores" and the composite key), and item 5
to "Includes the built-in `kv` store for key-value operations" (referencing
"`kv` store"); apply these wording changes in the numbered list to vary sentence
structure while preserving meaning.
datafn/docs/content/docs/documentation/client/signals.mdx (1)

142-142: Use a compound modifier for clarity.

“readable stores” should be “readable-store” in this context.

Proposed wording tweak
-Use `@datafn/svelte` to convert signals to Svelte readable stores:
+Use `@datafn/svelte` to convert signals to Svelte readable-store values:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/client/signals.mdx` at line 142,
Update the wording in the sentence "Use `@datafn/svelte` to convert signals to
Svelte readable stores:" to use the compound modifier "readable-store" for
clarity (e.g., "Use `@datafn/svelte` to convert signals to Svelte
readable-stores:"), so replace "readable stores" with "readable-store(s)"
consistently in the phrase where it appears in the client/signals.mdx content.
datafn/docs/content/docs/reference/client/svelte.mdx (1)

84-84: Hyphenate the compound modifier.

“client-reference driven” should be “client-reference-driven”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/reference/client/svelte.mdx` at line 84, Update the
phrase "client-reference driven" to the hyphenated compound
"client-reference-driven" in the docs content (the sentence "Overload for
client-reference driven signal creation."). Locate that exact string in the
Svelte client reference doc (client/svelte.mdx) and replace it so the modifier
is correctly hyphenated.
datafn/docs/content/docs/dfql/filters.mdx (1)

120-120: Consider adding a reference for the likeToRegExp() function.

Line 120 mentions that $like and $ilike patterns are "converted to regular expressions via likeToRegExp()" in the client-side evaluator, but doesn't indicate where this utility is defined or documented. Consider adding a cross-reference to help developers find this function if they need to use it directly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/dfql/filters.mdx` at line 120, Add a cross-reference
for the likeToRegExp() utility where the docs say "$like and $ilike patterns are
converted to regular expressions via likeToRegExp()": mention where the function
is defined (e.g., the client-side evaluator module or util file) and link or
point to its API/docs page so developers can find its implementation and usage
examples; reference the likeToRegExp symbol and the client-side evaluator to
help locate the code.
datafn/docs/content/docs/dfql/mutations.mdx (1)

185-189: Consider adding a deprecation timeline for userId field.

The migration note clearly states that shareWith.userId is deprecated in favor of shareWith.principalId, but doesn't indicate when this deprecation was introduced or if there's a planned removal timeline. Adding this information would help developers prioritize migration work.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/dfql/mutations.mdx` around lines 185 - 189, Update
the docs entry for shareWith to include a deprecation timeline for
shareWith.userId: add when the deprecation was introduced, whether it will be
removed (or under consideration), and any planned removal version or target
date, and include recommended migration urgency; specifically edit the paragraph
referencing shareWith.userId and principalId (and the Migration note) to state
the deprecation start date/version and the expected removal timeline so callers
of userId know how urgently to switch to principalId.
datafn/docs/content/docs/documentation/database/transactions.mdx (1)

40-49: Clarify when explicit commit()/rollback() methods should be used.

The TransactionAdapter interface (line 43-45) exposes explicit commit() and rollback() methods, but line 49 states "The transaction commits automatically when the callback resolves." This creates ambiguity about when developers should call these methods explicitly versus relying on automatic behavior.

Consider adding a note explaining:

  • Whether explicit commit() is ever necessary (or if it's a no-op when auto-commit will occur)
  • Whether explicit rollback() is needed to abort mid-transaction, or if throwing an error is preferred
  • If these methods are primarily for advanced use cases
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/database/transactions.mdx` around
lines 40 - 49, The docs are ambiguous about when to call
TransactionAdapter.commit() and rollback(); update the paragraph around the
TransactionAdapter interface to explicitly state that the transaction is
auto-committed when the transaction callback resolves and auto-rolled back when
the callback throws, that calling commit() is normally unnecessary (it will be a
no-op if the callback completes and auto-commit occurs) but can be used in
advanced scenarios to finalize a sub-step within the callback, and that
rollback() can be used to abort mid-transaction programmatically (otherwise
throwing from the callback will also trigger a rollback); reference the
TransactionAdapter type and its commit()/rollback() methods and note these are
for advanced or programmatic control rather than required for typical callback
usage.
datafn/docs/app/docs/[[...slug]]/page.tsx (1)

21-22: Avoid any for page metadata payloads.

Using as any here drops type guarantees for critical render/metadata fields. Prefer a typed page-data shape from source.getPage() (or a local interface) to catch docs schema drift early.

Also applies to: 60-60

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/app/docs/`[[...slug]]/page.tsx around lines 21 - 22, Replace the
unsafe "as any" cast on page.data with a proper typed interface or existing type
from your page source (e.g., a PageData or the return type of source.getPage())
so you retain compile-time guarantees for fields used during render;
specifically change the declaration "const data = page.data as any" to use that
PageData type and update usages like MDX = data.body and the other occurrence at
line ~60 to rely on typed properties (body, title, description, etc.) instead of
any, or import/derive the type from the function that produces the page payload.
datafn/docs/content/docs/documentation/storage/overview.mdx (1)

94-104: Remove unused import from example.

The ns import is not used in this code example, which may confuse readers.

📝 Suggested fix
 import type { DatafnStorageFactory } from "@datafn/client";
-import { IndexedDbStorageAdapter, ns } from "@datafn/client";
+import { IndexedDbStorageAdapter } from "@datafn/client";

 const storageFactory: DatafnStorageFactory = (namespace) => {
   return IndexedDbStorageAdapter.createForNamespace(
     "my-app",
     namespace,
   );
 };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/storage/overview.mdx` around lines 94
- 104, The example imports an unused symbol `ns`; remove `ns` from the import
list so only used symbols are imported (keep import of `IndexedDbStorageAdapter`
and `DatafnStorageFactory`), e.g. update the import line that currently reads
`import { IndexedDbStorageAdapter, ns } from "@datafn/client";` to exclude `ns`
and leave other code (`storageFactory`,
`IndexedDbStorageAdapter.createForNamespace`) unchanged.
datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx (1)

54-59: Consider varying sentence structure for readability.

Three consecutive sentences begin with "Device B", which can feel repetitive. Consider restructuring for better flow.

📝 Suggested fix
 ## Offline Example

-- Device A (owner) shares a note while Device B (viewer) is offline.
-- Device B later reconnects and runs pull.
-- Device B receives the historical note as a backfill upsert.
-- If owner revokes later, Device B receives a delete tombstone on the next pull.
+- Device A (owner) shares a note while Device B (viewer) is offline.
+- Upon reconnecting, Device B runs pull and receives the historical note as a backfill upsert.
+- If the owner later revokes access, the next pull delivers a delete tombstone to Device B.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx`
around lines 54 - 59, The three bullet sentences under the "Offline Example"
section are repetitive because each one starts with "Device B"; rewrite the
bullets to vary sentence structure and improve flow by combining or reordering
phrases (for example: keep "Device A (owner) shares a note while Device B
(viewer) is offline." then change the next bullets to "When Device B later
reconnects and runs pull, it receives the historical note as a backfill upsert."
and "If the owner revokes later, Device B gets a delete tombstone on the next
pull."), ensuring meaning is unchanged and references to Device A (owner) and
Device B (viewer) remain clear.
datafn/docs/content/docs/dfql/search.mdx (1)

70-70: Minor formatting improvement for clarity.

The source options would be clearer with inline code formatting to match the style used elsewhere in the document.

📝 Suggested fix
-`source: auto|local|remote` controls where search executes:
+`source: "auto" | "local" | "remote"` controls where search executes:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/content/docs/dfql/search.mdx` at line 70, Wrap each search source
option in inline code formatting where the line currently reads `source:
auto|local|remote` so it matches the doc style; update the text containing that
exact string to use inline code for `auto`, `local`, and `remote` (e.g.,
`source: `auto` | `local` | `remote``) to improve clarity and consistency with
other examples.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c5e11e45-0d45-4585-8a4d-ce2058959829

📥 Commits

Reviewing files that changed from the base of the PR and between aa36705 and 0d69586.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (131)
  • datafn/docs/.gitignore
  • datafn/docs/app/docs/[[...slug]]/page.tsx
  • datafn/docs/app/docs/layout.tsx
  • datafn/docs/app/global.css
  • datafn/docs/app/layout.config.tsx
  • datafn/docs/app/layout.tsx
  • datafn/docs/app/not-found.tsx
  • datafn/docs/app/opengraph-image.tsx
  • datafn/docs/app/page.tsx
  • datafn/docs/components/ai/page-actions.tsx
  • datafn/docs/components/mdx/mermaid.tsx
  • datafn/docs/content/docs/cli/drizzle-codegen.mdx
  • datafn/docs/content/docs/cli/generate.mdx
  • datafn/docs/content/docs/cli/index.mdx
  • datafn/docs/content/docs/cli/meta.json
  • datafn/docs/content/docs/cli/type-codegen.mdx
  • datafn/docs/content/docs/cli/validate.mdx
  • datafn/docs/content/docs/dfql/aggregations.mdx
  • datafn/docs/content/docs/dfql/filters.mdx
  • datafn/docs/content/docs/dfql/index.mdx
  • datafn/docs/content/docs/dfql/meta.json
  • datafn/docs/content/docs/dfql/mutations.mdx
  • datafn/docs/content/docs/dfql/pagination.mdx
  • datafn/docs/content/docs/dfql/queries.mdx
  • datafn/docs/content/docs/dfql/schema/fields.mdx
  • datafn/docs/content/docs/dfql/schema/index.mdx
  • datafn/docs/content/docs/dfql/schema/meta.json
  • datafn/docs/content/docs/dfql/schema/relations.mdx
  • datafn/docs/content/docs/dfql/schema/resources.mdx
  • datafn/docs/content/docs/dfql/schema/system-fields.mdx
  • datafn/docs/content/docs/dfql/search.mdx
  • datafn/docs/content/docs/dfql/select.mdx
  • datafn/docs/content/docs/dfql/sorting.mdx
  • datafn/docs/content/docs/dfql/transactions.mdx
  • datafn/docs/content/docs/documentation/advanced/change-tracking.mdx
  • datafn/docs/content/docs/documentation/advanced/debouncing.mdx
  • datafn/docs/content/docs/documentation/advanced/error-handling.mdx
  • datafn/docs/content/docs/documentation/advanced/guards.mdx
  • datafn/docs/content/docs/documentation/advanced/idempotency.mdx
  • datafn/docs/content/docs/documentation/advanced/meta.json
  • datafn/docs/content/docs/documentation/advanced/security.mdx
  • datafn/docs/content/docs/documentation/client/events.mdx
  • datafn/docs/content/docs/documentation/client/frameworks.mdx
  • datafn/docs/content/docs/documentation/client/kv.mdx
  • datafn/docs/content/docs/documentation/client/meta.json
  • datafn/docs/content/docs/documentation/client/mutations.mdx
  • datafn/docs/content/docs/documentation/client/queries.mdx
  • datafn/docs/content/docs/documentation/client/setup.mdx
  • datafn/docs/content/docs/documentation/client/signals.mdx
  • datafn/docs/content/docs/documentation/client/tables.mdx
  • datafn/docs/content/docs/documentation/client/transactions.mdx
  • datafn/docs/content/docs/documentation/concepts/capabilities.mdx
  • datafn/docs/content/docs/documentation/concepts/meta.json
  • datafn/docs/content/docs/documentation/concepts/multi-tenancy.mdx
  • datafn/docs/content/docs/documentation/concepts/overview.mdx
  • datafn/docs/content/docs/documentation/concepts/sharing-v2.mdx
  • datafn/docs/content/docs/documentation/database/adapters.mdx
  • datafn/docs/content/docs/documentation/database/drizzle.mdx
  • datafn/docs/content/docs/documentation/database/meta.json
  • datafn/docs/content/docs/documentation/database/transactions.mdx
  • datafn/docs/content/docs/documentation/index.mdx
  • datafn/docs/content/docs/documentation/meta.json
  • datafn/docs/content/docs/documentation/migrations/meta.json
  • datafn/docs/content/docs/documentation/migrations/spv2.mdx
  • datafn/docs/content/docs/documentation/plugins/client-search.mdx
  • datafn/docs/content/docs/documentation/plugins/custom-plugins.mdx
  • datafn/docs/content/docs/documentation/plugins/meta.json
  • datafn/docs/content/docs/documentation/plugins/overview.mdx
  • datafn/docs/content/docs/documentation/server/authorization.mdx
  • datafn/docs/content/docs/documentation/server/meta.json
  • datafn/docs/content/docs/documentation/server/observability.mdx
  • datafn/docs/content/docs/documentation/server/rate-limiting.mdx
  • datafn/docs/content/docs/documentation/server/rest-api.mdx
  • datafn/docs/content/docs/documentation/server/routes.mdx
  • datafn/docs/content/docs/documentation/server/setup.mdx
  • datafn/docs/content/docs/documentation/server/validation.mdx
  • datafn/docs/content/docs/documentation/server/websockets.mdx
  • datafn/docs/content/docs/documentation/storage/custom.mdx
  • datafn/docs/content/docs/documentation/storage/indexeddb.mdx
  • datafn/docs/content/docs/documentation/storage/memory.mdx
  • datafn/docs/content/docs/documentation/storage/meta.json
  • datafn/docs/content/docs/documentation/storage/overview.mdx
  • datafn/docs/content/docs/documentation/sync/clone-up.mdx
  • datafn/docs/content/docs/documentation/sync/clone.mdx
  • datafn/docs/content/docs/documentation/sync/cross-tab.mdx
  • datafn/docs/content/docs/documentation/sync/hydration.mdx
  • datafn/docs/content/docs/documentation/sync/meta.json
  • datafn/docs/content/docs/documentation/sync/offline-first.mdx
  • datafn/docs/content/docs/documentation/sync/overview.mdx
  • datafn/docs/content/docs/documentation/sync/pull-push.mdx
  • datafn/docs/content/docs/documentation/sync/sharing-sync-lifecycle.mdx
  • datafn/docs/content/docs/documentation/use-cases/meta.json
  • datafn/docs/content/docs/documentation/use-cases/sharing-patterns.mdx
  • datafn/docs/content/docs/index.mdx
  • datafn/docs/content/docs/meta.json
  • datafn/docs/content/docs/reference/client/config.mdx
  • datafn/docs/content/docs/reference/client/events.mdx
  • datafn/docs/content/docs/reference/client/meta.json
  • datafn/docs/content/docs/reference/client/mutation.mdx
  • datafn/docs/content/docs/reference/client/query.mdx
  • datafn/docs/content/docs/reference/client/signal.mdx
  • datafn/docs/content/docs/reference/client/storage.mdx
  • datafn/docs/content/docs/reference/client/svelte.mdx
  • datafn/docs/content/docs/reference/client/sync.mdx
  • datafn/docs/content/docs/reference/client/transport.mdx
  • datafn/docs/content/docs/reference/core/date.mdx
  • datafn/docs/content/docs/reference/core/errors.mdx
  • datafn/docs/content/docs/reference/core/filters.mdx
  • datafn/docs/content/docs/reference/core/hooks.mdx
  • datafn/docs/content/docs/reference/core/kv.mdx
  • datafn/docs/content/docs/reference/core/meta.json
  • datafn/docs/content/docs/reference/core/normalize.mdx
  • datafn/docs/content/docs/reference/core/schema.mdx
  • datafn/docs/content/docs/reference/core/search-provider.mdx
  • datafn/docs/content/docs/reference/core/types.mdx
  • datafn/docs/content/docs/reference/index.mdx
  • datafn/docs/content/docs/reference/meta.json
  • datafn/docs/content/docs/reference/server/config.mdx
  • datafn/docs/content/docs/reference/server/execution.mdx
  • datafn/docs/content/docs/reference/server/meta.json
  • datafn/docs/content/docs/reference/server/middleware.mdx
  • datafn/docs/content/docs/reference/server/routes.mdx
  • datafn/docs/content/docs/reference/server/websocket.mdx
  • datafn/docs/lib/source.ts
  • datafn/docs/next.config.mjs
  • datafn/docs/package.json
  • datafn/docs/postcss.config.mjs
  • datafn/docs/source.config.ts
  • datafn/docs/tsconfig.json
  • datafn/docs/vercel.json
  • package.json

import "./global.css";
import "@21n/fonts/styles.css";
import { RootProvider } from "fumadocs-ui/provider";
import { DocsRootLayout } from "@superfunctions/docs-theme";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

This import is currently a hard build failure.

datafn/docs still cannot build on this branch because @superfunctions/docs-theme resolves to workspace source that references missing ./layout.js and ./config.js. Please fix the package export/entrypoint setup before merging.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/app/layout.tsx` at line 4, The import of DocsRootLayout from
"@superfunctions/docs-theme" fails because the package resolves to workspace
source that lacks built entry files (./layout.js and ./config.js); fix the
package export/entrypoint by either (A) updating the
"@superfunctions/docs-theme" package.json "main"/"exports" to point at the built
artifacts (e.g., dist or lib files) and ensure those files are produced by the
build, or (B) change consumers to import from the package's built entry (e.g.,
"@superfunctions/docs-theme/dist" or the appropriate built path); locate
references to DocsRootLayout in datafn/docs/app/layout.tsx and update the
package's package.json build scripts to emit layout.js and config.js so the
import resolves without referencing workspace source.

Comment on lines +26 to +36
try {
await navigator.clipboard.write([
new ClipboardItem({
'text/plain': fetch(markdownUrl).then(async (res) => {
const content = await res.text();
cache.set(markdownUrl, content);

return content;
}),
}),
]);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Where markdownUrl is constructed and consumed:"
rg -n -C3 'markdownUrl|page\.url.*\.mdx' datafn/docs

echo
echo "Routes that could serve raw markdown:"
fd -i 'route\.(ts|tsx|js|jsx)$' datafn/docs/app -x rg -n -C2 'mdx|markdown|text/plain|content/docs|raw' {} || true

echo
if [ -d datafn/docs/public ]; then
  echo "Public markdown assets:"
  fd -i '\.(md|mdx)$' datafn/docs/public || true
else
  echo "datafn/docs/public does not exist"
fi

Repository: 21nCo/super-functions

Length of output: 4363


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== All route-like files in datafn/docs ==="
fd -e ts -e tsx -e js -e jsx 'route\.' datafn/docs --hidden | head -20

echo
echo "=== All API or middleware handlers ==="
fd -path '*api*' -o -path '*middleware*' datafn/docs --type f | grep -E '\.(ts|tsx|js|jsx)$' || echo "None found"

echo
echo "=== Check for catch-all routes ==="
rg -n '\[\[.*slug.*\]\]|catch.*all' datafn/docs/app --type ts --type tsx || echo "No catch-all patterns found"

echo
echo "=== Build/export scripts that might generate assets ==="
fd -e json datafn/docs/package.json -x cat {} | grep -A 20 '"scripts"' || true

echo
echo "=== Check next.config for rewrites/redirects ==="
fd -i 'next.config' datafn/docs -x cat {} || echo "No next.config found"

Repository: 21nCo/super-functions

Length of output: 741


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== page.tsx full file to understand page object ==="
cat -n datafn/docs/app/docs/\[\[..slug\]\]/page.tsx | head -80

echo
echo "=== Look for where 'data' comes from ==="
rg -n 'getPage\|getSourceData\|docs\.getPage' datafn/docs/app --max-count 20

echo
echo "=== Search for fumadocs source configuration ==="
rg -n 'source\|createMDX\|docs' datafn/docs/app --max-count 20 -B2 -A2

echo
echo "=== Check app initialization files ==="
find datafn/docs/app -maxdepth 2 -name 'layout.*' -o -name 'route.*' -o -name 'source.*' | xargs ls -la 2>/dev/null || true

Repository: 21nCo/super-functions

Length of output: 209


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Find the actual page.tsx file ==="
fd -i 'page.tsx' datafn/docs/app

echo
echo "=== List the directory structure of datafn/docs/app/docs ==="
find datafn/docs/app/docs -type f -name '*.tsx' -o -name '*.ts' 2>/dev/null | head -20

echo
echo "=== Full content of the docs page file ==="
find datafn/docs/app/docs -name 'page.tsx' -exec cat -n {} \;

echo
echo "=== Search for fumadocs source setup ==="
rg -n 'source\|createMDX\|getPage' datafn/docs --max-count 30

echo
echo "=== Check for lib or utils that configure docs ==="
find datafn/docs -path '*/lib/*' -o -path '*/utils/*' -name '*.ts' -o -name '*.tsx' | head -20

Repository: 21nCo/super-functions

Length of output: 3471


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Find lib/source file ==="
find datafn/docs -path '*/lib/source*' -type f

echo
echo "=== Read the source configuration ==="
find datafn/docs -path '*/lib/source*' -type f -exec cat -n {} \;

echo
echo "=== Check if there's a source config in root ==="
find datafn/docs -maxdepth 3 -name 'source.ts' -o -name 'source.tsx' | xargs cat -n 2>/dev/null || true

Repository: 21nCo/super-functions

Length of output: 856


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Find .source configuration ==="
find datafn/docs -name '.source*' -type f 2>/dev/null | head -10

echo
echo "=== Search for where `@/.source` is generated or configured ==="
rg -n '\.source\|fumadocs' datafn/docs --max-count 30

echo
echo "=== Check for API routes or route handlers for markdown ==="
fd -path '*/app/api/*' -name 'route.*' datafn/docs -x cat -n {} \; 2>/dev/null || echo "No API routes found"

echo
echo "=== Look for any middleware or public routing ==="
find datafn/docs -name 'middleware.*' -o -name 'next.config.*' | xargs cat -n 2>/dev/null || true

echo
echo "=== Search for fumadocs-mdx usage and what files it exposes ==="
rg -n 'fumadocs' datafn/docs/next.config.* -A 10

Repository: 21nCo/super-functions

Length of output: 162


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Full content of next.config.js/mjs/ts ==="
find datafn/docs -maxdepth 1 -name 'next.config.*' -exec cat -n {} \;

echo
echo "=== Search for any .mdx file routing or API ==="
rg -n '\.mdx|/api/|fetch' datafn/docs/app --max-count 40

echo
echo "=== Check what page.url typically contains by looking at fumadocs types ==="
rg -n 'page\.url' datafn/docs -B5 -A5

echo
echo "=== Look for build outputs or dist directories ==="
find datafn/docs -maxdepth 2 -type d \( -name dist -o -name .next -o -name build -o -name out \) 2>/dev/null

echo
echo "=== Check package.json to understand fumadocs version and setup ==="
cat -n datafn/docs/package.json | grep -A 50 '"dependencies"' | head -60

Repository: 21nCo/super-functions

Length of output: 2801


🏁 Script executed:

#!/bin/bash
set -euo pipefmp

echo "=== Search fumadocs core or mdx for raw file serving ==="
rg -n 'raw|getRaw|file' datafn/docs --max-count 20

echo
echo "=== Check if fumadocs provides a built-in route for raw content ==="
rg -n 'source\.' datafn/docs/lib/source.ts -A 20

echo
echo "=== Look for actual content/docs files ==="
find datafn/docs -path '*/content/docs/*' -type f 2>/dev/null | head -10

echo
echo "=== Check if fumadocs-mdx generates anything special ==="
find datafn/docs -maxdepth 1 -type f -name '.source*' -o -name 'source*' 2>/dev/null

echo
echo "=== Try searching for any raw content API or handler ==="
rg -n 'getRawFile\|getFile\|raw\|text/plain' datafn/docs -B3 -A3 --max-count 30

Repository: 21nCo/super-functions

Length of output: 117


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Search fumadocs core or mdx for raw file serving ==="
rg -n 'raw|getRaw|file' datafn/docs --max-count 20

echo
echo "=== Check if fumadocs provides a built-in route for raw content ==="
rg -n 'source\.' datafn/docs/lib/source.ts -A 20

echo
echo "=== Look for actual content/docs files ==="
find datafn/docs -path '*/content/docs/*' -type f 2>/dev/null | head -10

echo
echo "=== Check if fumadocs-mdx generates anything special ==="
find datafn/docs -maxdepth 1 -type f \( -name '.source*' -o -name 'source*' \) 2>/dev/null

echo
echo "=== Try searching for any raw content API or handler ==="
rg -n 'getRawFile\|getFile\|raw\|text/plain' datafn/docs -B3 -A3 --max-count 30

Repository: 21nCo/super-functions

Length of output: 5213


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== List content/docs structure ==="
find datafn/docs/content/docs -type f -name '*.mdx' 2>/dev/null | head -20

echo
echo "=== Check fumadocs-core source patterns and what page object contains ==="
rg -n 'getPage\|page\.url\|page\.path' datafn/docs -B2 -A2 | head -80

echo
echo "=== Look for any static file serving or public routes ==="
find datafn/docs/public -type f 2>/dev/null || echo "No public directory"

echo
echo "=== Check if there's an API route that might serve markdown ==="
find datafn/docs/app -name '*route*' -o -name '*api*' 2>/dev/null | xargs ls -la 2>/dev/null || echo "No API routes"

echo
echo "=== Check fumadocs documentation in node_modules or inline comments ==="
rg -n 'getRaw\|getSourceMap\|serveRaw' datafn/docs || echo "No raw serving methods found"

Repository: 21nCo/super-functions

Length of output: 1003


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Check fumadocs documentation for raw content serving ==="
rg -n 'getRaw\|getSourceMap\|raw.*url\|source\.files' datafn/docs/lib datafn/docs/app -B3 -A3

echo
echo "=== Look at page-actions to see how markdownUrl is actually used ==="
cat -n datafn/docs/components/ai/page-actions.tsx | sed -n '20,100p'

echo
echo "=== Check what fumadocs source object actually provides ==="
rg -n 'loader\|baseUrl\|source\(' datafn/docs/lib/source.ts -B5 -A10

Repository: 21nCo/super-functions

Length of output: 125


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== Full page-actions.tsx file ==="
cat -n datafn/docs/components/ai/page-actions.tsx

echo
echo "=== Check if markdownUrl is ever successfully fetched ==="
rg -n 'fetch.*markdownUrl\|markdownUrl.*fetch' datafn/docs -B2 -A5

Repository: 21nCo/super-functions

Length of output: 12924


Add a route handler to serve raw markdown content.

This component assumes markdownUrl points to a fetchable raw MDX endpoint. The current code constructs it as ${page.url}.mdx (e.g., /docs/cli/generate.mdx), but Next.js does not automatically serve raw .mdx files from those paths. The fetch(markdownUrl) call on line 29 and the "View as Markdown" link on line 91 will both return 404.

Either create an API route that exposes the raw markdown content at those URLs, or pass a valid endpoint to markdownUrl from the page component.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/components/ai/page-actions.tsx` around lines 26 - 36, The
component is fetching raw MDX from markdownUrl (used in fetch(markdownUrl) and
navigator.clipboard.write) and the "View as Markdown" link but Next.js won't
serve .mdx at that path; either implement an API route that reads the source
MDX/markdown and returns it at the markdownUrl endpoint (so fetch(markdownUrl)
and the "View as Markdown" link succeed), or change the page component to pass a
valid raw-markdown endpoint into the markdownUrl prop; update references to
markdownUrl, fetch(markdownUrl), and the "View as Markdown" link target
accordingly so they point to the new API route or valid URL.

Comment on lines +33 to +39
mermaid.initialize({
startOnLoad: false,
securityLevel: 'loose',
fontFamily: 'inherit',
themeCSS: 'margin: 1.5rem auto 0;',
theme: resolvedTheme === 'dark' ? 'dark' : 'default',
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

For Mermaid 11.12.3, what protections are disabled by securityLevel: "loose"compared withstrict, and is strict the default security level?

💡 Result:

For Mermaid 11.12.3, setting securityLevel to "loose" disables two key protections compared to "strict": - Encoding of HTML tags in diagram text (they are allowed unencoded in "loose"). - Disabling of click functionality (clicks are enabled in "loose", allowing interactive event bindings like the click directive). "strict" is the default security level.

Citations:


Change securityLevel from 'loose' to 'strict'.

Setting securityLevel: 'loose' allows unencoded HTML tags in diagram text and enables click event bindings. Combined with dangerouslySetInnerHTML, this creates an XSS vulnerability if diagrams are ever sourced from untrusted input. Since 'strict' is the default and provides the necessary protections here, use it instead.

Diff
   mermaid.initialize({
     startOnLoad: false,
-    securityLevel: 'loose',
+    securityLevel: 'strict',
     fontFamily: 'inherit',
     themeCSS: 'margin: 1.5rem auto 0;',
     theme: resolvedTheme === 'dark' ? 'dark' : 'default',
   });

Also applies to: lines 48-53

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/components/mdx/mermaid.tsx` around lines 33 - 39, Update the
mermaid.initialize configuration to use a safe security level: locate the
mermaid.initialize(...) calls (the initialization block in mermaid.tsx) and
change securityLevel from 'loose' to 'strict' in both places (the block that
sets startOnLoad, fontFamily, themeCSS, theme, etc.), ensuring you keep the rest
of the options intact; this prevents unencoded HTML and click bindings when
diagrams are rendered (important because the component uses
dangerouslySetInnerHTML).

Comment on lines +8 to +10
source: {
files: (fumadocsSource as any).files(),
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check fumadocs-core version and types
echo "=== Checking fumadocs versions in package.json ==="
cat datafn/docs/package.json | jq '.dependencies, .devDependencies' 2>/dev/null | grep -i fumadocs || echo "fumadocs not found in package.json"

echo ""
echo "=== Searching for toFumadocsSource usage patterns ==="
rg -n "toFumadocsSource" --type ts -C 3

echo ""
echo "=== Checking source.config.ts for docs definition ==="
fd -t f "source.config" --exec cat {}

Repository: 21nCo/super-functions

Length of output: 960


🏁 Script executed:

#!/bin/bash
# Read the complete source.ts file
echo "=== Complete source.ts file ==="
cat datafn/docs/lib/source.ts

echo ""
echo "=== Check node_modules for fumadocs types (if available) ==="
find . -name "*.d.ts" -path "*/fumadocs-core/*" | head -20

echo ""
echo "=== Search for other loader() usage patterns ==="
rg -n "loader\(" --type ts -A 5 | head -40

echo ""
echo "=== Check if there are type errors in the project ==="
fd -t f "tsconfig.json" --exec cat {}

Repository: 21nCo/super-functions

Length of output: 15133


🌐 Web query:

fumadocs-core v15 loader source files API configuration

💡 Result:

In fumadocs-core v15 (latest ~15.8.x as of late 2025, with docs current as of 2026), the primary "loader" refers to the loader function from 'fumadocs-core/source', a server-side API that processes content sources (e.g., MDX files from fumadocs-mdx or content-collections) into a unified Fumadocs source interface. It generates page slugs, URLs, page trees, and supports i18n, plugins, and multiple sources. Source files are virtual/in-memory representations passed from content sources (no direct filesystem access in loader). ### Key API and Configuration (from official docs) Import: import { loader } from 'fumadocs-core/source'; Basic usage with fumadocs-mdx/content-collections: import { docs } from 'collections/server'; // Generated .source/collections export const source = loader({ source: docs.toFumadocsSource, baseUrl: '/docs', // Required: base path for URLs }); Full options object: - source: Required Source object (from .toFumadocsSource, custom Source {files: File[]}, or multiple({docs: ..., blog: ...})). - baseUrl: string - Base URL path. - url?: (slugs: string[], locale?: string) => string - Custom URL generator. - slugs?: (file: File) => string[] - Custom slug generator from file path/data. - i18n?: I18nConfig - For multi-language page trees (with fallbackLanguage). - plugins?: LoaderPlugin[] or ((ctx) => LoaderPlugin[]) - Extend processing (e.g., lucideIconsPlugin for icons). ### Output Methods (on returned source) - getPage(slugs: string[], locale?: string): Page data (body, toc, structuredData). - getPages(locale?: string): All pages list. - getPageTree(locale?: string): Hierarchical page tree. - getNodePage(node) / getNodeMeta(node): From tree nodes. - params: For Next.js generateStaticParams. - Client serialization: serializePageTree, with useFumadocsLoader hook. ### Integration with fumadocs-mdx Loader (Next.js Webpack Loader) fumadocs-mdx uses a separate Next.js loader via createMDX in next.config.mjs to process MDX files into .source/ collections: import { createMDX } from 'fumadocs-mdx/next'; const withMDX = createMDX({ configPath: './my-config.ts', // Optional: Custom config file path (default inferred). }); export default withMDX(nextConfig); - Runs file watcher in dev (next dev) to regenerate .source/. - Config defined in source.config.ts (or similar): defineDocs({dir: 'content/docs'}), global/mdxOptions. No major v15-specific changes to loader API (v15 focused on Tailwind v4 support). Source code: https://github.com/fuma-nama/fumadocs/tree/main/packages/fumadocs-core/src/source (inferred from docs/raw links). Examples: Official docs at https://www.fumadocs.dev/docs/headless/source-api.

Citations:


Remove incorrect API usage and as any cast.

The source parameter should receive the result of docs.toFumadocsSource() directly, not wrapped in a {files: ...} object. According to the fumadocs-core v15 API, the loader() function expects a Source object, and toFumadocsSource() already returns a compatible type.

Replace lines 8-10 with:

source: fumadocsSource,

Or simplify to:

source: docs.toFumadocsSource(),

The as any cast masks incorrect API usage rather than a type safety issue.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/lib/source.ts` around lines 8 - 10, The code is incorrectly
wrapping fumadocsSource in an object and using an `as any` cast; replace the
`source: { files: (fumadocsSource as any).files() }` usage with a direct Source
value by setting `source` to `fumadocsSource` or calling
`docs.toFumadocsSource()` (e.g., `source: docs.toFumadocsSource()`), removing
the `{ files: ... }` wrapper and the `as any` cast so the value matches the
fumadocs-core v15 Source API expected by `loader()`.

Comment on lines +29 to +34
"@superfunctions/docs-theme": [
"../../packages/docs-theme/src/index.ts"
],
"@superfunctions/docs-theme/tokens.css": [
"../../packages/docs-theme/src/tokens.css"
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the docs-theme package.json for main/exports fields and verify build output location

echo "=== Checking docs-theme package.json for output configuration ==="
cat ../../packages/docs-theme/package.json | jq -r '.main, .exports, .scripts.build'

echo -e "\n=== Checking for build output directories ==="
fd -t d -d 1 'dist|lib|build' ../../packages/docs-theme/

echo -e "\n=== Checking if layout.js and config.js exist in source vs build ==="
fd 'layout\.js|config\.js' ../../packages/docs-theme/

Repository: 21nCo/super-functions

Length of output: 563


🏁 Script executed:

#!/bin/bash
# First, understand the repository structure
echo "=== Repository structure ==="
git ls-files | grep -E 'package\.json|tsconfig\.json' | head -20

echo -e "\n=== Check if datafn/docs exists ==="
ls -la datafn/docs/ 2>/dev/null || echo "datafn/docs not found"

echo -e "\n=== Check if there are packages directories ==="
find . -maxdepth 3 -type d -name "packages" 2>/dev/null

echo -e "\n=== List all directories at depth 2 ==="
ls -la

Repository: 21nCo/super-functions

Length of output: 2785


🏁 Script executed:

#!/bin/bash
echo "=== Contents of packages directory ==="
ls -la packages/

echo -e "\n=== Check for docs-theme package ==="
find packages -maxdepth 1 -type d -name "*docs*" -o -name "*theme*"

echo -e "\n=== List all packages ==="
ls packages/

Repository: 21nCo/super-functions

Length of output: 1261


🏁 Script executed:

#!/bin/bash
echo "=== docs-theme package.json ==="
cat packages/docs-theme/package.json

echo -e "\n=== docs-theme directory structure ==="
find packages/docs-theme -type f -o -type d | head -30

echo -e "\n=== Search for layout.js and config.js ==="
find packages/docs-theme -name "layout.js" -o -name "config.js"

echo -e "\n=== Check what output directories exist ==="
ls -la packages/docs-theme/

Repository: 21nCo/super-functions

Length of output: 1750


Path alias points to TypeScript source files instead of the built JavaScript distribution.

The PR objectives state that Next.js "fails to resolve ./layout.js and ./config.js" when resolving @superfunctions/docs-theme. The root cause is that the path aliases in datafn/docs/tsconfig.json point directly to TypeScript source files instead of the built distribution.

The packages/docs-theme/package.json explicitly configures the package output:

"main": "./dist/index.js",
"exports": {
  ".": "./dist/index.js",
  "./tokens.css": "./dist/tokens.css"
}

However, the path aliases point to source files:

"@superfunctions/docs-theme": ["../../packages/docs-theme/src/index.ts"]
"@superfunctions/docs-theme/tokens.css": ["../../packages/docs-theme/src/tokens.css"]

Next.js requires the JavaScript distribution output, not TypeScript source files. Update the path aliases to point to the dist directory where the build output is located:

🔧 Proposed fix
     "paths": {
       "@/*": [
         "./*"
       ],
       "@superfunctions/docs-theme": [
-        "../../packages/docs-theme/src/index.ts"
+        "../../packages/docs-theme/dist/index.js"
       ],
       "@superfunctions/docs-theme/tokens.css": [
-        "../../packages/docs-theme/src/tokens.css"
+        "../../packages/docs-theme/dist/tokens.css"
       ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@datafn/docs/tsconfig.json` around lines 29 - 34, The tsconfig path aliases
"@superfunctions/docs-theme" and "@superfunctions/docs-theme/tokens.css"
currently point to TypeScript source files; change them to point to the built
JS/CSS distribution instead (use the package's dist outputs, e.g., replace
"../../packages/docs-theme/src/index.ts" with
"../../packages/docs-theme/dist/index.js" and
"../../packages/docs-theme/src/tokens.css" with
"../../packages/docs-theme/dist/tokens.css") so Next.js resolves the compiled
layout/config files correctly.

@arav-ink
Copy link
Copy Markdown

@codex Review this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0d69586709

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

editOnGithub={{
owner: gitConfig.user,
repo: gitConfig.repo,
path: `datafn/docs/app/docs/${page.path}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point edit-on-GitHub links at docs content files

The editOnGithub.path currently points to datafn/docs/app/docs/${page.path}, but the MDX sources for these pages live under datafn/docs/content/docs/. This makes the “Edit on GitHub” action resolve to non-existent files for every docs page, while the adjacent ViewOptions link already uses the correct content/docs prefix. Updating this path is necessary for edit links to work.

Useful? React with 👍 / 👎.

Comment on lines +36 to +38
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
<ViewOptions
markdownUrl={`${page.url}.mdx`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Serve markdown before wiring page actions to *.mdx URLs

These actions assume ${page.url}.mdx returns raw Markdown, but this commit does not add the required *.mdx route handler/rewrite (and datafn/docs/next.config.mjs has no rewrite for /docs/:path*.mdx). As a result, “Copy Markdown” / “View as Markdown” will fetch the wrong payload (typically 404/HTML) instead of page markdown across all docs pages.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 15 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="datafn/docs/app/global.css">

<violation number="1" location="datafn/docs/app/global.css:6">
P1: This import resolves to `@superfunctions/docs-theme`’s exported `./dist/tokens.css`, but that CSS file is not present in the repo/build inputs, so the stylesheet import will fail to resolve.</violation>
</file>

<file name="datafn/docs/content/docs/reference/client/svelte.mdx">

<violation number="1" location="datafn/docs/content/docs/reference/client/svelte.mdx:62">
P3: The docs now contradict themselves: `data` is typed as `T | undefined` in the type definition, but the properties table still says `T`.</violation>
</file>

<file name="datafn/docs/app/api/docs/raw/[...slug]/route.ts">

<violation number="1" location="datafn/docs/app/api/docs/raw/[...slug]/route.ts:13">
P1: The route builds a filesystem path from URL segments without verifying the resolved path stays inside `content/docs`, which can allow directory traversal file reads.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@import "fumadocs-ui/css/preset.css";

/* Shared theme package source: @superfunctions/docs-theme/tokens.css */
@import "@superfunctions/docs-theme/tokens.css";
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This import resolves to @superfunctions/docs-theme’s exported ./dist/tokens.css, but that CSS file is not present in the repo/build inputs, so the stylesheet import will fail to resolve.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At datafn/docs/app/global.css, line 6:

<comment>This import resolves to `@superfunctions/docs-theme`’s exported `./dist/tokens.css`, but that CSS file is not present in the repo/build inputs, so the stylesheet import will fail to resolve.</comment>

<file context>
@@ -3,4 +3,4 @@
 
 /* Shared theme package source: @superfunctions/docs-theme/tokens.css */
-@import "../../../packages/docs-theme/src/tokens.css";
+@import "@superfunctions/docs-theme/tokens.css";
</file context>
Fix with Cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="datafn/docs/app/api/docs/raw/[...slug]/route.ts">

<violation number="1" location="datafn/docs/app/api/docs/raw/[...slug]/route.ts:16">
P1: The traversal guard is incomplete: `relativePath.startsWith("..")` does not block absolute `relativePath` values (e.g. Windows cross-drive paths), so out-of-root files can still be read.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown

arav-ink commented Mar 29, 2026

Merge activity

## Summary
- add the `datafn/docs` site from `next`
- wire the root workspace and lockfile for the docs slice
- include documentation content for DFQL, client/server usage, sync, storage, migrations, and CLI docs

## Validation
- `cd packages/docs-theme && npm run build`
- `cd datafn/docs && npm run build` is currently blocked because Next resolves `@superfunctions/docs-theme` to workspace source files and then fails to resolve `./layout.js` / `./config.js` from that source path in this branch shape

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds `datafn/docs`, a Next.js docs site using `fumadocs-ui` and `@superfunctions/docs-theme`, with comprehensive DataFn docs (DFQL, client/server, sync, storage, migrations, CLI). Satisfies SF-7; review fixes include stricter raw MD/MDX endpoint validation and importing shared theme tokens.

- **New Features**
  - New docs app at `datafn/docs` with `app/` routes, global styles (imports `@superfunctions/docs-theme/tokens.css`), OG image, 404, root redirect, and footer attribution.
  - Integrates theme via `createBaseLayoutOptions`/`DocsRootLayout`; GitHub edit links point to `21nCo/super-functions@dev`.
  - LLM copy button powered by `/api/docs/raw/[...slug]` (safe slug and path checks); Mermaid MDX component.

- **Migration**
  - Build steps: `cd packages/docs-theme && npm run build`; then `cd datafn/docs && npm run build`.
  - Current blocker: Next resolves `@superfunctions/docs-theme` to workspace source and can’t find built entrypoints; use a published/packed package or update resolution to built outputs until aliasing is fixed.

<sup>Written for commit 450b321. Summary will update on new commits.</sup>

<!-- End of auto-generated description by cubic. -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Documentation**
  * Launched comprehensive documentation site with guides for client and server setup, DFQL query language reference, and CLI tools
  * Added detailed API reference for `@datafn/core`, `@datafn/client`, and `@datafn/server` packages
  * Documented advanced topics including offline-first sync, capabilities, multi-tenancy, sharing patterns, guards, idempotency, and error handling
  * Included database and storage adapter guides, use cases, and security best practices

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the codex/datafn-docs-pr branch from 450b321 to 05f2b61 Compare March 29, 2026 04:47
@graphite-app graphite-app bot merged commit 05f2b61 into dev Mar 29, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants