astrocms 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +186 -0
  2. package/package.json +4 -2
package/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # AstroCMS
2
+
3
+ A simple, database-free CMS for [Astro](https://astro.build) static websites with first-class MDX support.
4
+
5
+ AstroCMS edits your Markdown and MDX files directly, manages media assets, commits and pushes to your GitHub repository, and ships with an optional Claude Code integration for AI-assisted authoring.
6
+
7
+ ## Why AstroCMS
8
+
9
+ - **No database.** Your content lives in your repo as Markdown/MDX — AstroCMS just edits the files.
10
+ - **Git-native workflow.** Changes are staged, committed, and pushed to GitHub directly from the UI.
11
+ - **Schema-aware.** Frontmatter forms are auto-generated from the Zod schemas in your `content.config.ts`.
12
+ - **MDX-ready.** Edit rich MDX visually, including your own Astro components with typed props and slots.
13
+ - **AI built in.** Optional Claude Code agent for drafting, rewriting, and fixing content.
14
+
15
+ ## Features
16
+
17
+ - **Visual MDX editor** with a frontmatter form generated from your Zod collection schemas
18
+ - **File tree browser** for all Astro content collections
19
+ - **Astro component discovery** — insert your own components into MDX with prop and slot editing
20
+ - **Media upload** to your configured assets directory
21
+ - **Git integration** — status, diff, stage, commit, and push without leaving the browser
22
+ - **Claude Code agent** (optional) for AI-assisted writing and editing
23
+ - **Password protection** for deployed instances
24
+
25
+ ## Requirements
26
+
27
+ - Node.js 20+
28
+ - An Astro project with content collections (`src/content.config.ts`)
29
+
30
+ ## Quickstart
31
+
32
+ Setup takes two steps. Really.
33
+
34
+ ### Option 1 — as a project dependency
35
+
36
+ Install it, then add a script:
37
+
38
+ ```bash
39
+ npm install astrocms
40
+ ```
41
+
42
+ ```json
43
+ {
44
+ "scripts": {
45
+ "astrocms": "astrocms"
46
+ }
47
+ }
48
+ ```
49
+
50
+ Run it from your project:
51
+
52
+ ```bash
53
+ npm run astrocms
54
+ ```
55
+
56
+ ### Option 2 — global install
57
+
58
+ Install once, use on any Astro project:
59
+
60
+ ```bash
61
+ npm install -g astrocms
62
+ ```
63
+
64
+ Then, from any Astro project directory:
65
+
66
+ ```bash
67
+ astrocms
68
+ ```
69
+
70
+ AstroCMS operates on the current working directory (or the path in `ASTROCMS_ROOT`). Either way, it starts on `http://localhost:4001/astrocms`. Pass `--port <n>` to listen on a different port:
71
+
72
+ ```bash
73
+ astrocms --port 5000
74
+ ```
75
+
76
+ ## Configuration
77
+
78
+ AstroCMS reads an optional `astrocms.json` at the project root:
79
+
80
+ ```json
81
+ {
82
+ "contentDir": "src/content",
83
+ "contentConfig": "src/content.config.ts",
84
+ "assetsDir": "src/assets",
85
+ "componentsDir": "src/components"
86
+ }
87
+ ```
88
+
89
+ All fields are optional.
90
+
91
+ | Field | Purpose | Default |
92
+ |---|---|---|
93
+ | `contentDir` | Directory containing your content collections | `src/content` |
94
+ | `contentConfig` | Path to the Zod schema file | `src/content.config.ts` |
95
+ | `assetsDir` | Where uploaded media is written. If unset, uploads are disabled and the directory is never scanned. | *(uploads disabled)* |
96
+ | `componentsDir` | Astro components available in the MDX editor. If unset, component discovery is skipped entirely. | *(components disabled)* |
97
+
98
+ Any `astrocms.json` field can also be set via environment variable. Env values override the JSON file when both are present. This is useful for Docker deployments where the config lives outside the container image.
99
+
100
+ | Env var | Overrides |
101
+ |---|---|
102
+ | `ASTROCMS_CONTENT_DIR` | `contentDir` |
103
+ | `ASTROCMS_CONTENT_CONFIG` | `contentConfig` |
104
+ | `ASTROCMS_ASSETS_DIR` | `assetsDir` |
105
+ | `ASTROCMS_COMPONENTS_DIR` | `componentsDir` |
106
+
107
+ Deployment-only environment variables:
108
+
109
+ | Env var | Description | Default |
110
+ |---|---|---|
111
+ | `ASTROCMS_PASSWORD` | Optional password protection | *(none)* |
112
+ | `ASTROCMS_DEV_CMD` | Command to start the website dev server inside the container. When set, AstroCMS proxies the root path to the dev server. | *(none)* |
113
+ | `ASTROCMS_DEV_PORT` | Port the dev server listens on (used for the proxy and for probing). | `4321` when `ASTROCMS_DEV_CMD` is set |
114
+ | `ASTROCMS_INSTALL_CMD` | Override the project dependency install command in the container. By default the entrypoint auto-detects npm / pnpm / yarn / bun from the lockfile. | *(auto-detected)* |
115
+ | `GIT_REPO_URL` | Git repo URL (Docker mode) | *(auto-detected)* |
116
+ | `GIT_BRANCH` | Git branch | `main` |
117
+ | `GIT_PAT` | GitHub Personal Access Token | *(none)* |
118
+ | `GIT_USER_EMAIL` | Git commit email | `cms@astrocms.dev` |
119
+ | `GIT_USER_NAME` | Git commit author | `AstroCMS` |
120
+
121
+ A `.env` file at the project root is auto-loaded when running `astrocms` locally. Shell variables take precedence over `.env` values.
122
+
123
+ ## Deploying with Docker
124
+
125
+ Use the provided Docker image to clone and serve a git-hosted Astro project:
126
+
127
+ ```bash
128
+ docker compose up
129
+ ```
130
+
131
+ Configure via `.env` (see `.env.example`):
132
+
133
+ ```env
134
+ GIT_REPO_URL=https://github.com/user/repo
135
+ GIT_BRANCH=main
136
+ GIT_PAT=ghp_xxx
137
+ ASTROCMS_PASSWORD=secret
138
+ ```
139
+
140
+ The `app-data` volume is persistent: if a clone already exists at startup, it is reused instead of re-cloned. The container always serves on port `4001` internally; change the host-side mapping in `docker-compose.yml` to expose it elsewhere.
141
+
142
+ The CMS UI and its API live under `/astrocms`. Visit `http://localhost:4001/astrocms` to open it.
143
+
144
+ ### Serving the website alongside the CMS
145
+
146
+ Set `ASTROCMS_DEV_CMD` to run the website's own dev server inside the container. AstroCMS then proxies every request outside `/astrocms` to the website, so both live at the same origin:
147
+
148
+ ```env
149
+ ASTROCMS_DEV_CMD=npm run dev
150
+ ASTROCMS_DEV_PORT=4321
151
+ ```
152
+
153
+ With that, `http://localhost:4001/` serves the live site and `http://localhost:4001/astrocms` serves the CMS. A "Preview" button also appears in the CMS header whenever the dev server is reachable. Without `ASTROCMS_DEV_CMD`, the root path redirects to `/astrocms`.
154
+
155
+ ### Generating a GitHub PAT
156
+
157
+ `GIT_PAT` must be a GitHub Personal Access Token with permission to clone, pull, and push on the target repository.
158
+
159
+ 1. Go to https://github.com/settings/personal-access-tokens and click **Generate new token** (fine-grained).
160
+ 2. **Repository access**: select **Only select repositories** and pick the repo you'll point `GIT_REPO_URL` at.
161
+ 3. **Repository permissions**:
162
+ - **Contents**: `Read and write` (required for clone, pull, push)
163
+ - **Metadata**: `Read-only` (selected automatically)
164
+ 4. Click **Generate token** and copy the value — it's shown only once.
165
+ 5. Paste it into `.env` as `GIT_PAT=github_pat_...`.
166
+
167
+ No other permissions are needed.
168
+
169
+ ## Contributing
170
+
171
+ Want to hack on AstroCMS itself? See [DEVELOPMENT.md](./DEVELOPMENT.md).
172
+
173
+ ## Tech stack
174
+
175
+ - **Backend:** [Hono](https://hono.dev) on Node
176
+ - **Frontend:** React 19 + [Vite](https://vitejs.dev) + [Tailwind CSS](https://tailwindcss.com)
177
+ - **Editor:** [MDXEditor](https://mdxeditor.dev) with schema-driven frontmatter
178
+ - **AI:** [Claude Code](https://claude.com/claude-code) via `ai-sdk-provider-claude-code`
179
+
180
+ ## License
181
+
182
+ MIT © Lonestone
183
+
184
+ ---
185
+
186
+ AstroCMS is a non-profit, open-source project. AstroCMS and Lonestone are not affiliated with, endorsed by, or sponsored by The Astro Technology Company; this project simply targets the open-source Astro framework.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrocms",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A headless CMS for Astro with a built-in AI agent for editing content.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,7 +36,9 @@
36
36
  "dev": "tsx watch backend/server.ts & vite dev --config frontend/vite.config.ts",
37
37
  "dev:server": "tsx watch backend/server.ts",
38
38
  "dev:frontend": "vite dev --config frontend/vite.config.ts",
39
- "build": "vite build --config frontend/vite.config.ts"
39
+ "build": "vite build --config frontend/vite.config.ts",
40
+ "prepack": "cp ../../README.md ./README.md",
41
+ "postpack": "rm -f ./README.md"
40
42
  },
41
43
  "dependencies": {
42
44
  "@assistant-ui/react": "^0.12.20",