{"_id":"b-dashboard-plugin-cms","name":"b-dashboard-plugin-cms","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"b-dashboard-plugin-cms","version":"1.0.1","description":"Headless CMS plugin for B-Dashboard with content modeling, multi-database support, and auto-generated APIs","keywords":["b-dashboard","plugin","cms","headless-cms","content-management","api","sqlite","mysql","postgresql"],"author":{"name":"B-Dashboard Team","email":"plugins@b-dashboard.dev","url":"https://b-dashboard.dev"},"license":"MIT","homepage":"https://b-dashboard.dev/plugins/cms","repository":{"type":"git","url":"git+https://github.com/b-dashboard/plugin-cms.git"},"bugs":{"url":"https://github.com/b-dashboard/plugin-cms/issues"},"main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./manifest":{"types":"./dist/manifest.d.ts","import":"./dist/manifest.mjs","require":"./dist/manifest.js"},"./schemas":{"types":"./dist/schemas.d.ts","import":"./dist/schemas.mjs","require":"./dist/schemas.js"},"./services":{"types":"./dist/services/index.d.ts","import":"./dist/services/index.mjs","require":"./dist/services/index.js"},"./components":{"types":"./dist/components/index.d.ts","import":"./dist/components/index.mjs","require":"./dist/components/index.js"}},"scripts":{"dev":"tsup --watch","build":"tsup","lint":"eslint src/","typecheck":"tsc --noEmit","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","prepublishOnly":"pnpm build"},"peerDependencies":{"next":">=14.0.0","react":">=18.0.0"},"dependencies":{"better-sqlite3":"^11.8.1","date-fns":"^4.1.0","sanitize-html":"^2.14.0","slugify":"^1.6.6","uuid":"^11.1.0","zod":"^3.24.2"},"devDependencies":{"@types/better-sqlite3":"^7.6.12","@types/node":"^22.13.1","@types/pg":"^8.16.0","@types/react":"^19.0.8","@types/sanitize-html":"^2.13.0","@types/uuid":"^10.0.0","eslint":"^9.19.0","tsup":"^8.5.1","typescript":"^5.7.3","vitest":"^3.0.5"},"optionalDependencies":{"mysql2":"^3.12.0","pg":"^8.13.3"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"_id":"b-dashboard-plugin-cms@1.0.1","gitHead":"9fadd6a569bf2073c8df4586932881ac7ab42ad0","_nodeVersion":"22.18.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-+7rnfjD7ID+N6YJ8/CyN7uKP7qG8GQiewPSNJeP3Z5yjx0R1HmctyhfDgpDuv82frEEIO+Z/SQV8WeilTWObHA==","shasum":"bfdb768143f606f64ce4b9b86dab8769f9df2b0a","tarball":"https://registry.npmjs.org/b-dashboard-plugin-cms/-/b-dashboard-plugin-cms-1.0.1.tgz","fileCount":25,"unpackedSize":5506399,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCXO+GmzuGESAmYImjGNgaVZnN+doyphIG9Cv6fV5WpLgIhANXoU24D40WkJZWChLvNiaQCW8zP+A96Is1fPpKe3l/w"}]},"_npmUser":{"name":"raghdkun","email":"raghdkun@gmail.com"},"directories":{},"maintainers":[{"name":"raghdkun","email":"raghdkun@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/b-dashboard-plugin-cms_1.0.1_1769174369994_0.483739072336659"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-23T13:19:29.898Z","1.0.1":"2026-01-23T13:19:30.181Z","modified":"2026-01-23T13:19:30.391Z"},"maintainers":[{"name":"raghdkun","email":"raghdkun@gmail.com"}],"description":"Headless CMS plugin for B-Dashboard with content modeling, multi-database support, and auto-generated APIs","homepage":"https://b-dashboard.dev/plugins/cms","keywords":["b-dashboard","plugin","cms","headless-cms","content-management","api","sqlite","mysql","postgresql"],"repository":{"type":"git","url":"git+https://github.com/b-dashboard/plugin-cms.git"},"author":{"name":"B-Dashboard Team","email":"plugins@b-dashboard.dev","url":"https://b-dashboard.dev"},"bugs":{"url":"https://github.com/b-dashboard/plugin-cms/issues"},"license":"MIT","readme":"# @b-dashboard/plugin-cms\r\n\r\nA headless content management system plugin for B-Dashboard with visual content modeling, multi-database support, and auto-generated APIs.\r\n\r\n## Features\r\n\r\n### Core Features (Free)\r\n- 📋 **Visual Content Modeling** - Create and manage content types with drag-and-drop field configuration\r\n- 📝 **12+ Field Types** - Text, Rich Text, Number, Boolean, Date, DateTime, JSON, Media, Relations, Enum, Slug, Email, URL\r\n- 🗃️ **SQLite Database** - Zero-config embedded database\r\n- 🔌 **Auto-generated APIs** - RESTful API endpoints for all content types\r\n- 🖼️ **Media Library** - Upload and manage images, videos, and documents\r\n- 🌍 **Internationalization** - Built-in i18n support with multiple locales\r\n- 📊 **Dashboard Widgets** - Content statistics and recent entries\r\n\r\n### Pro Features (Paid License)\r\n- 🐘 **PostgreSQL Support** - Enterprise-grade database\r\n- 🐬 **MySQL Support** - Popular relational database\r\n- 🔧 **API Builder** - Custom API endpoints and transformations\r\n- 🔗 **Webhooks** - Event-driven integrations\r\n- 📜 **Content Versioning** - Track content history\r\n- ☁️ **CDN Integration** - Optimized media delivery\r\n- 📦 **Import/Export** - Bulk data operations\r\n- ♾️ **Unlimited Content Types & Entries**\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @b-dashboard/plugin-cms\r\n# or\r\npnpm add @b-dashboard/plugin-cms\r\n# or\r\nyarn add @b-dashboard/plugin-cms\r\n```\r\n\r\n## Quick Start\r\n\r\n### 1. Register the Plugin\r\n\r\n```typescript\r\n// app/plugins.ts\r\nimport { registerPlugin } from '@/lib/plugins';\r\nimport cmsPlugin from '@b-dashboard/plugin-cms';\r\n\r\nregisterPlugin(cmsPlugin);\r\n```\r\n\r\n### 2. Initialize the CMS\r\n\r\n```typescript\r\nimport { initializeCMS } from '@b-dashboard/plugin-cms';\r\n\r\n// With default SQLite configuration\r\nawait initializeCMS({});\r\n\r\n// Or with custom configuration\r\nawait initializeCMS({\r\n  database: {\r\n    type: 'sqlite',\r\n    sqlite: { filename: './data/cms.db' }\r\n  },\r\n  media: {\r\n    basePath: './uploads',\r\n    baseUrl: '/uploads',\r\n    maxSize: 10 * 1024 * 1024, // 10MB\r\n    allowedTypes: ['image/*', 'video/*', 'application/pdf']\r\n  },\r\n  content: {\r\n    defaultLocale: 'en',\r\n    locales: ['en', 'ar', 'es'],\r\n    enableDrafts: true,\r\n    enableVersioning: false\r\n  }\r\n});\r\n```\r\n\r\n### 3. Create a Content Type\r\n\r\n```typescript\r\nimport { contentTypeService } from '@b-dashboard/plugin-cms';\r\n\r\nconst blogPost = await contentTypeService.create({\r\n  name: 'Blog Post',\r\n  slug: 'blog-posts',\r\n  description: 'Blog articles',\r\n  fields: [\r\n    {\r\n      id: 'title',\r\n      name: 'Title',\r\n      type: 'text',\r\n      required: true\r\n    },\r\n    {\r\n      id: 'content',\r\n      name: 'Content',\r\n      type: 'richtext',\r\n      required: true\r\n    },\r\n    {\r\n      id: 'featured_image',\r\n      name: 'Featured Image',\r\n      type: 'media'\r\n    },\r\n    {\r\n      id: 'published_date',\r\n      name: 'Published Date',\r\n      type: 'date'\r\n    }\r\n  ],\r\n  titleField: 'title'\r\n});\r\n```\r\n\r\n### 4. Create Entries\r\n\r\n```typescript\r\nimport { entryService } from '@b-dashboard/plugin-cms';\r\n\r\nconst post = await entryService.create({\r\n  contentTypeId: blogPost.id,\r\n  status: 'draft',\r\n  data: {\r\n    title: 'My First Blog Post',\r\n    content: '<p>Hello, world!</p>',\r\n    published_date: '2024-01-15'\r\n  }\r\n});\r\n\r\n// Publish the entry\r\nawait entryService.publish('blog-posts', post.id);\r\n```\r\n\r\n### 5. Query Entries via API\r\n\r\n```typescript\r\nimport { entryService } from '@b-dashboard/plugin-cms';\r\n\r\n// Get all published posts\r\nconst posts = await entryService.getAll('blog-posts', {\r\n  status: 'published',\r\n  sort: 'published_date',\r\n  order: 'desc',\r\n  page: 1,\r\n  limit: 10\r\n});\r\n```\r\n\r\n## API Reference\r\n\r\n### Content Type Service\r\n\r\n```typescript\r\nimport { contentTypeService } from '@b-dashboard/plugin-cms';\r\n\r\n// Get all content types\r\nconst types = await contentTypeService.getAll();\r\n\r\n// Get by ID or slug\r\nconst type = await contentTypeService.getById(id);\r\nconst type = await contentTypeService.getBySlug('blog-posts');\r\n\r\n// Create\r\nconst newType = await contentTypeService.create({ ... });\r\n\r\n// Update\r\nconst updated = await contentTypeService.update(id, { ... });\r\n\r\n// Delete\r\nawait contentTypeService.delete(id);\r\n```\r\n\r\n### Entry Service\r\n\r\n```typescript\r\nimport { entryService } from '@b-dashboard/plugin-cms';\r\n\r\n// List entries with pagination\r\nconst entries = await entryService.getAll('blog-posts', {\r\n  page: 1,\r\n  limit: 20,\r\n  status: 'published',\r\n  search: 'keyword',\r\n  sort: 'createdAt',\r\n  order: 'desc',\r\n  filters: { category: 'tech' }\r\n});\r\n\r\n// CRUD operations\r\nconst entry = await entryService.getById('blog-posts', id);\r\nconst created = await entryService.create({ ... });\r\nconst updated = await entryService.update('blog-posts', id, { ... });\r\nawait entryService.delete('blog-posts', id);\r\n\r\n// Status operations\r\nawait entryService.publish('blog-posts', id);\r\nawait entryService.unpublish('blog-posts', id);\r\nawait entryService.archive('blog-posts', id);\r\n\r\n// Bulk operations\r\nawait entryService.bulkDelete('blog-posts', [id1, id2, id3]);\r\nawait entryService.bulkUpdateStatus('blog-posts', [id1, id2], 'published');\r\n```\r\n\r\n### Media Service\r\n\r\n```typescript\r\nimport { mediaService } from '@b-dashboard/plugin-cms';\r\n\r\n// Configure media service\r\nmediaService.configure({\r\n  basePath: './uploads',\r\n  baseUrl: '/uploads',\r\n  maxSize: 10 * 1024 * 1024,\r\n  allowedTypes: ['image/*', 'video/*', 'application/pdf']\r\n});\r\n\r\n// Upload file\r\nconst result = await mediaService.upload(buffer, {\r\n  filename: 'image.jpg',\r\n  mimeType: 'image/jpeg',\r\n  size: buffer.length,\r\n  alt: 'My image',\r\n  folder: 'blog'\r\n});\r\n\r\n// List media\r\nconst media = await mediaService.getAll({\r\n  page: 1,\r\n  limit: 20,\r\n  folder: 'blog',\r\n  mimeType: 'image/*',\r\n  search: 'keyword'\r\n});\r\n\r\n// Update metadata\r\nawait mediaService.update(id, { alt: 'Updated alt text' });\r\n\r\n// Delete\r\nawait mediaService.delete(id);\r\n```\r\n\r\n### Database Service\r\n\r\n```typescript\r\nimport { databaseService } from '@b-dashboard/plugin-cms';\r\n\r\n// Initialize with configuration\r\nawait databaseService.initialize({\r\n  type: 'sqlite',\r\n  sqlite: { filename: './data/cms.db' }\r\n});\r\n\r\n// For MySQL (Pro)\r\nawait databaseService.initialize({\r\n  type: 'mysql',\r\n  mysql: {\r\n    host: 'localhost',\r\n    port: 3306,\r\n    database: 'cms',\r\n    user: 'root',\r\n    password: 'password'\r\n  }\r\n});\r\n\r\n// For PostgreSQL (Pro)\r\nawait databaseService.initialize({\r\n  type: 'postgresql',\r\n  postgresql: {\r\n    host: 'localhost',\r\n    port: 5432,\r\n    database: 'cms',\r\n    user: 'postgres',\r\n    password: 'password'\r\n  }\r\n});\r\n\r\n// Execute queries\r\nconst result = await databaseService.query('SELECT * FROM cms_content_types');\r\nawait databaseService.execute('UPDATE cms_media SET alt = ? WHERE id = ?', ['alt', id]);\r\n\r\n// Transactions\r\nawait databaseService.transaction(async (tx) => {\r\n  await tx.execute('INSERT INTO ...');\r\n  await tx.execute('UPDATE ...');\r\n});\r\n```\r\n\r\n## Field Types\r\n\r\n| Type | Description | Options |\r\n|------|-------------|---------|\r\n| `text` | Single/multi-line text | minLength, maxLength, pattern, placeholder, multiline |\r\n| `richtext` | HTML formatted text | minLength, maxLength, allowedFormats |\r\n| `number` | Integer or decimal | min, max, step, precision, format |\r\n| `boolean` | True/false toggle | defaultValue, trueLabel, falseLabel |\r\n| `date` | Date without time | minDate, maxDate, format |\r\n| `datetime` | Date with time | minDate, maxDate, format, timezone |\r\n| `json` | Structured JSON data | schema |\r\n| `media` | Files, images, videos | allowedTypes, maxSize, multiple, maxFiles |\r\n| `relation` | Link to other entries | targetType, relationType, displayField, cascade |\r\n| `enum` | Select from options | options, multiple |\r\n| `slug` | URL-friendly text | sourceField, prefix, suffix |\r\n| `email` | Email address | allowedDomains |\r\n| `url` | Web URL | allowedProtocols |\r\n\r\n## License Verification\r\n\r\nThe CMS plugin uses the B-Dashboard license server for premium features:\r\n\r\n```typescript\r\n// Check license status\r\nconst licenseStatus = await checkLicense('@b-dashboard/plugin-cms');\r\n\r\nif (licenseStatus.valid && licenseStatus.features.includes('postgresql_database')) {\r\n  // Enable PostgreSQL support\r\n}\r\n```\r\n\r\n## Directory Structure\r\n\r\n```\r\nplugins/cms/\r\n├── src/\r\n│   ├── index.ts           # Main exports\r\n│   ├── manifest.ts        # Plugin manifest\r\n│   ├── types.ts           # TypeScript types\r\n│   ├── schemas.ts         # Zod validation schemas\r\n│   └── services/\r\n│       ├── index.ts\r\n│       ├── database.service.ts\r\n│       ├── content-type.service.ts\r\n│       ├── entry.service.ts\r\n│       ├── media.service.ts\r\n│       └── migration.service.ts\r\n├── locales/\r\n│   ├── en.json\r\n│   └── ar.json\r\n├── package.json\r\n├── tsconfig.json\r\n├── tsup.config.ts\r\n└── README.md\r\n```\r\n\r\n## Contributing\r\n\r\n1. Fork the repository\r\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\r\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\r\n4. Push to the branch (`git push origin feature/amazing-feature`)\r\n5. Open a Pull Request\r\n\r\n## License\r\n\r\nMIT License - see [LICENSE](LICENSE) for details.\r\n\r\n## Support\r\n\r\n- 📖 [Documentation](https://b-dashboard.dev/plugins/cms)\r\n- 💬 [Discord Community](https://discord.gg/b-dashboard)\r\n- 🐛 [Issue Tracker](https://github.com/b-dashboard/plugin-cms/issues)\r\n- 📧 [Email Support](mailto:support@b-dashboard.dev)\r\n","readmeFilename":"README.md","_rev":"1-53bae3d33bcd5b1ce49cda8f09f0dda4"}