nextjs-cms 0.9.30 → 0.9.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +279 -279
  3. package/dist/api/actions/pages.d.ts +3 -3
  4. package/dist/api/client.d.ts +30 -0
  5. package/dist/api/client.d.ts.map +1 -0
  6. package/dist/api/client.js +82 -0
  7. package/dist/api/index.d.ts +1 -974
  8. package/dist/api/index.d.ts.map +1 -1
  9. package/dist/api/index.js +0 -13
  10. package/dist/api/lib/serverActions.d.ts +13 -49
  11. package/dist/api/lib/serverActions.d.ts.map +1 -1
  12. package/dist/api/lib/serverActions.js +103 -31
  13. package/dist/api/root.d.ts +18 -1916
  14. package/dist/api/root.d.ts.map +1 -1
  15. package/dist/api/root.js +18 -83
  16. package/dist/api/routers/config.d.ts.map +1 -1
  17. package/dist/api/routers/gallery.d.ts +1 -0
  18. package/dist/api/routers/gallery.d.ts.map +1 -1
  19. package/dist/api/routers/gallery.js +36 -8
  20. package/dist/api/routers/hasItemsSection.d.ts +5 -30
  21. package/dist/api/routers/hasItemsSection.d.ts.map +1 -1
  22. package/dist/api/routers/navigation.d.ts +3 -3
  23. package/dist/api/routers/simpleSection.d.ts +3 -15
  24. package/dist/api/routers/simpleSection.d.ts.map +1 -1
  25. package/dist/api/server.d.ts +2748 -0
  26. package/dist/api/server.d.ts.map +1 -0
  27. package/dist/api/server.js +100 -0
  28. package/dist/api/trpc/error-logging.d.ts +14 -0
  29. package/dist/api/trpc/error-logging.d.ts.map +1 -0
  30. package/dist/api/trpc/error-logging.js +75 -0
  31. package/dist/api/trpc/root.d.ts +3 -3
  32. package/dist/api/trpc/root.d.ts.map +1 -1
  33. package/dist/api/trpc/routers/config.d.ts.map +1 -1
  34. package/dist/api/trpc/routers/hasItemsSection.d.ts.map +1 -1
  35. package/dist/api/trpc/routers/navigation.d.ts +3 -3
  36. package/dist/api/trpc/routers/simpleSection.d.ts.map +1 -1
  37. package/dist/api/trpc/server.d.ts +9 -9
  38. package/dist/api/trpc/server.d.ts.map +1 -1
  39. package/dist/api/utils/async-caller-proxy.d.ts +2 -0
  40. package/dist/api/utils/async-caller-proxy.d.ts.map +1 -0
  41. package/dist/api/utils/async-caller-proxy.js +36 -0
  42. package/dist/api/utils/lazy-caller-proxy.d.ts +2 -0
  43. package/dist/api/utils/lazy-caller-proxy.d.ts.map +1 -0
  44. package/dist/api/utils/lazy-caller-proxy.js +36 -0
  45. package/dist/api/utils/router-types.d.ts +7 -0
  46. package/dist/api/utils/router-types.d.ts.map +1 -0
  47. package/dist/api/utils/router-types.js +0 -0
  48. package/dist/auth/trpc.d.ts +1 -1
  49. package/dist/auth/trpc.d.ts.map +1 -1
  50. package/dist/auth/trpc.js +0 -1
  51. package/dist/cli/lib/db-config.js +10 -10
  52. package/dist/cli/lib/update-sections.d.ts.map +1 -1
  53. package/dist/cli/lib/update-sections.js +29 -24
  54. package/dist/core/db/table-checker/MysqlTable.js +10 -10
  55. package/dist/core/factories/section-factory-with-esbuild.js +9 -9
  56. package/dist/core/factories/section-factory-with-jiti.js +9 -9
  57. package/dist/core/sections/category.d.ts +42 -42
  58. package/dist/core/sections/hasItems.d.ts +42 -42
  59. package/dist/core/sections/section.d.ts +22 -22
  60. package/dist/core/sections/simple.d.ts +8 -8
  61. package/dist/plugins/loader.d.ts +3 -1
  62. package/dist/plugins/loader.d.ts.map +1 -1
  63. package/dist/plugins/loader.js +28 -6
  64. package/dist/plugins/manifest.d.ts +28 -0
  65. package/dist/plugins/manifest.d.ts.map +1 -0
  66. package/dist/plugins/manifest.js +83 -0
  67. package/dist/plugins/registry.d.ts +22 -0
  68. package/dist/plugins/registry.d.ts.map +1 -0
  69. package/dist/plugins/registry.js +25 -0
  70. package/dist/translations/client.d.ts +4 -4
  71. package/dist/utils/log.d.ts +18 -0
  72. package/dist/utils/log.d.ts.map +1 -0
  73. package/dist/utils/log.js +28 -0
  74. package/package.json +3 -3
  75. package/dist/core/fields/dateRange.d.ts +0 -115
  76. package/dist/core/fields/dateRange.d.ts.map +0 -1
  77. package/dist/core/fields/dateRange.js +0 -149
  78. package/dist/translations/locale-cookie.d.ts +0 -24
  79. package/dist/translations/locale-cookie.d.ts.map +0 -1
  80. package/dist/translations/locale-cookie.js +0 -44
  81. package/dist/translations/locale-utils.d.ts +0 -8
  82. package/dist/translations/locale-utils.d.ts.map +0 -1
  83. package/dist/translations/locale-utils.js +0 -11
  84. package/dist/translations/localization.d.ts +0 -40
  85. package/dist/translations/localization.d.ts.map +0 -1
  86. package/dist/translations/localization.js +0 -48
  87. package/dist/validators/dateRange.d.ts +0 -11
  88. package/dist/validators/dateRange.d.ts.map +0 -1
  89. package/dist/validators/dateRange.js +0 -16
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 nextjs-cms
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 nextjs-cms
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,180 +1,180 @@
1
- # nextjs-cms
2
-
3
- A headless and comprehensive type-safe content management system built with Nextjs. This package provides all the core functionality for building dynamic CMS-powered websites with authentication, database integration, and extensible content sections.
4
-
5
- ## Features
6
-
7
- - **Type-Safe API**: Built with tRPC for end-to-end type safety
8
- - **Authentication System**: JWT-based authentication with React hooks
9
- - **Database Integration**: Drizzle ORM with MySQL support
10
- - **Extensible Content Sections**: Modular section system with custom fields
11
- - **File Management**: Built-in file upload and management capabilities
12
- - **Internationalization**: Multi-language support with i18next
13
- - **Validation**: Zod schema validation throughout
14
- - **Testing**: Comprehensive unit and integration tests
15
-
16
- ## Installation
17
-
18
- Please install using the create-nextjs-cms package:
19
-
20
- ```bash
21
- npx create-nextjs-cms
22
- # or
23
- yarn create nextjs-cms
24
- # or
25
- pnpm create nextjs-cms
26
- # or
27
- bun create nextjs-cms
28
- ```
29
-
30
- ## Quick Start
31
-
32
- ### 1. Configure Your CMS
33
-
34
- Create a `cms.config.ts` file in your project root:
35
-
36
- ```typescript
37
- import { CMSConfig } from 'nextjs-cms/core/config'
38
-
39
- export default {
40
- ui: {
41
- title: 'My CMS Site',
42
- defaultTheme: 'dark',
43
- logo: '/logo.svg'
44
- },
45
- sections: {
46
- path: './sections',
47
- strict: false,
48
- category: { allowRecursiveDelete: false }
49
- },
50
- media: {
51
- upload: {
52
- path: './public/uploads',
53
- preserveExtension: true
54
- }
55
- }
56
- } satisfies CMSConfig
57
- ```
58
-
59
-
60
- ### 2. Create Content Sections
61
-
62
- Create a section file in your sections folder. Sections are created using helper functions (`simpleSection`, `hasItemsSection`, or `categorySection`), and fields are created using field helper functions.
63
-
64
- #### Simple Section Example
65
-
66
- ```typescript
67
- // sections/about.section.ts
68
- import { richTextField } from 'nextjs-cms/core/fields'
69
- import { simpleSection } from 'nextjs-cms/core/sections'
70
-
71
- const about = richTextField({
72
- name: 'about',
73
- label: 'About',
74
- required: true,
75
- order: 1,
76
- })
77
-
78
- export default simpleSection({
79
- name: 'about',
80
- order: 1,
81
- title: 'About Page',
82
- db: {
83
- table: 'about',
84
- },
85
- fields: [about],
86
- })
87
- ```
88
-
89
- #### Has Items Section Example
90
-
91
- ```typescript
92
- // sections/blog.section.ts
93
- import { textField, richTextField, dateField, photoField } from 'nextjs-cms/core/fields'
94
- import { hasItemsSection } from 'nextjs-cms/core/sections'
95
-
96
- const title = textField({
97
- name: 'title',
98
- label: 'Title',
99
- required: true,
100
- order: 1,
101
- })
102
-
103
- const content = richTextField({
104
- name: 'content',
105
- label: 'Content',
106
- required: true,
107
- order: 2,
108
- })
109
-
110
- const publishDate = dateField({
111
- name: 'publish_date',
112
- label: 'Publish Date',
113
- required: false,
114
- order: 3,
115
- })
116
-
117
- const coverPhoto = photoField({
118
- name: 'coverphoto',
119
- label: 'Cover Photo',
120
- required: false,
121
- order: 4,
122
- })
123
-
124
- export default hasItemsSection({
125
- name: 'blog',
126
- order: 1,
127
- headingField: title,
128
- title: {
129
- section: 'Blog',
130
- singular: 'Post',
131
- plural: 'Posts',
132
- },
133
- db: {
134
- table: 'blog',
135
- },
136
- fields: [title, content, publishDate, coverPhoto],
137
- })
138
- ```
139
-
140
- #### Category Section Example
141
-
142
- ```typescript
143
- // sections/categories.section.ts
144
- import { textField, photoField } from 'nextjs-cms/core/fields'
145
- import { categorySection } from 'nextjs-cms/core/sections'
146
-
147
- const title = textField({
148
- name: 'title',
149
- label: 'Title',
150
- required: true,
151
- order: 1,
152
- })
153
-
154
- const image = photoField({
155
- name: 'image',
156
- label: 'Image',
157
- required: false,
158
- order: 2,
159
- })
160
-
161
- export default categorySection({
162
- name: 'categories',
163
- order: 1,
164
- headingField: title,
165
- title: {
166
- section: 'Categories',
167
- singular: 'Category',
168
- plural: 'Categories',
169
- },
170
- db: {
171
- table: 'categories',
172
- },
173
- fields: [title, image],
174
- depth: 2, // Allow nested categories
175
- })
176
- ```
177
-
1
+ # nextjs-cms
2
+
3
+ A headless and comprehensive type-safe content management system built with Nextjs. This package provides all the core functionality for building dynamic CMS-powered websites with authentication, database integration, and extensible content sections.
4
+
5
+ ## Features
6
+
7
+ - **Type-Safe API**: Built with tRPC for end-to-end type safety
8
+ - **Authentication System**: JWT-based authentication with React hooks
9
+ - **Database Integration**: Drizzle ORM with MySQL support
10
+ - **Extensible Content Sections**: Modular section system with custom fields
11
+ - **File Management**: Built-in file upload and management capabilities
12
+ - **Internationalization**: Multi-language support with i18next
13
+ - **Validation**: Zod schema validation throughout
14
+ - **Testing**: Comprehensive unit and integration tests
15
+
16
+ ## Installation
17
+
18
+ Please install using the create-nextjs-cms package:
19
+
20
+ ```bash
21
+ npx create-nextjs-cms
22
+ # or
23
+ yarn create nextjs-cms
24
+ # or
25
+ pnpm create nextjs-cms
26
+ # or
27
+ bun create nextjs-cms
28
+ ```
29
+
30
+ ## Quick Start
31
+
32
+ ### 1. Configure Your CMS
33
+
34
+ Create a `cms.config.ts` file in your project root:
35
+
36
+ ```typescript
37
+ import { CMSConfig } from 'nextjs-cms/core/config'
38
+
39
+ export default {
40
+ ui: {
41
+ title: 'My CMS Site',
42
+ defaultTheme: 'dark',
43
+ logo: '/logo.svg'
44
+ },
45
+ sections: {
46
+ path: './sections',
47
+ strict: false,
48
+ category: { allowRecursiveDelete: false }
49
+ },
50
+ media: {
51
+ upload: {
52
+ path: './public/uploads',
53
+ preserveExtension: true
54
+ }
55
+ }
56
+ } satisfies CMSConfig
57
+ ```
58
+
59
+
60
+ ### 2. Create Content Sections
61
+
62
+ Create a section file in your sections folder. Sections are created using helper functions (`simpleSection`, `hasItemsSection`, or `categorySection`), and fields are created using field helper functions.
63
+
64
+ #### Simple Section Example
65
+
66
+ ```typescript
67
+ // sections/about.section.ts
68
+ import { richTextField } from 'nextjs-cms/core/fields'
69
+ import { simpleSection } from 'nextjs-cms/core/sections'
70
+
71
+ const about = richTextField({
72
+ name: 'about',
73
+ label: 'About',
74
+ required: true,
75
+ order: 1,
76
+ })
77
+
78
+ export default simpleSection({
79
+ name: 'about',
80
+ order: 1,
81
+ title: 'About Page',
82
+ db: {
83
+ table: 'about',
84
+ },
85
+ fields: [about],
86
+ })
87
+ ```
88
+
89
+ #### Has Items Section Example
90
+
91
+ ```typescript
92
+ // sections/blog.section.ts
93
+ import { textField, richTextField, dateField, photoField } from 'nextjs-cms/core/fields'
94
+ import { hasItemsSection } from 'nextjs-cms/core/sections'
95
+
96
+ const title = textField({
97
+ name: 'title',
98
+ label: 'Title',
99
+ required: true,
100
+ order: 1,
101
+ })
102
+
103
+ const content = richTextField({
104
+ name: 'content',
105
+ label: 'Content',
106
+ required: true,
107
+ order: 2,
108
+ })
109
+
110
+ const publishDate = dateField({
111
+ name: 'publish_date',
112
+ label: 'Publish Date',
113
+ required: false,
114
+ order: 3,
115
+ })
116
+
117
+ const coverPhoto = photoField({
118
+ name: 'coverphoto',
119
+ label: 'Cover Photo',
120
+ required: false,
121
+ order: 4,
122
+ })
123
+
124
+ export default hasItemsSection({
125
+ name: 'blog',
126
+ order: 1,
127
+ headingField: title,
128
+ title: {
129
+ section: 'Blog',
130
+ singular: 'Post',
131
+ plural: 'Posts',
132
+ },
133
+ db: {
134
+ table: 'blog',
135
+ },
136
+ fields: [title, content, publishDate, coverPhoto],
137
+ })
138
+ ```
139
+
140
+ #### Category Section Example
141
+
142
+ ```typescript
143
+ // sections/categories.section.ts
144
+ import { textField, photoField } from 'nextjs-cms/core/fields'
145
+ import { categorySection } from 'nextjs-cms/core/sections'
146
+
147
+ const title = textField({
148
+ name: 'title',
149
+ label: 'Title',
150
+ required: true,
151
+ order: 1,
152
+ })
153
+
154
+ const image = photoField({
155
+ name: 'image',
156
+ label: 'Image',
157
+ required: false,
158
+ order: 2,
159
+ })
160
+
161
+ export default categorySection({
162
+ name: 'categories',
163
+ order: 1,
164
+ headingField: title,
165
+ title: {
166
+ section: 'Categories',
167
+ singular: 'Category',
168
+ plural: 'Categories',
169
+ },
170
+ db: {
171
+ table: 'categories',
172
+ },
173
+ fields: [title, image],
174
+ depth: 2, // Allow nested categories
175
+ })
176
+ ```
177
+
178
178
  ## API Reference
