Ensar CMS

Enterprise Cloud Content Management System

ExpertCMSSpring BootReactTypeScriptAI ChatS3MySQLRedis

This expert-level architectural design prompt guides you through building a comprehensive, production-ready enterprise cloud CMS similar to Box/Dropbox. Features secure file storage with S3, document management, AI-powered document chat with GPT-4, rich notes editor, version control, and complete DevOps infrastructure. Perfect for building enterprise content management and collaboration platforms.

Secure File Management

Complete file management system with S3 storage, presigned URLs, folder tree navigation, drag & drop upload, version history, soft delete with trash, and ownership-based access control

AI Document Chat

Split-screen document viewer with AI-powered chat using GPT-4, context-aware Q&A, semantic retrieval, document summaries, key insights extraction, and conversation memory with export

Rich Notes Editor

Notion-like notes system with rich text editing, code blocks with syntax highlighting, tables, diagrams (Mermaid), math (KaTeX), version history with diff view, and templates

Enterprise Security

BCrypt password hashing, JWT authentication, Google OAuth, RBAC with roles/permissions, rate limiting, S3 private buckets, XSS protection, CORS & CSRF protection, and audit logs

The Prompt

## Prompt: Build "Ensar CMS" – Enterprise Cloud Content Management System

You are a **senior full-stack architect and product engineer**.
Design and generate a **production-ready, enterprise-grade cloud Content Management System (CMS)** named **Ensar CMS**, similar to **Box / Dropbox**, with secure file storage, document management, rich notes, and AI-powered document chat.

### 1. High-Level Architecture

* Full-stack application with **separate frontend and backend directories**
* **Frontend**

  * React 18+
  * TypeScript
  * Vite
  * Modern component-based architecture
* **Backend**

  * Spring Boot 3.x
  * Java 17+
  * RESTful APIs
* **Database**

  * MySQL (primary relational store)
* **Caching**

  * Redis (Spring Cache abstraction)
* **File Storage**

  * Amazon S3 (private buckets + presigned URLs)
* **Authentication**

  * Username / Password
  * Google OAuth
  * JWT-based session management

---

### 2. Authentication & Authorization

Design a secure authentication system with:

* User registration (username, email, password)
* Strong password rules (length, case, number, special character)
* Duplicate username/email validation
* Login via credentials or Google OAuth
* JWT issuance and validation
* Logout with token invalidation
* Role-based access control (RBAC)

  * Roles: `USER`, `ADMIN`
  * Permission-based API protection

---

### 3. Public Pages & UI Structure

Create a professional SaaS-style UI with:

* Landing page

  * Header with logo & navigation
  * Hero section with value proposition
  * CTA buttons
  * Features grid
  * Industries / use-cases section
* Auth pages

  * Login page (2-column layout)
  * Registration page (2-column layout)
  * Google Sign-In option
* Responsive, modern design

---

### 4. File Management System

Implement a full file manager similar to Dropbox:

* Folder tree navigation (sidebar)
* Main content area (list & grid view toggle)
* File & folder metadata:

  * Name, type, size, owner, last modified
* Operations:

  * Create folders
  * Upload files (drag & drop, multi-file)
  * Rename (inline)
  * Move (drag or dialog)
  * Download (single & bulk)
  * Soft delete → Trash → Restore
* Secure S3 storage using presigned URLs
* Ownership-based access control

---

### 5. File Preview & Metadata Panel

When a file is selected:

* Preview panel opens
* Image preview with zoom
* PDF/document inline viewer
* Metadata display:

  * Owner
  * Created / modified date
  * Size
  * MIME type
* Actions:

  * Download
  * Rename
  * Move
  * Delete
  * Share (future-ready)
* File version history
* Full audit trail of file actions

---

### 6. Document Viewer + AI Chat (Core Feature)

Create a split-screen document viewer:

* Left: document preview
* Right: AI chat panel
* Supported formats:

  * PDF
  * Word
* Viewer capabilities:

  * Page navigation
  * Thumbnails
  * Zoom (50%–200%)
  * Rotate
  * Fullscreen
  * Download / Print
* Background processing:

  * Text extraction (PDFBox, POI)
  * Thumbnail generation
  * Indexed for AI + search

---

### 7. AI-Powered Document Chat

Enable conversational AI over documents:

* Chat session per document
* Context-aware Q&A
* Semantic retrieval using embeddings
* Use GPT-4 (or equivalent)
* Capabilities:

  * Summaries
  * Q&A
  * Key insight extraction
  * Concept explanations
* Conversation memory
* Export chat history
* Token tracking & rate limiting

  * Example: 50 messages/hour/user

---

### 8. Notes & Document Creation

Build a Notion-like notes system:

* Three-panel layout:

  * Left: folders & filters
  * Middle: notes list
  * Right: rich text editor
* Rich text editor features:

  * Headings H1–H6
  * Formatting (bold, italic, underline)
  * Lists
  * Tables
  * Images
  * Links
  * Code blocks (syntax highlighting)
  * Blockquotes
  * Diagrams (Mermaid)
  * Math (KaTeX)

