octocms 0.1.1 → 0.1.2
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.
- package/README.md +89 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# OctoCMS
|
|
2
|
+
|
|
3
|
+
A file-based CMS for Next.js. Schema defined in TypeScript, content stored as JSON files, Git-backed, no database.
|
|
4
|
+
|
|
5
|
+
**[octocms.com](https://octocms.com)** · [Docs](https://octocms.com/docs)
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Next.js 15+
|
|
10
|
+
- React 18+
|
|
11
|
+
- Node.js 18+
|
|
12
|
+
- A GitHub App (for CMS authentication)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install octocms
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Initialize
|
|
21
|
+
|
|
22
|
+
Run in the root of an existing Next.js project:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx octocms init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This creates:
|
|
29
|
+
- `cms/octocms.config.ts` — your schema
|
|
30
|
+
- `app/cms/` — CMS admin route (protected by GitHub OAuth)
|
|
31
|
+
- `app/hello/page.tsx` — demo page using `query()`
|
|
32
|
+
- `cms/content/helloPage/` — demo content entry
|
|
33
|
+
- `.env.local` — environment variable stubs
|
|
34
|
+
- `README.md` — setup guide
|
|
35
|
+
|
|
36
|
+
Then fill in `.env.local` and run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx octocms types:gen # generate TypeScript types
|
|
40
|
+
npm run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Visit `http://localhost:3000/cms` to open the editor.
|
|
44
|
+
|
|
45
|
+
## Environment Variables
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
GITHUB_ID= # GitHub App client ID
|
|
49
|
+
GITHUB_SECRET= # GitHub App client secret
|
|
50
|
+
NEXTAUTH_SECRET= # Random string: openssl rand -base64 32
|
|
51
|
+
NEXTAUTH_URL=http://localhost:3000
|
|
52
|
+
|
|
53
|
+
# Required in production
|
|
54
|
+
GITHUB_REPO_OWNER=
|
|
55
|
+
GITHUB_REPO_NAME=
|
|
56
|
+
# CMS_GITHUB_TOKEN= # Optional: for private repos / higher rate limits
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## CLI
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx octocms init # Initialize in a Next.js project
|
|
63
|
+
npx octocms types:gen # Regenerate TypeScript types from schema
|
|
64
|
+
npx octocms dev # Start dev server with config watching
|
|
65
|
+
npx octocms validate # Validate all content against schema
|
|
66
|
+
npx octocms update # Regenerate admin route files
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Query API
|
|
70
|
+
|
|
71
|
+
Read content in Server Components, layouts, and route handlers:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { query } from 'cms/__generated__/query';
|
|
75
|
+
|
|
76
|
+
// List
|
|
77
|
+
const posts = await query('post')
|
|
78
|
+
.filter((p) => p.fields.publishedAt !== null)
|
|
79
|
+
.sort('publishedAt', 'desc')
|
|
80
|
+
.limit(10)
|
|
81
|
+
.toArray();
|
|
82
|
+
|
|
83
|
+
// Singleton
|
|
84
|
+
const page = await query('homePage').first();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|