Architecture Overview
LusterCMS follows a modern, modular architecture.
System Architecture
┌─────────────────────────────────────────────────────────────┐
│ Clients │
│ Browser │ Mobile App │ External API │ CLI │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Load Balancer / CDN │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ WebSocket │
│ (Next.js) │ │ (FastAPI) │ │ (Y.js Collab) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ Redis │ │ AI Providers │
│ (Database) │ │ (Cache) │ │ (OpenAI, etc.) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Frontend Architecture
frontend/
├── app/ # Next.js App Router
│ ├── admin/ # Admin panel pages
│ ├── api/ # API routes
│ └── (public)/ # Public pages
├── components/ # React components
├── graphql/ # GraphQL queries/mutations
├── hooks/ # Custom React hooks
├── lib/ # Utilities
└── types/ # TypeScript types
Backend Architecture
core/
├── api/ # API layer (GraphQL, REST)
├── auth/ # Authentication
├── content/ # Content management
├── media/ # Media handling
├── ai/ # AI services
├── plugins/ # Plugin system
└── hooks.py # Hook definitions
plugins/
├── calendar/ # Calendar plugin
├── ecommerce/ # E-commerce plugin
├── linkedin/ # LinkedIn plugin
└── ...
Data Flow
- Request → Frontend or API client
- Authentication → JWT validation
- Authorization → Permission check
- Business Logic → Service layer
- Data Access → SQLAlchemy ORM
- Response → JSON/GraphQL
Key Components
Plugin System (Pluggy)
from core.hooks import hookimpl
class MyPlugin:
@hookimpl
def after_content_save(self, entry_id):
# React to content save
pass
GraphQL (Strawberry)
@strawberry.type
class Query:
@strawberry.field
def entries(self) -> List[Entry]:
return get_entries()
Collaboration (Y.js)
Real-time sync via WebSocket with conflict-free replicated data types (CRDTs).
Security
- JWT authentication
- Role-based access control (RBAC)
- Input validation (Pydantic)
- SQL injection prevention (ORM)
- XSS protection (React)