---

### 9. Advanced Notes Features

* Tags with autocomplete
* Pin / favorite notes
* Folder organization
* Version history (up to 50 versions)
* Side-by-side diff view
* Full-text search with filters
* Templates:

  * Meeting notes
  * Project plans
  * Research
  * Case studies
  * To-do lists (checkboxes)

---

### 10. Import & Export

Support:

* Export formats:

  * Markdown
  * PDF
  * HTML
  * DOCX
  * TXT
* Bulk export (ZIP)
* Import from:

  * Markdown
  * Word
  * HTML
  * TXT
  * Notion / Evernote-style formats
* Preserve formatting & structure

---

### 11. Collaboration (Future-Ready)

Design architecture to support:

* File & note sharing
* Read / write permissions
* Real-time collaboration
* Comments & annotations
* Collaboration audit logs

---

### 12. Caching Strategy

* Redis caching:

  * User profiles (1h)
  * Folder trees (30m)
  * File metadata (15m)
  * Extracted text (long-lived)
  * AI embeddings (7 days)
* Automatic cache invalidation
* Frontend caching using React Query

---

### 13. Logging & Monitoring

* Structured logging (Logback)
* Log levels: INFO, DEBUG, WARN, ERROR
* Correlation IDs for tracing
* Centralized log aggregation (ELK / CloudWatch)
* Metrics & health monitoring

---

### 14. Validation & Error Handling

* Frontend validation (React Hook Form + Zod)
* Backend validation (Bean Validation)
* Global exception handling
* Standardized error responses
* Proper HTTP status codes:

  * 400, 401, 403, 404, 500

---

### 15. Security Requirements

* BCrypt password hashing
* HTTPS only
* JWT expiration & refresh strategy
* Rate limiting (auth & AI APIs)
* File access validation
* S3 private buckets
* Malware scanning (design-ready)
* XSS protection & HTML sanitization
* CORS & CSRF protection

---

### 16. Performance Optimization

* Indexed DB queries
* Async background jobs
* Connection pooling (HikariCP)
* Lazy loading (frontend)
* Virtual scrolling
* PDF lazy page rendering
* Memoization & debouncing

---

### 17. Data Backup & Recovery

* Automated DB backups
* S3 versioning & lifecycle policies
* Soft delete with retention (30 days)
* Audit logs for compliance

---

### 18. Development Best Practices

* Clean architecture
* SOLID principles
* Linting & formatting
* Unit, integration, and E2E testing
* Git feature-branch workflow
* Swagger / OpenAPI docs
* README + architecture docs

---

### 19. Deployment & DevOps

* Dockerized frontend & backend
* Docker Compose for local dev
* Cloud deployment ready (AWS/Azure)
* CI/CD pipeline
* Health checks
* Auto-scaling & load balancing
* Observability (APM, logs, metrics)

---

**Goal:**
Use this prompt to generate **production-quality implementation** using AI tools (GitHub Copilot / ChatGPT) while following enterprise standards for **security, scalability, and maintainability**.

---

Comprehensive Design Areas (19 Sections)

High-Level Architecture
Authentication & Authorization
Public Pages & UI Structure
File Management System
File Preview & Metadata Panel
Document Viewer + AI Chat
AI-Powered Document Chat
Notes & Document Creation
Advanced Notes Features
Import & Export
Collaboration (Future-Ready)
Caching Strategy
Logging & Monitoring
Validation & Error Handling
Security Requirements
Performance Optimization
Data Backup & Recovery
Development Best Practices
Deployment & DevOps

Tips for Using This Prompt

  • Enterprise Architecture: This prompt generates a comprehensive enterprise CMS similar to Box/Dropbox with complete file management, document viewing, AI chat, and rich notes editor - perfect for building production-ready content management platforms.

  • AI Document Chat: Implement split-screen document viewer with AI-powered chat using GPT-4, semantic retrieval with embeddings, context-aware Q&A, document summaries, and conversation memory with rate limiting (50 messages/hour/user).

  • Secure File Storage: Design S3-based file storage with presigned URLs, folder tree navigation, drag & drop upload, version history, soft delete with 30-day retention, ownership-based access control, and malware scanning readiness.

  • Rich Notes System: Build Notion-like notes with rich text editor supporting H1-H6, tables, code blocks with syntax highlighting, Mermaid diagrams, KaTeX math, version history (50 versions), diff view, templates, and full-text search.

  • Multi-Format Support: Include import/export for Markdown, PDF, HTML, DOCX, TXT with bulk export to ZIP, and support for Notion/Evernote-style formats while preserving formatting and structure.

  • Complete DevOps: Design Docker containerization for frontend/backend, Docker Compose for local dev, cloud deployment readiness (AWS/Azure), CI/CD pipeline, auto-scaling, load balancing, and comprehensive observability with APM, logs, and metrics.