@fecommunity/reactpress-theme-starter 1.0.0-beta.0

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 (163) hide show
  1. package/.env.example +22 -0
  2. package/LICENSE +21 -0
  3. package/README.md +286 -0
  4. package/app/api/[[...path]]/route.ts +69 -0
  5. package/app/archives/page.tsx +28 -0
  6. package/app/article/[id]/page.tsx +92 -0
  7. package/app/category/[category]/page.tsx +60 -0
  8. package/app/globals.css +4969 -0
  9. package/app/knowledge/[pId]/[id]/page.tsx +54 -0
  10. package/app/knowledge/[pId]/page.tsx +47 -0
  11. package/app/knowledge/page.tsx +29 -0
  12. package/app/layout.tsx +76 -0
  13. package/app/llms.txt/route.ts +26 -0
  14. package/app/login/page.tsx +17 -0
  15. package/app/nav/[id]/page.tsx +44 -0
  16. package/app/nav/page.tsx +5 -0
  17. package/app/not-found.tsx +21 -0
  18. package/app/page/[id]/page.tsx +57 -0
  19. package/app/page.tsx +61 -0
  20. package/app/register/page.tsx +17 -0
  21. package/app/robots.ts +14 -0
  22. package/app/rss/route.ts +82 -0
  23. package/app/search/page.tsx +46 -0
  24. package/app/sitemap.ts +38 -0
  25. package/app/suggestions/page.tsx +47 -0
  26. package/app/tag/[tag]/page.tsx +58 -0
  27. package/app/tags/page.tsx +18 -0
  28. package/app/template.tsx +6 -0
  29. package/components/article/ArchiveBanner.tsx +40 -0
  30. package/components/article/ArticleActionsBar.tsx +53 -0
  31. package/components/article/ArticleCarousel.tsx +237 -0
  32. package/components/article/ArticleCopyrightBar.tsx +128 -0
  33. package/components/article/ArticleEndBar.tsx +19 -0
  34. package/components/article/ArticleFeedSection.tsx +59 -0
  35. package/components/article/ArticleList.tsx +170 -0
  36. package/components/article/ArticleReadingChrome.tsx +104 -0
  37. package/components/article/ArticleReadingProgress.tsx +75 -0
  38. package/components/article/ArticleRecommend.tsx +362 -0
  39. package/components/article/ArticleTocPanel.tsx +19 -0
  40. package/components/article/ArticleViewClient.tsx +221 -0
  41. package/components/article/CategoryMenu.tsx +67 -0
  42. package/components/article/CmsPageClient.tsx +92 -0
  43. package/components/article/LoadMore.tsx +59 -0
  44. package/components/article/ReadingContent.tsx +51 -0
  45. package/components/auth/AuthPageClient.tsx +314 -0
  46. package/components/comment/CommentEditor.tsx +290 -0
  47. package/components/comment/CommentEmoji.tsx +110 -0
  48. package/components/comment/CommentIconButton.tsx +37 -0
  49. package/components/comment/CommentItem.tsx +135 -0
  50. package/components/comment/CommentSection.tsx +123 -0
  51. package/components/comment/emojis.ts +152 -0
  52. package/components/knowledge/KnowledgeList.tsx +70 -0
  53. package/components/layout/BackToTop.tsx +27 -0
  54. package/components/layout/ConditionalSiteFooter.tsx +29 -0
  55. package/components/layout/ContentStylesLoader.tsx +9 -0
  56. package/components/layout/DoubleColumnLayout.tsx +171 -0
  57. package/components/layout/HeaderSearch.tsx +23 -0
  58. package/components/layout/LocaleSwitcher.tsx +24 -0
  59. package/components/layout/PageContainer.tsx +11 -0
  60. package/components/layout/PageLoadProgress.tsx +169 -0
  61. package/components/layout/SiteFooter.tsx +75 -0
  62. package/components/layout/SiteHeader.tsx +312 -0
  63. package/components/layout/SystemNotification.tsx +176 -0
  64. package/components/layout/ThemeSwitch.tsx +19 -0
  65. package/components/layout/UserAuth.tsx +130 -0
  66. package/components/search/SearchHero.tsx +323 -0
  67. package/components/search/SearchQuickLinks.tsx +285 -0
  68. package/components/shared/DevChunkRecovery.tsx +8 -0
  69. package/components/shared/Link.tsx +30 -0
  70. package/components/shared/SectionHeading.tsx +38 -0
  71. package/components/shared/ThemeImage.tsx +13 -0
  72. package/components/shared/logo.svg +7 -0
  73. package/components/views/ArchivesClient.tsx +137 -0
  74. package/components/views/CategoryClient.tsx +87 -0
  75. package/components/views/HomeClient.tsx +79 -0
  76. package/components/views/KnowledgeBookClient.tsx +127 -0
  77. package/components/views/KnowledgeChapterClient.tsx +175 -0
  78. package/components/views/KnowledgeClient.tsx +69 -0
  79. package/components/views/LoginClient.tsx +80 -0
  80. package/components/views/NavDetailClient.tsx +177 -0
  81. package/components/views/SearchClient.tsx +100 -0
  82. package/components/views/TagArchiveClient.tsx +105 -0
  83. package/components/views/TagsClient.tsx +46 -0
  84. package/components/widgets/AboutUs.tsx +180 -0
  85. package/components/widgets/ArticleActionButton.tsx +95 -0
  86. package/components/widgets/BookmarkWidget.tsx +61 -0
  87. package/components/widgets/CategoriesWidget.tsx +47 -0
  88. package/components/widgets/HomeSidebar.tsx +40 -0
  89. package/components/widgets/LikesWidget.tsx +77 -0
  90. package/components/widgets/ShareWidget.tsx +120 -0
  91. package/components/widgets/TagCloud.tsx +94 -0
  92. package/components/widgets/TagsWidget.tsx +160 -0
  93. package/eslint.config.mjs +80 -0
  94. package/lib/auth/githubOAuth.ts +26 -0
  95. package/lib/auth/sessionUser.ts +41 -0
  96. package/lib/mock-api/auth.ts +129 -0
  97. package/lib/mock-api/config.ts +11 -0
  98. package/lib/mock-api/cors.ts +53 -0
  99. package/lib/mock-api/data.ts +998 -0
  100. package/lib/mock-api/match-route.ts +202 -0
  101. package/lib/mock-api/proxy.ts +28 -0
  102. package/lib/providers/client.ts +58 -0
  103. package/lib/providers/materializeProvider.ts +9 -0
  104. package/lib/providers/server.ts +8 -0
  105. package/lib/reactpress/appearance.ts +69 -0
  106. package/lib/reactpress/bootstrap.ts +48 -0
  107. package/lib/reactpress/coercePublishedPage.ts +12 -0
  108. package/lib/reactpress/contentSeo.ts +123 -0
  109. package/lib/reactpress/env.ts +31 -0
  110. package/lib/reactpress/feedFooterPlacement.ts +16 -0
  111. package/lib/reactpress/fetchSetting.ts +19 -0
  112. package/lib/reactpress/homeFooter.tsx +27 -0
  113. package/lib/reactpress/layout-shell.tsx +19 -0
  114. package/lib/reactpress/materializeBootstrapCatalog.ts +31 -0
  115. package/lib/reactpress/normalizeApiResponse.ts +25 -0
  116. package/lib/reactpress/providers.tsx +199 -0
  117. package/lib/reactpress/resolveSiteNav.ts +56 -0
  118. package/lib/reactpress/seoMetadata.ts +82 -0
  119. package/lib/reactpress/serverLocale.ts +43 -0
  120. package/lib/reactpress/siteMetadata.ts +151 -0
  121. package/lib/reactpress/staticParams.ts +46 -0
  122. package/lib/reactpress/suggestionsContent.ts +48 -0
  123. package/lib/reactpress/useFeedFooterPlacement.ts +22 -0
  124. package/lib/reactpress/useSiteNavConfig.ts +39 -0
  125. package/lib/utils/archiveBanner.ts +8 -0
  126. package/lib/utils/colors.ts +119 -0
  127. package/lib/utils/comment.ts +46 -0
  128. package/lib/utils/headerPosition.ts +55 -0
  129. package/lib/utils/icons.tsx +238 -0
  130. package/lib/utils/reading.ts +16 -0
  131. package/lib/utils/scroll.ts +8 -0
  132. package/lib/utils/tagCloud.ts +222 -0
  133. package/next.config.js +103 -0
  134. package/package.json +98 -0
  135. package/postcss.config.js +5 -0
  136. package/prettier.config.js +10 -0
  137. package/public/apple-touch-icon.png +0 -0
  138. package/public/cli.png +0 -0
  139. package/public/favicon-32.png +0 -0
  140. package/public/favicon.ico +0 -0
  141. package/public/home-dark.png +0 -0
  142. package/public/home-light.png +0 -0
  143. package/public/icon-192.png +0 -0
  144. package/public/icon-512.png +0 -0
  145. package/public/logo-400.png +0 -0
  146. package/public/logo.png +0 -0
  147. package/public/mobile.png +0 -0
  148. package/public/pad.png +0 -0
  149. package/public/site.webmanifest +19 -0
  150. package/scripts/build-mock.mjs +139 -0
  151. package/scripts/dev.mjs +221 -0
  152. package/scripts/ensure-env.mjs +100 -0
  153. package/scripts/remote-dev.mjs +143 -0
  154. package/scripts/resolve-api-env.mjs +114 -0
  155. package/scripts/set-publish-version.mjs +31 -0
  156. package/scripts/smoke-pages.mjs +113 -0
  157. package/scripts/start-mock.mjs +79 -0
  158. package/scripts/verify-toolkit.mjs +37 -0
  159. package/svg.d.ts +6 -0
  160. package/theme.json +123 -0
  161. package/theme.manifest.schema.json +265 -0
  162. package/tsconfig.json +41 -0
  163. package/vercel.json +12 -0
