Full-Stack Lego Block

Content Management System

Headless CMS with flexible content modeling, rich media library, version control, publishing workflow, and multi-language support for modern content-driven applications.

Custom Content Types
Version Control
Multi-Language
Media Library
Role-Based Access
RESTful
API First
WYSIWYG
Rich Editor
Asset
Management
Headless
Decoupled

Scope & Features

A comprehensive headless CMS solution that provides content authors with powerful tools while giving developers complete API flexibility.

Must Have

  • Custom content type builder with field definitions
  • Rich text editor with markdown and WYSIWYG modes
  • Media library with image optimization and CDN
  • Publishing workflow (draft, review, published, archived)
  • Version control and rollback for content entries
  • Multi-language support with translation management
  • Role-based permissions (admin, editor, author, viewer)
  • RESTful and GraphQL API endpoints
  • SEO metadata management for all content
  • Content relationships and references

Nice to Have

  • Scheduled publishing with timezone support
  • Content preview with shareable links
  • Bulk operations for content management
  • Content migration tools and import/export
  • Webhook notifications for content changes
  • Custom field validators and constraints

Three-Tier Architecture

Modern full-stack architecture built with Next.js, providing both admin UI and headless API access for maximum flexibility.

Frontend Layer

Technologies

Next.js 15 (App Router)React 19TipTap Rich EditorReact Hook FormTanStack Query

Features

  • Content type builder UI
  • WYSIWYG editor with markdown
  • Media library with drag-drop
  • Preview and publishing controls
  • Multi-language content editor

API Layer

Technologies

Next.js API RoutestRPC or RESTGraphQL (optional)Zod ValidationNextAuth.js

Features

  • Content CRUD operations
  • Media upload and processing
  • Version control endpoints
  • Publishing workflow logic
  • Role-based access control

Database Layer

Technologies

PostgreSQLPrisma ORMVercel Blob StorageFull-text searchJSON columns

Features

  • Content types and entries
  • Version history tracking
  • Media metadata storage
  • User roles and permissions
  • Translation management
Content Modeling

Flexible Content Types

Define custom content types with rich field types, validations, and relationships for complete content modeling flexibility.

Field Types

Short Text
Long Text
Rich Text
Number
Boolean
Date/Time
URL
Email
Media (Image/Video)
File Upload
JSON Object
Array/List
Reference (Relation)
Location (Geo)
Color Picker
Enum/Select

Example: Blog Post Type

{
  "name": "Blog Post",
  "apiId": "blog_post",
  "fields": [
    {
      "name": "Title",
      "type": "text",
      "required": true,
      "maxLength": 200
    },
    {
      "name": "Slug",
      "type": "slug",
      "required": true,
      "unique": true
    },
    {
      "name": "Content",
      "type": "richText",
      "required": true
    },
    {
      "name": "Featured Image",
      "type": "media",
      "required": false
    },
    {
      "name": "Author",
      "type": "reference",
      "contentType": "author"
    },
    {
      "name": "Tags",
      "type": "array",
      "itemType": "reference",
      "contentType": "tag"
    },
    {
      "name": "Published At",
      "type": "datetime"
    }
  ]
}

Validations

  • Required fields and optional fields
  • Min/max length for text fields
  • Pattern matching with regex
  • Unique constraints (slug, email)
  • Custom validators via functions
Data Schema

Database Schema (PostgreSQL)

Normalized schema with proper indexing, foreign keys, and JSON columns for flexible content storage.

content_types

Content type definitions

Columns

id (UUID, PK)
name (VARCHAR(100))
api_id (VARCHAR(100), unique)
description (TEXT)
fields (JSONB)
is_active (BOOLEAN)
created_at (TIMESTAMP)
updated_at (TIMESTAMP)

content_entries

Content entry data

Columns

id (UUID, PK)
content_type_id (UUID, FK)
data (JSONB)
status (ENUM: draft, review, published, archived)
locale (VARCHAR(10))
published_at (TIMESTAMP)
created_by (UUID, FK → users)
created_at (TIMESTAMP)
updated_at (TIMESTAMP)

Indexes

content_type_idstatuslocalepublished_atdata (GIN)

content_versions

Version history tracking

Columns

id (UUID, PK)
content_entry_id (UUID, FK)
version_number (INT)
data (JSONB)
changed_by (UUID, FK → users)
change_summary (TEXT)
created_at (TIMESTAMP)

Indexes

content_entry_idversion_number

media_assets

Media library items

Columns

id (UUID, PK)
filename (VARCHAR(255))
original_filename (VARCHAR(255))
mime_type (VARCHAR(100))
size_bytes (BIGINT)
width (INT)
height (INT)
storage_url (TEXT)
alt_text (TEXT)
tags (TEXT[])
uploaded_by (UUID, FK → users)
created_at (TIMESTAMP)

Indexes

mime_typetags (GIN)uploaded_by

translations

Multi-language translations

Columns

id (UUID, PK)
content_entry_id (UUID, FK)
locale (VARCHAR(10))
field_key (VARCHAR(100))
translated_value (TEXT)
status (ENUM: pending, translated, approved)
translated_by (UUID, FK → users)
created_at (TIMESTAMP)

Indexes

content_entry_idlocalefield_key

users

User accounts and roles

Columns

id (UUID, PK)
email (VARCHAR(255), unique)
name (VARCHAR(100))
role (ENUM: admin, editor, author, viewer)
avatar_url (TEXT)
is_active (BOOLEAN)
last_login_at (TIMESTAMP)
created_at (TIMESTAMP)

Indexes

emailrole
Media Management

Rich Media Library

Upload, organize, and optimize images, videos, and files with automatic processing and CDN delivery.

