AI-powered CMS Core for personal blogs, creator homepages & content websites.
MX Space Core is a headless CMS server built with NestJS, MongoDB, and Redis. Beyond standard blog features (posts, pages, notes, comments, categories, feeds, search), it ships with a full AI content workflow β summary generation, multi-language translation, comment moderation, and writing assistance β powered by pluggable LLM providers.
| Category | Capabilities |
|---|---|
| Content Management | Posts, notes, pages, drafts, categories, topics, comments, snippets, projects, friend links, subscriptions |
| AI Workflow | Summary generation, multi-language translation, comment moderation, writing assistance, streaming responses |
| LLM Providers | OpenAI, OpenAI-compatible, Anthropic, OpenRouter |
| Real-time | WebSocket via Socket.IO with Redis adapter for multi-instance broadcast |
| Distribution | RSS/Atom feeds, sitemap, Algolia search, aggregate API |
| Auth | JWT sessions, passkeys, OAuth, API keys (via better-auth) |
| Deployment | Docker (multi-arch), PM2, standalone binary |
- Runtime: Node.js >= 22 + TypeScript 5.9
- Framework: NestJS 11 + Fastify
- Database: MongoDB 7 (Mongoose / TypeGoose)
- Cache: Redis (ioredis)
- Validation: Zod 4
- WebSocket: Socket.IO + Redis Emitter
- AI: OpenAI SDK, Anthropic SDK
- Editor: Lexical (via @haklex/rich-headless)
- Auth: better-auth (session, passkey, API key)
- Testing: Vitest + in-memory MongoDB/Redis
mx-core/ βββ apps/ β βββ core/ # Main server application (NestJS) βββ packages/ β βββ api-client/ # @mx-space/api-client β SDK for frontend & third-party clients β βββ webhook/ # @mx-space/webhook β Webhook integration SDK βββ docker-compose.yml # Development stack (Mongo + Redis) βββ dockerfile # Multi-stage production build βββ docker-compose.server.yml # Production deployment template src/ βββ modules/ # 44 business modules β βββ ai/ # AI summary, translation, writer, task queue β βββ auth/ # JWT, OAuth, passkey, API key β βββ post/ # Blog posts β βββ note/ # Short notes with topic support β βββ comment/ # Nested comments + AI moderation β βββ configs/ # Runtime configuration β βββ webhook/ # Event dispatch to external services β βββ serverless/ # User-defined serverless functions β βββ ... # page, draft, category, topic, feed, search, etc. βββ processors/ # Infrastructure services β βββ database/ # MongoDB connection + model registry β βββ redis/ # Cache, pub/sub, emitter β βββ gateway/ # WebSocket (admin, web, shared namespaces) β βββ task-queue/ # Distributed job queue (Redis + Lua) β βββ helper/ # Email, image, JWT, Lexical, URL builder, etc. βββ common/ # Guards, interceptors, decorators, filters, pipes βββ constants/ # Business events, cache keys, error codes βββ transformers/ # Response transformation (snake_case, pagination) βββ migration/ # Versioned DB migrations (v2 β v10) βββ utils/ # 34 utility modules | Dependency | Version |
|---|---|
| Node.js | >= 22 |
| pnpm | Latest (via Corepack) |
| MongoDB | 7.x |
| Redis | 7.x |
# Enable Corepack for pnpm corepack enable # Install dependencies pnpm install # Start MongoDB + Redis (via Docker) docker compose up -d mongo redis # Start dev server (port 2333) pnpm devThe API is available at http://localhost:2333. In development mode, routes have no /api/v2 prefix.
The fastest way to get a production instance running:
# Clone and enter the project git clone https://github.com/mx-space/core.git && cd core # Edit environment variables cp docker-compose.server.yml docker-compose.prod.yml # Edit docker-compose.prod.yml β set JWT_SECRET, ALLOWED_ORIGINS, etc. # Start all services docker compose -f docker-compose.prod.yml up -dOr use the prebuilt image directly:
docker pull innei/mx-server:latestThe image supports linux/amd64 and linux/arm64.
Run from the repository root:
| Command | Description |
|---|---|
pnpm dev | Start development server (watch mode) |
pnpm build | Build the core application |
pnpm bundle | Create production bundle (tsdown) |
pnpm test | Run test suite (Vitest) |
pnpm lint | Run ESLint with auto-fix |
pnpm typecheck | TypeScript type checking |
pnpm format | Format code with Prettier |
# Run all tests pnpm test # Run a specific test file pnpm test -- test/src/modules/user/user.service.spec.ts # Run tests matching a pattern pnpm test -- --testNamePattern="should create user" # Watch mode pnpm -C apps/core run test:watch| Variable | Description | Default |
|---|---|---|
JWT_SECRET | Secret for JWT signing | Required |
ALLOWED_ORIGINS | CORS allowed origins (comma-separated) | β |
DB_HOST | MongoDB host | localhost |
REDIS_HOST | Redis host | localhost |
REDIS_PORT | Redis port | 6379 |
REDIS_PASSWORD | Redis password | β |
MONGO_CONNECTION | Full MongoDB connection string (overrides DB_HOST) | β |
ENCRYPT_ENABLE | Enable field encryption | false |
ENCRYPT_KEY | 64-char hex encryption key | β |
THROTTLE_TTL | Rate limit window (seconds) | 10 |
THROTTLE_LIMIT | Max requests per window | 100 |
PORT | Server port | 2333 |
TZ | Timezone | Asia/Shanghai |
DISABLE_CACHE | Disable Redis caching | false |
Configuration can also be provided via CLI arguments or YAML files. See apps/core/src/app.config.ts for the full config schema.
All responses are automatically transformed by interceptors:
- Array β
{ data: [...] } - Object β returned as-is
- Paginated (via
@Paginator) β{ data: [...], pagination: {...} } - Bypass (via
@Bypass) β raw response
All response keys are converted to snake_case (e.g., createdAt β created_at).
v10 includes a breaking auth system refactor. See Upgrading to v10.
| Project | Description |
|---|---|
| Shiroi | Next.js frontend |
| mx-admin | Vue 3 admin dashboard |
| @mx-space/api-client | TypeScript API client SDK |
| @haklex/rich-headless | Lexical editor (server-side) |
apps/β AGPLv3 with Additional Terms- Everything else β MIT
See LICENSE for full details.