🎯 Full Type Safety
End-to-end type safety powered by Effect Schema. Your editor knows your content structure better than you do. No codegen, no manual types—just pure TypeScript elegance.
🎯 Full Type Safety
End-to-end type safety powered by Effect Schema. Your editor knows your content structure better than you do. No codegen, no manual types—just pure TypeScript elegance.
⚡ Zero Runtime Cost
Build once, query instantly. All content compiled to SQLite at build time. No GraphQL layers, no API calls, no runtime overhead. Just blazingly fast queries.
🗄️ SQLite Performance
Efficient querying with automatic indexing. Orders of magnitude faster than file system reads. Your content is always ready, always fast.
🔗 Type-Safe Relations
Define relationships between collections with complete type inference. Single, array, and map relations—all fully typed. TypeScript knows the exact return type of every query.
import { Schema } from "effect";
const PostSchema = Schema.Struct({id: Schema.String,title: Schema.String,authorId: Schema.String,tags: Schema.Array(Schema.String),publishedAt: Schema.DateFromString,});
import { defineCollection } from "@foldcms/core";import { jsonFilesLoader } from "@foldcms/core/loaders";
const posts = defineCollection({loadingSchema: PostSchema,loader: jsonFilesLoader(PostSchema, { folder: "content/posts"}),relations: { authorId: { type: "single", field: "authorId", target: "authors" }}});
const cms = yield* CmsTag;
// Get all posts - fully typed!const posts = yield* cms.getAll("posts");// ^? readonly Post[]
// Get specific postconst post = yield* cms.getById("posts", "hello-world");// ^? Option<Post>
// Load relations with type safetyconst author = yield* cms.loadRelation("posts", post, "authorId");// ^? Option<Author>
JSON Files
Perfect for structured data like products, authors, and configuration.
jsonFilesLoader(ProductSchema, {folder: "content/products"})
YAML Files
Human-friendly format for categories, tags, and settings.
yamlFilesLoader(CategorySchema, {folder: "content/categories"})
MDX
Rich content with frontmatter, code blocks, and React components.
mdxLoader(BlogPostSchema, {folder: "content/blog",bundlerOptions: {}})
Custom Loaders
Stream-based API for loading from anywhere: databases, APIs, or custom formats.
Stream.fromIterableEffect(Effect.tryPromise(() => fetch("/api/data")))
FoldCMS supports powerful, type-safe relationships between your content:
Single Relations
One-to-one relationships. Returns Option<T>
.
relations: { authorId: { type: "single", field: "authorId", target: "authors" }}
Array Relations
One-to-many relationships. Returns readonly T[]
.
relations: { tagIds: { type: "array", field: "tagIds", target: "tags" }}
Map Relations
Key-value relationships. Returns ReadonlyMap<string, T>
.
relations: { translations: { type: "map", field: "i18nMap", target: "content" }}
FoldCMS is framework-agnostic. Build once during deployment, query anywhere in your application.
Built on Effect, the most powerful TypeScript framework for building robust applications.
Composable
Build complex workflows from simple, reusable pieces. Effect’s composition model makes your CMS logic readable and maintainable.
Testable
Pure functional architecture means testing is effortless. No mocks, no stubs—just supply dependencies and validate outputs.
Reliable
Structured errors instead of thrown exceptions. Know exactly what can fail and handle it elegantly with LoadingError
, ValidationError
, and TransformationError
.
# Install FoldCMSbun add @foldcms/core effect @effect/platform @effect/sql-sqlite-bun
# Create your first collectionimport { defineCollection, makeCms, build } from "@foldcms/core";import { jsonFilesLoader } from "@foldcms/core/loaders";
const posts = defineCollection({loadingSchema: PostSchema,loader: jsonFilesLoader(PostSchema, { folder: "content/posts" })});
const { CmsTag, CmsLayer } = makeCms({ collections: { posts } });
// Build and queryyield* build({ collections: { posts } });const cms = yield* CmsTag;const allPosts = yield* cms.getAll("posts");
Ready to build something amazing?
Get started with FoldCMS today and experience content management with full type safety, zero runtime cost, and the power of Effect.