@@ -0,0 +1,998 @@
1
+ const now = new Date()
2
+ const daysAgo = (days: number) => {
3
+ const date = new Date(now)
4
+ date.setDate(date.getDate() - days)
5
+ return date.toISOString()
6
+ }
7
+
8
+ const REACTPRESS_GITHUB = 'https://github.com/fecommunity/reactpress'
9
+ const REACTPRESS_SITE = 'https://reactpress.surge.sh/'
10
+ const REACTPRESS_DEMO = 'https://reactpress-theme-starter.vercel.app'
11
+ const REACTPRESS_NPM = 'https://www.npmjs.com/package/@fecommunity/reactpress'
12
+ const THEME_STARTER_GITHUB = 'https://github.com/fecommunity/reactpress-theme-starter'
13
+
14
+ const mockImages = {
15
+ logo: '/logo-400.png',
16
+ logoFull: '/logo.png',
17
+ icon: '/icon-512.png',
18
+ iconSmall: '/icon-192.png',
19
+ } as const
20
+
21
+ const mockFigure = (src: string, alt: string, caption?: string) =>
22
+ `<figure><img src="${src}" alt="${alt}" loading="lazy" />${
23
+ caption ? `<figcaption>${caption}</figcaption>` : ''
24
+ }</figure>`
25
+
26
+ const mockSearchCategoriesEn = {
27
+ categories: [
28
+ { label: 'Site', key: 'local' },
29
+ { label: 'Web', key: 'search' },
30
+ { label: 'GitHub', key: 'github' },
31
+ { label: 'Packages', key: 'packages' },
32
+ ],
33
+ subCategories: {
34
+ search: [
35
+ {
36
+ label: 'Google',
37
+ key: 'search-google',
38
+ url: 'https://www.google.com/search?q=',
39
+ },
40
+ {
41
+ label: 'Bing',
42
+ key: 'search-bing',
43
+ url: 'https://www.bing.com/search?q=',
44
+ },
45
+ ],
46
+ github: [
47
+ {
48
+ label: 'Repositories',
49
+ key: 'github-repos',
50
+ url: 'https://github.com/search?type=repositories&q=',
51
+ },
52
+ {
53
+ label: 'Code',
54
+ key: 'github-code',
55
+ url: 'https://github.com/search?type=code&q=',
56
+ },
57
+ {
58
+ label: 'Issues',
59
+ key: 'github-issues',
60
+ url: 'https://github.com/search?type=issues&q=',
61
+ },
62
+ ],
63
+ packages: [
64
+ {
65
+ label: 'npm',
66
+ key: 'npm-search',
67
+ url: 'https://www.npmjs.com/search?q=',
68
+ },
69
+ ],
70
+ },
71
+ }
72
+
73
+ const mockSearchCategoriesZh = {
74
+ categories: [
75
+ { label: '站内', key: 'local' },
76
+ { label: '搜索', key: 'search' },
77
+ { label: 'GitHub', key: 'github' },
78
+ { label: '包管理', key: 'packages' },
79
+ ],
80
+ subCategories: {
81
+ search: [
82
+ {
83
+ label: 'Google',
84
+ key: 'search-google',
85
+ url: 'https://www.google.com/search?q=',
86
+ },
87
+ {
88
+ label: 'Bing',
89
+ key: 'search-bing',
90
+ url: 'https://www.bing.com/search?q=',
91
+ },
92
+ ],
93
+ github: [
94
+ {
95
+ label: '仓库',
96
+ key: 'github-repos',
97
+ url: 'https://github.com/search?type=repositories&q=',
98
+ },
99
+ {
100
+ label: '代码',
101
+ key: 'github-code',
102
+ url: 'https://github.com/search?type=code&q=',
103
+ },
104
+ {
105
+ label: 'Issues',
106
+ key: 'github-issues',
107
+ url: 'https://github.com/search?type=issues&q=',
108
+ },
109
+ ],
110
+ packages: [
111
+ {
112
+ label: 'npm',
113
+ key: 'npm-search',
114
+ url: 'https://www.npmjs.com/search?q=',
115
+ },
116
+ ],
117
+ },
118
+ }
119
+
120
+ const mockUrlConfigEn = [
121
+ {
122
+ key: 'reactpress',
123
+ label: 'ReactPress',
124
+ icon: 'GlobalOutlined',
125
+ children: [
126
+ {
127
+ key: 'rp-github',
128
+ label: 'GitHub',
129
+ description:
130
+ 'Official open-source repository — CLI, admin console, API, templates, and toolkit.',
131
+ url: REACTPRESS_GITHUB,
132
+ },
133
+ {
134
+ key: 'rp-site',
135
+ label: 'Official Site',
136
+ description:
137
+ 'Product overview, 3.0 highlights, platform capabilities, and documentation links.',
138
+ url: REACTPRESS_SITE,
139
+ },
140
+ {
141
+ key: 'rp-demo',
142
+ label: 'Live Demo',
143
+ description: 'See a running ReactPress public site and admin dashboard in action.',
144
+ url: REACTPRESS_DEMO,
145
+ },
146
+ {
147
+ key: 'rp-npm',
148
+ label: 'npm CLI',
149
+ description: 'Install @fecommunity/reactpress globally and launch your CMS in minutes.',
150
+ url: REACTPRESS_NPM,
151
+ },
152
+ ],
153
+ },
154
+ {
155
+ key: 'docs-community',
156
+ label: 'Docs & Community',
157
+ icon: 'BookOutlined',
158
+ children: [
159
+ {
160
+ key: 'rp-tutorial',
161
+ label: 'Tutorial',
162
+ description: 'Step-by-step guides to install, initialize, and publish with ReactPress.',
163
+ url: `${REACTPRESS_SITE}docs/tutorial`,
164
+ },
165
+ {
166
+ key: 'rp-blog',
167
+ label: 'Blog',
168
+ description: 'Product updates, release notes, and publishing best practices.',
169
+ url: `${REACTPRESS_SITE}blog`,
170
+ },
171
+ {
172
+ key: 'stackoverflow',
173
+ label: 'Stack Overflow',
174
+ description: 'Community Q&A for ReactPress developers.',
175
+ url: 'https://stackoverflow.com/questions/tagged/reactpress',
176
+ },
177
+ {
178
+ key: 'fecommunity',
179
+ label: 'FECommunity',
180
+ description: 'The open-source organization behind ReactPress on GitHub.',
181
+ url: 'https://github.com/fecommunity',
182
+ },
183
+ ],
184
+ },
185
+ {
186
+ key: 'tech-stack',
187
+ label: 'Tech Stack',
188
+ icon: 'CodeOutlined',
189
+ children: [
190
+ {
191
+ key: 'nextjs',
192
+ label: 'Next.js',
193
+ description: 'The React framework powering ReactPress public sites and themes.',
194
+ url: 'https://nextjs.org/',
195
+ },
196
+ {
197
+ key: 'nestjs',
198
+ label: 'NestJS',
199
+ description: 'The backend framework behind the ReactPress REST API.',
200
+ url: 'https://nestjs.com/',
201
+ },
202
+ {
203
+ key: 'antd',
204
+ label: 'Ant Design',
205
+ description: 'UI components used in the ReactPress admin console.',
206
+ url: 'https://ant.design/',
207
+ },
208
+ {
209
+ key: 'theme-starter',
210
+ label: 'Theme Starter',
211
+ description: 'Official Next.js App Router theme starter for ReactPress visitor sites.',
212
+ url: 'https://github.com/fecommunity/reactpress-theme-starter',
213
+ },
214
+ ],
215
+ },
216
+ ]
217
+
218
+ const mockUrlConfigZh = [
219
+ {
220
+ key: 'reactpress',
221
+ label: 'ReactPress',
222
+ icon: 'GlobalOutlined',
223
+ children: [
224
+ {
225
+ key: 'rp-github',
226
+ label: 'GitHub',
227
+ description: '官方开源仓库 — CLI、管理端、API、模板与工具包。',
228
+ url: REACTPRESS_GITHUB,
229
+ },
230
+ {
231
+ key: 'rp-site',
232
+ label: '官方网站',
233
+ description: '产品概览、3.0 亮点、平台能力与文档入口。',
234
+ url: REACTPRESS_SITE,
235
+ },
236
+ {
237
+ key: 'rp-demo',
238
+ label: '在线演示',
239
+ description: '查看正在运行的 ReactPress 访客站与管理后台。',
240
+ url: REACTPRESS_DEMO,
241
+ },
242
+ {
243
+ key: 'rp-npm',
244
+ label: 'npm CLI',
245
+ description: '全局安装 @fecommunity/reactpress,几分钟内启动 CMS。',
246
+ url: REACTPRESS_NPM,
247
+ },
248
+ ],
249
+ },
250
+ {
251
+ key: 'docs-community',
252
+ label: '文档与社区',
253
+ icon: 'BookOutlined',
254
+ children: [
255
+ {
256
+ key: 'rp-tutorial',
257
+ label: '教程',
258
+ description: '安装、初始化与发布的分步指南。',
259
+ url: `${REACTPRESS_SITE}docs/tutorial`,
260
+ },
261
+ {
262
+ key: 'rp-blog',
263
+ label: '博客',
264
+ description: '产品更新、版本说明与内容发布实践。',
265
+ url: `${REACTPRESS_SITE}blog`,
266
+ },
267
+ {
268
+ key: 'stackoverflow',
269
+ label: 'Stack Overflow',
270
+ description: 'ReactPress 开发者社区问答。',
271
+ url: 'https://stackoverflow.com/questions/tagged/reactpress',
272
+ },
273
+ {
274
+ key: 'fecommunity',
275
+ label: 'FECommunity',
276
+ description: 'GitHub 上的 ReactPress 开源组织。',
277
+ url: 'https://github.com/fecommunity',
278
+ },
279
+ ],
280
+ },
281
+ {
282
+ key: 'tech-stack',
283
+ label: '技术栈',
284
+ icon: 'CodeOutlined',
285
+ children: [
286
+ {
287
+ key: 'nextjs',
288
+ label: 'Next.js',
289
+ description: '驱动 ReactPress 访客站与主题的 React 框架。',
290
+ url: 'https://nextjs.org/',
291
+ },
292
+ {
293
+ key: 'nestjs',
294
+ label: 'NestJS',
295
+ description: 'ReactPress REST API 的后端框架。',
296
+ url: 'https://nestjs.com/',
297
+ },
298
+ {
299
+ key: 'antd',
300
+ label: 'Ant Design',
301
+ description: 'ReactPress 管理端使用的 UI 组件库。',
302
+ url: 'https://ant.design/',
303
+ },
304
+ {
305
+ key: 'theme-starter',
306
+ label: '主题模板',
307
+ description: '官方 Next.js App Router 访客站主题 Starter。',
308
+ url: 'https://github.com/fecommunity/reactpress-theme-starter',
309
+ },
310
+ ],
311
+ },
312
+ ]
313
+
314
+ const mockThemeConfig = {
315
+ header: {
316
+ navLinks: [
317
+ { path: '/', locale: 'home', icon: 'HomeOutlined', visible: true },
318
+ { path: '/archives', locale: 'archives', icon: 'HistoryOutlined', visible: true },
319
+ { path: '/search', locale: 'search', icon: 'SearchOutlined', visible: true },
320
+ ],
321
+ },
322
+ }
323
+
324
+ const mockGlobalConfigBundleEn = {
325
+ globalConfig: {
326
+ navConfig: mockSearchCategoriesEn,
327
+ urlConfig: mockUrlConfigEn,
328
+ },
329
+ }
330
+
331
+ const mockGlobalConfigBundleZh = {
332
+ globalConfig: {
333
+ navConfig: mockSearchCategoriesZh,
334
+ urlConfig: mockUrlConfigZh,
335
+ },
336
+ }
337
+
338
+ export const mockSetting = {
339
+ systemTitle: 'ReactPress',
340
+ systemSubTitle: 'One package. Your CMS in about a minute.',
341
+ systemUrl: REACTPRESS_SITE,
342
+ aboutUsGithubUrl: REACTPRESS_GITHUB,
343
+ seoDesc:
344
+ 'ReactPress is a modern publishing platform for blogs, company sites, and content-driven products. Install the CLI once, run init and dev, and get a public site, admin console, and API.',
345
+ seoKeyword: 'reactpress,cms,blog,nextjs,nestjs,headless,cli,mysql,vercel,open source,publishing',
346
+ systemFooterInfo:
347
+ '<p>ReactPress — a modern publishing platform built with Next.js, NestJS, and Ant Design. <a href="https://github.com/fecommunity/reactpress" rel="noopener noreferrer">Star us on GitHub</a> · <a href="https://reactpress.surge.sh/" rel="noopener noreferrer">Official site</a></p>',
348
+ i18n: JSON.stringify({
349
+ en: {
350
+ suggestions: 'Suggestions',
351
+ archives: 'Archives',
352
+ tags: 'Tags',
353
+ search: 'Search',
354
+ tagTitle: 'Tags',
355
+ empty: 'No data',
356
+ homeTitle: 'Home',
357
+ comment: 'Comments',
358
+ recommendToReading: 'Recommended Readings',
359
+ articleCover: 'Cover',
360
+ totalSearch: 'Found',
361
+ piece: 'results',
362
+ searchArticle: 'Search Articles',
363
+ searchArticlePlaceholder: 'Search ReactPress articles…',
364
+ gettingArticle: 'Fetching articles…',
365
+ aboutUsFallback:
366
+ 'ReactPress — one package, one minute to your own CMS. Public site, admin, and API ready to go.',
367
+ },
368
+ zh: {
369
+ suggestions: '建议反馈',
370
+ archives: '归档',
371
+ tags: '标签',
372
+ search: '搜索',
373
+ tagTitle: '标签',
374
+ empty: '暂无数据',
375
+ homeTitle: '首页',
376
+ comment: '评论',
377
+ recommendToReading: '推荐阅读',
378
+ articleCover: '封面',
379
+ totalSearch: '共找到',
380
+ piece: '条结果',
381
+ searchArticle: '搜索文章',
382
+ searchArticlePlaceholder: '搜索 ReactPress 相关文章…',
383
+ gettingArticle: '正在获取文章…',
384
+ nav: '网址导航',
385
+ aboutUsFallback:
386
+ 'ReactPress — 一个包,一分钟搭建属于你的 CMS。访客站、管理端与 API 开箱即用。',
387
+ },
388
+ }),
389
+ globalSetting: JSON.stringify({
390
+ en: mockGlobalConfigBundleEn,
391
+ zh: mockGlobalConfigBundleZh,
392
+ theme: {
393
+ activeTheme: 'reactpress-theme-starter',
394
+ installedThemes: ['reactpress-theme-starter'],
395
+ mods: {},
396
+ },
397
+ config: {
398
+ 'reactpress-theme-starter': mockThemeConfig,
399
+ },
400
+ }),
401
+ }
402
+
403
+ export const mockCategories = [
404
+ {
405
+ id: 'quick-start',
406
+ value: 'quick-start',
407
+ label: 'Quick Start',
408
+ articleCount: 2,
409
+ articles: [],
410
+ createAt: daysAgo(30),
411
+ updateAt: daysAgo(1),
412
+ },
413
+ {
414
+ id: 'platform',
415
+ value: 'platform',
416
+ label: 'Platform',
417
+ articleCount: 2,
418
+ articles: [],
419
+ createAt: daysAgo(30),
420
+ updateAt: daysAgo(2),
421
+ },
422
+ {
423
+ id: 'cli-deploy',
424
+ value: 'cli-deploy',
425
+ label: 'CLI & Deploy',
426
+ articleCount: 2,
427
+ articles: [],
428
+ createAt: daysAgo(30),
429
+ updateAt: daysAgo(3),
430
+ },
431
+ ]
432
+
433
+ export const mockTags = [
434
+ {
435
+ value: 'reactpress',
436
+ label: 'ReactPress',
437
+ articleCount: 6,
438
+ articles: [],
439
+ createAt: daysAgo(30),
440
+ updateAt: daysAgo(1),
441
+ },
442
+ {
443
+ value: 'cli',
444
+ label: 'CLI',
445
+ articleCount: 3,
446
+ articles: [],
447
+ createAt: daysAgo(30),
448
+ updateAt: daysAgo(1),
449
+ },
450
+ {
451
+ value: 'nextjs',
452
+ label: 'Next.js',
453
+ articleCount: 4,
454
+ articles: [],
455
+ createAt: daysAgo(30),
456
+ updateAt: daysAgo(1),
457
+ },
458
+ {
459
+ value: 'nestjs',
460
+ label: 'NestJS',
461
+ articleCount: 3,
462
+ articles: [],
463
+ createAt: daysAgo(30),
464
+ updateAt: daysAgo(2),
465
+ },
466
+ {
467
+ value: 'headless-cms',
468
+ label: 'Headless CMS',
469
+ articleCount: 4,
470
+ articles: [],
471
+ createAt: daysAgo(30),
472
+ updateAt: daysAgo(2),
473
+ },
474
+ {
475
+ value: 'cms',
476
+ label: 'CMS',
477
+ articleCount: 5,
478
+ articles: [],
479
+ createAt: daysAgo(30),
480
+ updateAt: daysAgo(2),
481
+ },
482
+ {
483
+ value: 'mysql',
484
+ label: 'MySQL',
485
+ articleCount: 2,
486
+ articles: [],
487
+ createAt: daysAgo(30),
488
+ updateAt: daysAgo(3),
489
+ },
490
+ {
491
+ value: 'docker',
492
+ label: 'Docker',
493
+ articleCount: 2,
494
+ articles: [],
495
+ createAt: daysAgo(30),
496
+ updateAt: daysAgo(3),
497
+ },
498
+ {
499
+ value: 'vercel',
500
+ label: 'Vercel',
501
+ articleCount: 2,
502
+ articles: [],
503
+ createAt: daysAgo(30),
504
+ updateAt: daysAgo(4),
505
+ },
506
+ {
507
+ value: 'open-source',
508
+ label: 'Open Source',
509
+ articleCount: 3,
510
+ articles: [],
511
+ createAt: daysAgo(30),
512
+ updateAt: daysAgo(4),
513
+ },
514
+ ]
515
+
516
+ const tag = (value: string) => mockTags.find((item) => item.value === value) ?? mockTags[0]
517
+
518
+ const whatIsReactPressHtml = `
519
+ ${mockFigure(mockImages.logo, 'ReactPress technical architecture — CLI, NestJS API, MySQL, admin, and headless themes', 'Official architecture overview · reactpress.surge.sh')}
520
+ <h2>ReactPress Technical Architecture</h2>
521
+ <p><strong>ReactPress</strong> is a monolithic-yet-modular publishing platform: one CLI bootstraps a NestJS API, MySQL database, built-in admin console, and optional headless visitor themes. Content is authored once in the admin and consumed everywhere through a stable REST envelope <code>{ "success": true, "data": ... }</code>.</p>
522
+ <p><img src="${mockImages.logo}" alt="ReactPress logo — atom mark with letter P" width="200" loading="lazy" /></p>
523
+ <blockquote><p><strong>One backend, many presentation layers.</strong> The same API powers the bundled admin UI, official themes, and your custom Next.js frontends.</p></blockquote>
524
+ <h3>Core layers</h3>
525
+ <table>
526
+ <thead><tr><th>Layer</th><th>Technology</th><th>Role</th></tr></thead>
527
+ <tbody>
528
+ <tr><td>CLI</td><td><code>@fecommunity/reactpress</code></td><td><code>init</code>, <code>dev</code>, <code>build</code>, <code>doctor</code>, <code>status</code></td></tr>
529
+ <tr><td>API Server</td><td>NestJS</td><td>REST on <code>:3002/api</code> — articles, pages, media, settings</td></tr>
530
+ <tr><td>Database</td><td>MySQL</td><td>Persistent content store (Docker by default)</td></tr>
531
+ <tr><td>Admin</td><td>Next.js + Ant Design</td><td>Authoring UI at <code>/admin</code></td></tr>
532
+ <tr><td>Visitor theme</td><td>Next.js App Router</td><td>Headless SSR via <code>@fecommunity/reactpress-toolkit</code></td></tr>
533
+ </tbody>
534
+ </table>
535
+ ${mockFigure(mockImages.logoFull, 'ReactPress architecture stack diagram', 'From CLI to NestJS API, admin console, and Theme Starter')}
536
+ <h3>Learn more</h3>
537
+ <ul>
538
+ <li><a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a> — product overview and documentation</li>
539
+ <li><a href="${REACTPRESS_GITHUB}" rel="noopener noreferrer">GitHub repository</a> — CLI, server, client, toolkit, templates</li>
540
+ <li><a href="${THEME_STARTER_GITHUB}" rel="noopener noreferrer">Theme Starter</a> — official headless visitor theme (this repo)</li>
541
+ </ul>
542
+ `.trim()
543
+
544
+ const quickStartHtml = `
545
+ ${mockFigure(mockImages.logo, 'Quick Start with ReactPress CLI', 'Three commands to spin up visitor site, admin, and API')}
546
+ <h2>Quick Start</h2>
547
+ <p>The CLI orchestrates every service in the ReactPress architecture. After a global install, <code>init</code> writes project config and <code>dev</code> starts the API, admin, and default visitor site together.</p>
548
+ <h3>Prerequisites</h3>
549
+ <ul>
550
+ <li><strong>Node.js 18+</strong> — required for the CLI</li>
551
+ <li><strong>Docker</strong> — recommended; default bundled MySQL runs in a container</li>
552
+ <li><strong>MySQL</strong> — optional; use your own instance instead of Docker</li>
553
+ </ul>
554
+ <h3>Install and run</h3>
555
+ <pre><code>npm i -g @fecommunity/reactpress@3
556
+ mkdir reactpress-theme-starter &amp;&amp; cd reactpress-theme-starter
557
+ reactpress init
558
+ reactpress dev</code></pre>
559
+ <p>When <code>dev</code> is ready, open the URLs printed in the terminal:</p>
560
+ <table>
561
+ <thead><tr><th>Service</th><th>Typical URL</th></tr></thead>
562
+ <tbody>
563
+ <tr><td>Public site</td><td>http://localhost:3001</td></tr>
564
+ <tr><td>Admin</td><td>http://localhost:3001/admin</td></tr>
565
+ <tr><td>API health</td><td>http://localhost:3002/api/health</td></tr>
566
+ </tbody>
567
+ </table>
568
+ <h3>Tips</h3>
569
+ <ul>
570
+ <li>Run <code>reactpress</code> with no arguments for the interactive menu.</li>
571
+ <li>Run <code>reactpress doctor</code> or <code>reactpress status</code> if something does not look right.</li>
572
+ </ul>
573
+ `.trim()
574
+
575
+ const platformCapabilitiesHtml = `
576
+ ${mockFigure(mockImages.logoFull, 'ReactPress architecture stack', 'CLI → NestJS + MySQL → Admin UI + headless Theme Starter')}
577
+ <h2>Architecture in Detail</h2>
578
+ <p>ReactPress separates <strong>content management</strong> (NestJS + MySQL + admin) from <strong>presentation</strong> (visitor themes). The REST API is the contract between both sides.</p>
579
+ <h3>Request flow (headless mode)</h3>
580
+ <ol>
581
+ <li>Editor publishes an article in the admin console.</li>
582
+ <li>NestJS persists content to MySQL and exposes it at <code>GET /api/article/:id</code>.</li>
583
+ <li>Theme Starter fetches via <code>themeApi</code> during SSR and renders App Router pages with ISR.</li>
584
+ <li>Browser receives HTML; subsequent navigations hydrate client components from the toolkit.</li>
585
+ </ol>
586
+ <h3>Monorepo packages</h3>
587
+ <ul>
588
+ <li><strong>CLI</strong> — project lifecycle and local orchestration</li>
589
+ <li><strong>Server</strong> — NestJS modules for articles, categories, tags, pages, comments, knowledge, media</li>
590
+ <li><strong>Client</strong> — bundled admin and default visitor UI</li>
591
+ <li><strong>Toolkit</strong> — <code>@fecommunity/reactpress-toolkit</code> for third-party themes</li>
592
+ <li><strong>Theme Starter</strong> — reference headless implementation (this repository)</li>
593
+ </ul>
594
+ <h3>Headless entry point</h3>
595
+ <p>Run <code>reactpress dev --api-only</code> when you only need the API and connect a custom theme such as Theme Starter with <code>pnpm dev</code>.</p>
596
+ <p>Documentation: <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a></p>
597
+ `.trim()
598
+
599
+ const cliReferenceHtml = `
600
+ ${mockFigure(mockImages.logo, 'ReactPress CLI workflow', 'Every command starts from the terminal after a global install')}
601
+ <h2>CLI Reference</h2>
602
+ <p>After a global install, every workflow starts from the terminal.</p>
603
+ <p><img src="${mockImages.logo}" alt="ReactPress" width="180" loading="lazy" /></p>
604
+ <pre><code>npm i -g @fecommunity/reactpress@3</code></pre>
605
+ <table>
606
+ <thead><tr><th>Command</th><th>Description</th></tr></thead>
607
+ <tbody>
608
+ <tr><td><code>reactpress</code></td><td>Interactive menu</td></tr>
609
+ <tr><td><code>reactpress init</code></td><td>Set up a new project (config + .env)</td></tr>
610
+ <tr><td><code>reactpress dev</code></td><td>Run site + admin + API locally</td></tr>
611
+ <tr><td><code>reactpress dev --api-only</code></td><td>API only — for custom frontends</td></tr>
612
+ <tr><td><code>reactpress doctor</code></td><td>Check your environment</td></tr>
613
+ <tr><td><code>reactpress status</code></td><td>See what is running</td></tr>
614
+ <tr><td><code>reactpress build</code></td><td>Production build</td></tr>
615
+ <tr><td><code>reactpress start</code></td><td>Run production build</td></tr>
616
+ </tbody>
617
+ </table>
618
+ <p>The monorepo on <a href="${REACTPRESS_GITHUB}" rel="noopener noreferrer">GitHub</a> contains the CLI, client, server, toolkit, and templates. Contributors use <code>pnpm install</code> and <code>pnpm run dev</code> to develop the platform itself.</p>
619
+ `.trim()
620
+
621
+ const deployHtml = `
622
+ ${mockFigure(mockImages.icon, 'Headless theme deployment', 'Theme Starter on Vercel · ReactPress API on your infrastructure')}
623
+ <h2>Deploy ReactPress</h2>
624
+ <p>Production deployment can be monolithic (CLI <code>build</code> + <code>start</code>) or split: NestJS API on your server, Theme Starter on Vercel.</p>
625
+ <h3>Production commands</h3>
626
+ <pre><code>npm i -g @fecommunity/reactpress@3
627
+ reactpress build
628
+ reactpress start</code></pre>
629
+ <p>Deploy with Vercel, PM2, Docker, or your preferred hosting. The public site, admin console, and API can run together or split across services in headless mode.</p>
630
+ <h3>Theme Starter on Vercel</h3>
631
+ <p>This repository deploys as a headless frontend. Point <code>REACTPRESS_API_URL</code> and <code>CLIENT_SITE_URL</code> at your ReactPress instance, or use <code>build:mock</code> for a demo without a backend. See <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a> for deployment guides.</p>
632
+ <h3>Resources</h3>
633
+ <ul>
634
+ <li><a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a> — official documentation</li>
635
+ <li><a href="${REACTPRESS_GITHUB}/blob/master/README.md" rel="noopener noreferrer">README</a> — deployment details for Docker and monorepos</li>
636
+ </ul>
637
+ `.trim()
638
+
639
+ const themeStarterHtml = `
640
+ ${mockFigure(mockImages.logoFull, 'ReactPress Theme Starter — official headless visitor theme', 'Next.js 15 · Tailwind 4 · toolkit · mock mode · Vercel')}
641
+ <h2>ReactPress Theme Starter</h2>
642
+ <p>This repository is the <strong>official headless visitor theme</strong> for ReactPress. It does not store content locally — every page is rendered from the ReactPress REST API (or built-in mock API during development).</p>
643
+ <h3>Project structure</h3>
644
+ <pre><code>app/ # App Router pages (home, article, category, search…)
645
+ components/ # Layout, article, comment, search UI
646
+ lib/reactpress/ # bootstrap, metadata, SEO, providers
647
+ lib/mock-api/ # Offline mock data for pnpm dev:mock
648
+ theme.json # Template map + appearance panel schema</code></pre>
649
+ <h3>Data integration</h3>
650
+ <p>Server components call <code>fetch*PageProps(themeApi, …)</code> from <code>@fecommunity/reactpress-toolkit/theme/server</code>. Client islands use hooks and providers from <code>@fecommunity/reactpress-toolkit/ui</code>. All API responses follow <code>{ "success": true, "data": ... }</code>.</p>
651
+ ${mockFigure(mockImages.icon, 'Headless deployment — API and theme on separate hosts', 'Production: remote API + Vercel theme · Demo: REACTPRESS_MOCK_API=1')}
652
+ <h3>Development modes</h3>
653
+ <ul>
654
+ <li><code>pnpm dev:mock</code> — built-in mock API, no backend required (used by Vercel demo)</li>
655
+ <li><code>pnpm dev</code> — connect to local or remote ReactPress API</li>
656
+ <li><code>pnpm build:mock</code> — CI / demo production build with mock data</li>
657
+ </ul>
658
+ <h3>Appearance</h3>
659
+ <p>Light/dark mode and primary colors are driven by <code>theme.json</code> appearance settings (defaults: rose primary <code>#e11d48</code>, white / dark gray backgrounds) and applied at runtime via CSS variables.</p>
660
+ <p>Repository: <a href="${THEME_STARTER_GITHUB}" rel="noopener noreferrer">github.com/fecommunity/reactpress-theme-starter</a> · Docs: <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a></p>
661
+ `.trim()
662
+
663
+ const suggestionsHtml = `
664
+ ${mockFigure(mockImages.logo, 'ReactPress community feedback', 'Help us improve ReactPress and this theme starter')}
665
+ <p>Thank you for using ReactPress. We welcome your ideas, bug reports, and documentation feedback.</p>
666
+ <h2>Share your thoughts</h2>
667
+ <ul>
668
+ <li>Report bugs or UX issues on the <a href="${REACTPRESS_GITHUB}/issues" rel="noopener noreferrer">GitHub issue tracker</a>.</li>
669
+ <li>Suggest features for the CLI, admin console, or theme toolkit.</li>
670
+ <li>Share deployment guides for platforms beyond Vercel.</li>
671
+ <li>Tell us which documentation topics need clearer examples.</li>
672
+ </ul>
673
+ <h2>Contributing</h2>
674
+ <p>ReactPress is open source under the MIT license. Fork the repository, run <code>pnpm install</code> and <code>pnpm run dev</code>, and open a pull request. Meaningful contributions are credited in the README.</p>
675
+ <h2>Related reading</h2>
676
+ <ul>
677
+ <li><a href="/article/what-is-reactpress/">ReactPress Technical Architecture</a></li>
678
+ <li><a href="/article/quick-start/">Quick Start with ReactPress</a></li>
679
+ <li><a href="${REACTPRESS_SITE}" rel="noopener noreferrer">Official documentation</a></li>
680
+ <li><a href="${REACTPRESS_GITHUB}" rel="noopener noreferrer">GitHub repository</a></li>
681
+ </ul>
682
+ `.trim()
683
+
684
+ export const mockArticles = [
685
+ {
686
+ id: 'what-is-reactpress',
687
+ title: 'ReactPress Technical Architecture',
688
+ summary:
689
+ 'CLI, NestJS API, MySQL, admin console, and headless themes — how ReactPress splits content management from presentation.',
690
+ content: whatIsReactPressHtml.replace(/<[^>]+>/g, ' '),
691
+ html: whatIsReactPressHtml,
692
+ toc: '',
693
+ cover: mockImages.logo,
694
+ status: 'publish',
695
+ publishAt: daysAgo(1),
696
+ updateAt: daysAgo(1),
697
+ createAt: daysAgo(1),
698
+ category: mockCategories[0],
699
+ tags: [tag('reactpress'), tag('cms'), tag('open-source'), tag('headless-cms')],
700
+ views: 6890,
701
+ likes: 128,
702
+ isRecommended: true,
703
+ password: '',
704
+ needPassword: false,
705
+ isCommentable: true,
706
+ },
707
+ {
708
+ id: 'quick-start',
709
+ title: 'Quick Start with ReactPress',
710
+ summary:
711
+ 'Install @fecommunity/reactpress@3 globally, run init and dev, and open your public site, admin, and API locally.',
712
+ content: quickStartHtml.replace(/<[^>]+>/g, ' '),
713
+ html: quickStartHtml,
714
+ toc: '',
715
+ cover: mockImages.logo,
716
+ status: 'publish',
717
+ publishAt: daysAgo(3),
718
+ updateAt: daysAgo(2),
719
+ createAt: daysAgo(10),
720
+ category: mockCategories[0],
721
+ tags: [tag('reactpress'), tag('cli'), tag('docker'), tag('mysql')],
722
+ views: 4520,
723
+ likes: 96,
724
+ isRecommended: true,
725
+ password: '',
726
+ needPassword: false,
727
+ isCommentable: true,
728
+ },
729
+ {
730
+ id: 'platform-capabilities',
731
+ title: 'ReactPress Architecture in Detail',
732
+ summary:
733
+ 'Request flow from admin to REST API to Theme Starter SSR — monorepo packages and headless mode explained.',
734
+ content: platformCapabilitiesHtml.replace(/<[^>]+>/g, ' '),
735
+ html: platformCapabilitiesHtml,
736
+ toc: '',
737
+ cover: mockImages.logoFull,
738
+ status: 'publish',
739
+ publishAt: daysAgo(7),
740
+ updateAt: daysAgo(5),
741
+ createAt: daysAgo(14),
742
+ category: mockCategories[1],
743
+ tags: [tag('reactpress'), tag('cms'), tag('headless-cms'), tag('nextjs')],
744
+ views: 3180,
745
+ likes: 72,
746
+ isRecommended: true,
747
+ password: '',
748
+ needPassword: false,
749
+ isCommentable: true,
750
+ },
751
+ {
752
+ id: 'cli-reference',
753
+ title: 'ReactPress CLI Reference',
754
+ summary:
755
+ 'Interactive menu, init, dev, doctor, status, build, and start — every command you need from the terminal.',
756
+ content: cliReferenceHtml.replace(/<[^>]+>/g, ' '),
757
+ html: cliReferenceHtml,
758
+ toc: '',
759
+ cover: mockImages.icon,
760
+ status: 'publish',
761
+ publishAt: daysAgo(12),
762
+ updateAt: daysAgo(8),
763
+ createAt: daysAgo(20),
764
+ category: mockCategories[2],
765
+ tags: [tag('cli'), tag('reactpress'), tag('open-source'), tag('nestjs')],
766
+ views: 2140,
767
+ likes: 54,
768
+ isRecommended: true,
769
+ password: '',
770
+ needPassword: false,
771
+ isCommentable: true,
772
+ },
773
+ {
774
+ id: 'deploy-reactpress',
775
+ title: 'Deploy ReactPress to Production',
776
+ summary:
777
+ 'Build and start your CMS for production. Deploy with Vercel, Docker, or PM2 — monolithic or headless.',
778
+ content: deployHtml.replace(/<[^>]+>/g, ' '),
779
+ html: deployHtml,
780
+ toc: '',
781
+ cover: mockImages.icon,
782
+ status: 'publish',
783
+ publishAt: daysAgo(15),
784
+ updateAt: daysAgo(10),
785
+ createAt: daysAgo(22),
786
+ category: mockCategories[2],
787
+ tags: [tag('vercel'), tag('docker'), tag('reactpress'), tag('cli')],
788
+ views: 1680,
789
+ likes: 41,
790
+ isRecommended: true,
791
+ password: '',
792
+ needPassword: false,
793
+ isCommentable: true,
794
+ },
795
+ {
796
+ id: 'theme-starter',
797
+ title: 'ReactPress Theme Starter Guide',
798
+ summary:
799
+ 'Official headless visitor theme — App Router, toolkit integration, theme.json, mock mode, and Vercel deployment.',
800
+ content: themeStarterHtml.replace(/<[^>]+>/g, ' '),
801
+ html: themeStarterHtml,
802
+ toc: '',
803
+ cover: mockImages.logoFull,
804
+ status: 'publish',
805
+ publishAt: daysAgo(18),
806
+ updateAt: daysAgo(12),
807
+ createAt: daysAgo(25),
808
+ category: mockCategories[1],
809
+ tags: [tag('nextjs'), tag('headless-cms'), tag('reactpress'), tag('vercel')],
810
+ views: 1240,
811
+ likes: 33,
812
+ isRecommended: false,
813
+ password: '',
814
+ needPassword: false,
815
+ isCommentable: true,
816
+ },
817
+ ]
818
+
819
+ export const mockRecommendedArticles = mockArticles.filter((article) => article.isRecommended)
820
+
821
+ export const mockArticle = mockArticles[0]
822
+ export const mockCategory = mockCategories[0]
823
+ export const mockTag = mockTags[0]
824
+
825
+ export const mockPages = [
826
+ {
827
+ id: 'suggestions',
828
+ cover: mockImages.logoFull,
829
+ name: 'Suggestions',
830
+ path: 'suggestions',
831
+ order: 0,
832
+ content: suggestionsHtml.replace(/<[^>]+>/g, ' '),
833
+ html: suggestionsHtml,
834
+ toc: '',
835
+ status: 'publish',
836
+ publishAt: daysAgo(30),
837
+ views: 256,
838
+ createAt: daysAgo(30),
839
+ updateAt: daysAgo(2),
840
+ },
841
+ ]
842
+
843
+ export const mockPage = mockPages[0]
844
+
845
+ export const mockArchives = {
846
+ [String(new Date().getFullYear())]: {
847
+ [String(new Date().getMonth() + 1).padStart(2, '0')]: mockArticles.map(
848
+ ({ id, title, publishAt }) => ({ id, title, publishAt })
849
+ ),
850
+ },
851
+ }
852
+
853
+ export const mockKnowledgeChapters = [
854
+ {
855
+ id: 'cli-overview',
856
+ parentId: 'reactpress-handbook',
857
+ order: 0,
858
+ title: 'CLI Overview',
859
+ cover: mockImages.logo,
860
+ summary: 'Commands for init, dev, doctor, status, build, and start.',
861
+ content: 'ReactPress CLI overview for developers.',
862
+ html: `${mockFigure(mockImages.logo, 'ReactPress CLI quick start', 'Global install, init, and dev')}<p>Install <code>@fecommunity/reactpress@3</code> globally and use the interactive menu or run commands directly from your terminal.</p><pre><code>npm i -g @fecommunity/reactpress@3
863
+ reactpress init
864
+ reactpress dev</code></pre><p><img src="${mockImages.logo}" alt="ReactPress logo" width="160" loading="lazy" /></p>`,
865
+ toc: '',
866
+ status: 'publish',
867
+ views: 42,
868
+ likes: 0,
869
+ isCommentable: false,
870
+ publishAt: daysAgo(20),
871
+ createAt: daysAgo(20),
872
+ updateAt: daysAgo(20),
873
+ },
874
+ {
875
+ id: 'api-endpoints',
876
+ parentId: 'reactpress-handbook',
877
+ order: 1,
878
+ title: 'REST API Endpoints',
879
+ cover: mockImages.logoFull,
880
+ summary: 'Articles, pages, settings, categories, tags, and media via JSON API.',
881
+ content: 'Core API endpoints for theme and integration developers.',
882
+ html: `${mockFigure(mockImages.logoFull, 'ReactPress REST API in the architecture', 'NestJS exposes JSON resources consumed by Theme Starter')}<p>The API runs on port <strong>3002</strong> by default. Health check: <code>GET /api/health</code>. All responses use the <code>{ success, data }</code> envelope consumed by <code>@fecommunity/reactpress-toolkit</code>.</p><table><thead><tr><th>Resource</th><th>Theme Starter usage</th></tr></thead><tbody><tr><td>Articles</td><td><code>app/article/[id]</code> SSR detail pages</td></tr><tr><td>Pages</td><td><code>app/page/[id]</code> custom CMS pages</td></tr><tr><td>Settings</td><td>Site title, SEO, navigation via providers</td></tr></tbody></table><p>See <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a> for full API reference.</p>`,
883
+ toc: '',
884
+ status: 'publish',
885
+ views: 36,
886
+ likes: 0,
887
+ isCommentable: false,
888
+ publishAt: daysAgo(15),
889
+ createAt: daysAgo(15),
890
+ updateAt: daysAgo(15),
891
+ },
892
+ {
893
+ id: 'theme-development',
894
+ parentId: 'reactpress-handbook',
895
+ order: 2,
896
+ title: 'Theme Development',
897
+ cover: mockImages.logoFull,
898
+ summary: 'Build visitor sites with theme.json, App Router, and the toolkit.',
899
+ content: 'Guide to building custom ReactPress themes.',
900
+ html: `${mockFigure(mockImages.logoFull, 'ReactPress Theme Starter', 'Official headless visitor theme for ReactPress')}<p>Start from <a href="${THEME_STARTER_GITHUB}">reactpress-theme-starter</a>. Map routes in <code>theme.json</code> templates and fetch content via <code>themeApi</code> during SSR.</p><ul><li><code>pnpm dev:mock</code> — offline preview with built-in mock API</li><li><code>pnpm dev</code> — connect to a live ReactPress instance</li><li><code>pnpm build:mock</code> — CI-friendly production build</li></ul><p>Docs: <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a></p>`,
901
+ toc: '',
902
+ status: 'publish',
903
+ views: 28,
904
+ likes: 0,
905
+ isCommentable: false,
906
+ publishAt: daysAgo(10),
907
+ createAt: daysAgo(10),
908
+ updateAt: daysAgo(10),
909
+ },
910
+ ]
911
+
912
+ export const mockKnowledgeBooks = [
913
+ {
914
+ id: 'reactpress-handbook',
915
+ parentId: '',
916
+ order: 0,
917
+ title: 'ReactPress Handbook',
918
+ cover: mockImages.logo,
919
+ summary: 'CLI, API, and theme development essentials for ReactPress.',
920
+ content: 'ReactPress handbook overview.',
921
+ html: `${mockFigure(mockImages.logo, 'ReactPress Handbook', 'Architecture, API, and Theme Starter essentials')}<p>Everything you need to publish with ReactPress — from <code>reactpress init</code> to headless Theme Starter deployment. Official site: <a href="${REACTPRESS_SITE}" rel="noopener noreferrer">reactpress.surge.sh</a></p>`,
922
+ toc: '',
923
+ status: 'publish',
924
+ views: 128,
925
+ likes: 0,
926
+ isCommentable: false,
927
+ publishAt: daysAgo(30),
928
+ createAt: daysAgo(30),
929
+ updateAt: daysAgo(30),
930
+ children: mockKnowledgeChapters,
931
+ },
932
+ ]
933
+
934
+ export const mockKnowledgeItems = [...mockKnowledgeBooks, ...mockKnowledgeChapters]
935
+
936
+ export function getMockKnowledgeById(id: string) {
937
+ const item = mockKnowledgeItems.find((entry) => entry.id === id)
938
+ if (!item) return mockKnowledgeBooks[0] ?? null
939
+ if (!item.parentId) {
940
+ return {
941
+ ...item,
942
+ children: mockKnowledgeChapters.filter((chapter) => chapter.parentId === item.id),
943
+ }
944
+ }
945
+ return item
946
+ }
947
+
948
+ export function getMockArticleById(id: string) {
949
+ return mockArticles.find((article) => article.id === id) ?? mockArticles[0]
950
+ }
951
+
952
+ export function getMockPageById(id: string) {
953
+ return mockPages.find((page) => page.id === id || page.path === id) ?? mockPage
954
+ }
955
+
956
+ export function getMockCategoryByValue(value: string) {
957
+ return mockCategories.find((category) => category.value === value) ?? mockCategories[0]
958
+ }
959
+
960
+ export function getMockTagByValue(value: string) {
961
+ return mockTags.find((item) => item.value === value) ?? mockTags[0]
962
+ }
963
+
964
+ export function filterMockArticlesByCategory(value: string) {
965
+ return mockArticles.filter((article) => article.category?.value === value)
966
+ }
967
+
968
+ export function filterMockArticlesByTag(value: string) {
969
+ return mockArticles.filter((article) =>
970
+ article.tags?.some((item: { value?: string }) => item.value === value)
971
+ )
972
+ }
973
+
974
+ export function searchMockArticles(keyword: string) {
975
+ const trimmed = keyword.trim().toLowerCase()
976
+ if (!trimmed) return []
977
+
978
+ const terms = trimmed.split(/\s+/).filter((term) => term.length >= 2)
979
+ if (!terms.length) return []
980
+
981
+ return mockArticles.filter((article) => {
982
+ const fields = [
983
+ article.title,
984
+ article.summary,
985
+ article.id,
986
+ article.category?.label,
987
+ article.category?.value,
988
+ ...(article.tags?.map((item: { label?: string; value?: string }) =>
989
+ [item.label, item.value].filter(Boolean).join(' ')
990
+ ) ?? []),
991
+ ]
992
+ .filter(Boolean)
993
+ .join(' ')
994
+ .toLowerCase()
995
+
996
+ return terms.every((term) => fields.includes(term))
997
+ })
998
+ }