179
179
 
180
180
  ### Extending tRPC
@@ -235,109 +235,109 @@ export const { GET, POST } = trpc.handler
235
235
  #### API
236
236
  - **Server runtime**: `createTRPCRouter`, procedures, and `createTRPCContext` from `nextjs-cms/api/server`
237
237
  - **Client runtime**: `createNextjsCmsClient` and `useAxiosPrivate` from `nextjs-cms/api/client`
238
-
238
+
239
239
  #### Authentication (`nextjs-cms/auth`)
240
240
  - **JWT Management**: Token creation, verification, and refresh
241
241
  - **React Hooks**: `useSession`, `useRefreshToken`
242
- - **Server Actions**: Authentication utilities for server components
243
-
244
- #### Core (`nextjs-cms/core`)
245
- - **Config**: CMS configuration management (`CMSConfig`)
246
- - **Fields**: Content field helper functions (`textField`, `richTextField`, `dateField`, `photoField`, etc.)
247
- - **Sections**: Section helper functions (`simpleSection`, `hasItemsSection`, `categorySection`)
248
- - **Submit**: Form submission handlers (`SimpleSectionSubmit`)
249
- - **Factories**: Section factory for loading sections (`SectionFactory`)
250
-
251
- #### Database (`nextjs-cms/db`)
252
- - **Client**: Database connection and query utilities
253
- - **Schema**: Database schema definitions
254
- - **Migrations**: Drizzle migration helpers
255
-
256
- #### Validators (`nextjs-cms/validators`)
257
- Zod validators for all field types:
258
- - Text fields, numbers, dates
259
- - File uploads (images, documents, videos)
260
- - Rich text content
261
- - Select fields and checkboxes
262
-
263
- #### Translations (`nextjs-cms/translations`)
264
- - Multi-language support
265
- - Dictionary management
266
- - i18next integration
267
-
268
- ## Field Types
269
-
270
- The CMS supports various field types out of the box. Each field is created using a helper function that accepts a configuration object:
271
-
272
- - **Text**: `textField({ name, label, required, order, ... })` - Single-line text input
273
- - **TextArea**: `textAreaField({ name, label, required, order, ... })` - Multi-line text input
274
- - **RichText**: `richTextField({ name, label, required, order, ... })` - Rich text editor (TinyMCE)
275
- - **Number**: `numberField({ name, label, required, order, ... })` - Numeric input
276
- - **Date**: `dateField({ name, label, required, order, ... })` - Date picker
277
- - **Select**: `selectField({ name, label, required, order, options, ... })` - Dropdown selection
278
- - **SelectMultiple**: `selectMultipleField({ name, label, required, order, ... })` - Multi-select field
279
- - **Checkbox**: `checkboxField({ name, label, required, order, ... })` - Boolean checkbox
280
- - **Photo**: `photoField({ name, label, required, order, size, thumbnail, ... })` - Image upload
281
- - **Video**: `videoField({ name, label, required, order, ... })` - Video file upload
282
- - **Document**: `documentField({ name, label, required, order, type, ... })` - Document file upload
283
- - **Color**: `colorField({ name, label, required, order, ... })` - Color picker
284
- - **Map**: `mapField({ name, label, required, order, ... })` - Location/map field
285
- - **Tags**: `tagsField({ name, label, required, order, ... })` - Tag input field
286
- - **Password**: `passwordField({ name, label, required, order, ... })` - Password input
287
- - **FieldGroup**: `fieldGroup({ title, order, fields })` - Group multiple fields together
288
-
289
- ### Field Configuration
290
-
291
- All fields require at minimum:
292
- - `name`: string - Unique field identifier (used in database)
293
- - `label`: string - Display label for the field
294
- - `required`: boolean - Whether the field is required
295
- - `order`: number - Display order of the field
296
-
297
- Additional options vary by field type. See the API documentation for each field type for complete configuration options.
298
-
299
- ## Section Types
300
-
301
- ### Simple Section
302
- Basic content sections with a single record. Use `simpleSection()` for pages like "About", "Contact", or "Settings" that have only one instance.
303
-
304
- **Key characteristics:**
305
- - Single record (always has ID = 1)
306
- - No listing/browse page
307
- - Direct edit page
308
- - Requires `title` property
309
-
310
- **Example use cases:** About page, Privacy Policy, Site Settings
311
-
312
- ### Has Items Section
313
- Sections that can contain multiple items. Use `hasItemsSection()` for collections like blog posts, products, or articles.
314
-
315
- **Key characteristics:**
316
- - Multiple records
317
- - Browse/listing page with pagination
318
- - Individual item pages
319
- - Requires `headingField` and `title` object with `section`, `singular`, and `plural` properties
320
- - Optional `coverPhotoField`, `search`, and `gallery` configuration
321
-
322
- **Example use cases:** Blog posts, Products, News articles, Events
323
-
324
- ### Category Section
325
- Sections organized by categories with hierarchical structure. Use `categorySection()` for nested category systems.
326
-
327
- **Key characteristics:**
328
- - Hierarchical structure (configurable depth)
329
- - Parent-child relationships
330
- - Requires `headingField` and `title` object
331
- - Optional `depth` property (default: 1, no nesting)
332
- - Automatically adds `parent_id` and `level` fields when depth > 1
333
-
334
- **Example use cases:** Product categories, Content categories, Navigation menus
335
-
336
-
337
- ## Contributing
338
-
339
- Contributions are welcome! Please read our contributing guidelines and submit pull requests to the main repository.
340
-
341
- ## License
342
-
242
+ - **Server Actions**: Authentication utilities for server components
243
+
244
+ #### Core (`nextjs-cms/core`)
245
+ - **Config**: CMS configuration management (`CMSConfig`)
246
+ - **Fields**: Content field helper functions (`textField`, `richTextField`, `dateField`, `photoField`, etc.)
247
+ - **Sections**: Section helper functions (`simpleSection`, `hasItemsSection`, `categorySection`)
248
+ - **Submit**: Form submission handlers (`SimpleSectionSubmit`)
249
+ - **Factories**: Section factory for loading sections (`SectionFactory`)
250
+
251
+ #### Database (`nextjs-cms/db`)
252
+ - **Client**: Database connection and query utilities
253
+ - **Schema**: Database schema definitions
254
+ - **Migrations**: Drizzle migration helpers
255
+
256
+ #### Validators (`nextjs-cms/validators`)
257
+ Zod validators for all field types:
258
+ - Text fields, numbers, dates
259
+ - File uploads (images, documents, videos)
260
+ - Rich text content
261
+ - Select fields and checkboxes
262
+
263
+ #### Translations (`nextjs-cms/translations`)
264
+ - Multi-language support
265
+ - Dictionary management
266
+ - i18next integration
267
+
268
+ ## Field Types
269
+
270
+ The CMS supports various field types out of the box. Each field is created using a helper function that accepts a configuration object:
271
+
272
+ - **Text**: `textField({ name, label, required, order, ... })` - Single-line text input
273
+ - **TextArea**: `textAreaField({ name, label, required, order, ... })` - Multi-line text input
274
+ - **RichText**: `richTextField({ name, label, required, order, ... })` - Rich text editor (TinyMCE)
275
+ - **Number**: `numberField({ name, label, required, order, ... })` - Numeric input
276
+ - **Date**: `dateField({ name, label, required, order, ... })` - Date picker
277
+ - **Select**: `selectField({ name, label, required, order, options, ... })` - Dropdown selection
278
+ - **SelectMultiple**: `selectMultipleField({ name, label, required, order, ... })` - Multi-select field
279
+ - **Checkbox**: `checkboxField({ name, label, required, order, ... })` - Boolean checkbox
280
+ - **Photo**: `photoField({ name, label, required, order, size, thumbnail, ... })` - Image upload
281
+ - **Video**: `videoField({ name, label, required, order, ... })` - Video file upload
282
+ - **Document**: `documentField({ name, label, required, order, type, ... })` - Document file upload
283
+ - **Color**: `colorField({ name, label, required, order, ... })` - Color picker
284
+ - **Map**: `mapField({ name, label, required, order, ... })` - Location/map field
285
+ - **Tags**: `tagsField({ name, label, required, order, ... })` - Tag input field
286
+ - **Password**: `passwordField({ name, label, required, order, ... })` - Password input
287
+ - **FieldGroup**: `fieldGroup({ title, order, fields })` - Group multiple fields together
288
+
289
+ ### Field Configuration
290
+
291
+ All fields require at minimum:
292
+ - `name`: string - Unique field identifier (used in database)
293
+ - `label`: string - Display label for the field
294
+ - `required`: boolean - Whether the field is required
295
+ - `order`: number - Display order of the field
296
+
297
+ Additional options vary by field type. See the API documentation for each field type for complete configuration options.
298
+
299
+ ## Section Types
300
+
301
+ ### Simple Section
302
+ Basic content sections with a single record. Use `simpleSection()` for pages like "About", "Contact", or "Settings" that have only one instance.
303
+
304
+ **Key characteristics:**
305
+ - Single record (always has ID = 1)
306
+ - No listing/browse page
307
+ - Direct edit page
308
+ - Requires `title` property
309
+
310
+ **Example use cases:** About page, Privacy Policy, Site Settings
311
+
312
+ ### Has Items Section
313
+ Sections that can contain multiple items. Use `hasItemsSection()` for collections like blog posts, products, or articles.
314
+
315
+ **Key characteristics:**
316
+ - Multiple records
317
+ - Browse/listing page with pagination
318
+ - Individual item pages
319
+ - Requires `headingField` and `title` object with `section`, `singular`, and `plural` properties
320
+ - Optional `coverPhotoField`, `search`, and `gallery` configuration
321
+
322
+ **Example use cases:** Blog posts, Products, News articles, Events
323
+
324
+ ### Category Section
325
+ Sections organized by categories with hierarchical structure. Use `categorySection()` for nested category systems.
326
+
327
+ **Key characteristics:**
328
+ - Hierarchical structure (configurable depth)
329
+ - Parent-child relationships
330
+ - Requires `headingField` and `title` object
331
+ - Optional `depth` property (default: 1, no nesting)
332
+ - Automatically adds `parent_id` and `level` fields when depth > 1
333
+
334
+ **Example use cases:** Product categories, Content categories, Navigation menus
335
+
336
+
337
+ ## Contributing
338
+
339
+ Contributions are welcome! Please read our contributing guidelines and submit pull requests to the main repository.
340
+
341
+ ## License
342
+
343
343
  MIT License - see LICENSE file for details.