Upload & Processing

  • Drag-and-drop multi-file upload
  • Automatic image optimization
  • Multiple size variants generation
  • WebP and AVIF conversion
  • Video thumbnail extraction
  • File type validation

Organization

  • Folder-based organization
  • Tag-based categorization
  • Alt text and captions
  • Search and filtering
  • Grid and list view modes
  • Bulk operations (tag, delete, move)

Delivery & CDN

  • Vercel Blob Storage integration
  • Global CDN distribution
  • On-demand image transformation
  • Responsive image URLs
  • Automatic cache invalidation
  • Usage analytics and quotas
Publishing

Publishing Workflow

Structured content lifecycle from draft to published with approval workflows and scheduled publishing.

Draft

Initial creation and editing state

Available Actions

Edit
Request Review
Delete

Review

Submitted for approval by editor/admin

Available Actions

Approve
Request Changes
Reject

Published

Live and publicly accessible

Available Actions

Unpublish
Archive
Create Version

Archived

Removed from public view but retained

Available Actions

Restore to Draft
Delete Permanently

Workflow Rules & Permissions

Role Permissions

AdminFull access: create, edit, review, publish, delete all content
EditorCreate, edit, review, and publish own or assigned content
AuthorCreate and edit own content, submit for review
ViewerRead-only access to all content and drafts

Advanced Features

  • Scheduled publishing with timezone support
  • Auto-save drafts every 30 seconds
  • Content preview with shareable links
  • Approval notifications via email/in-app
  • Activity log for all content changes
  • Bulk status changes (publish multiple)
Version Control

Version History & Rollback

Track all changes with complete version history and one-click rollback to any previous state.

Automatic Versioning

  • New version created on every publish
  • Capture full content snapshot
  • Track user who made changes
  • Optional change summary notes
  • Timestamp all modifications
  • Store up to 100 versions per entry

Rollback & Compare

  • One-click rollback to any version
  • Side-by-side diff view
  • Highlight changed fields
  • Preview before restoring
  • Restore creates new version (non-destructive)
  • Version branching for major changes

Version History Example

v8Current
2025-12-17 14:30

Updated hero image and adjusted heading

by Alice Chen
v7Published
2025-12-15 09:15

Fixed typos in introduction paragraph

by Bob Smith
v6Published
2025-12-12 16:45

Added new section on pricing

by Alice Chen
v5Published
2025-12-10 11:20

Updated meta description for SEO

by Carol Davis
v4Archived
2025-12-08 13:00

Removed outdated content

by Bob Smith
RESTful API

API Endpoints

Headless API for programmatic content management with authentication, filtering, and pagination.

GET
/api/content-types
List all content type definitions
POST
/api/content-types
Create new content type
GET
/api/content/:type
List entries for content type (with filters, pagination, locale)
POST
/api/content/:type
Create new content entry
PUT
/api/content/:type/:id
Update content entry
DELETE
/api/content/:type/:id
Delete content entry
POST
/api/content/:type/:id/publish
Change status (draft → review → published)
GET
/api/content/:type/:id/versions
Get version history for entry
POST
/api/content/:type/:id/rollback
Rollback to specific version
POST
/api/media/upload
Upload media file(s) to blob storage
GET
/api/media
List media assets (with filters, tags)
DELETE
/api/media/:id
Delete media asset

API Features

Authentication & Security

  • NextAuth.js with JWT tokens
  • API key authentication option
  • Role-based access control (RBAC)
  • Rate limiting per user/API key
  • CORS configuration for cross-origin

Query Features

  • Filtering by field values (eq, ne, in, contains)
  • Sorting by any field (asc/desc)
  • Pagination (cursor or offset-based)
  • Field selection (include/exclude)
  • Locale filtering for multi-language
Admin Interface

Admin UI Pages

Intuitive admin interface built with Next.js and React for managing all aspects of your content.

Content Dashboard

  • Overview of all content types
  • Recent activity feed
  • Quick actions and search
  • Status statistics
  • Scheduled posts calendar

Content Editor

  • TipTap WYSIWYG rich text editor
  • Markdown mode toggle
  • Field-by-field editing
  • Real-time auto-save
  • Preview pane
  • SEO metadata panel

Media Library

  • Grid/list view with thumbnails
  • Drag-and-drop upload
  • Folder organization
  • Tag-based filtering
  • Bulk operations
  • Asset details editor

Content Types Builder

  • Visual field builder
  • Drag-and-drop field ordering
  • Field validation rules
  • Relationship configuration
  • Import/export schemas

User Management

  • User list with roles
  • Invite team members
  • Permission assignments
  • Activity logs per user
  • Access revocation

Analytics

  • Content performance metrics
  • User engagement stats
  • Publishing trends
  • Media usage reports
  • Export to CSV

Production Benefits & Done Criteria

A complete, production-ready headless CMS solution for modern content-driven applications.

Key Benefits

  • Flexible content modeling with custom types and fields
  • Rich editing experience with WYSIWYG and markdown
  • Version control with full rollback capabilities
  • Publishing workflow with multi-stage approval
  • Multi-language support for global content
  • Role-based permissions for team collaboration
  • Media library with optimization and CDN delivery
  • RESTful API for headless architecture
  • Scheduled publishing with timezone support
  • SEO metadata management for all content

Definition of Done

  • All content types CRUD operations working
  • TipTap editor integrated with auto-save
  • Media upload with image optimization
  • Version history tracking and rollback functional
  • Publishing workflow (draft/review/published) implemented
  • Multi-language translation UI complete
  • Role-based permissions enforced on all endpoints
  • Admin UI pages for all major functions
  • API documentation generated
  • Test coverage >80% on core CMS logic

Build Your Next Product With AI Expertise

Experience the future of software development. Let our GenAI platform accelerate your next project.

Schedule a Free AI Blueprint Session