Enhance documentation and admin UI: Add detailed implementation guidelines in CLAUDE.md, introduce a referrer index in README.md, and update admin UI translations for improved user experience. Update package dependencies for better functionality and performance.
This commit is contained in:
@@ -11,6 +11,7 @@ A file-based headless CMS written in Rust. Content types are defined as JSON5 sc
|
||||
- **Optional SQLite**: Switch store via env – same API, different storage layer
|
||||
- **REST API**: Full CRUD endpoints, auto-generated per content type
|
||||
- **References & _resolve**: Reference fields as `{ _type, _slug }`; embed with `?_resolve=all`
|
||||
- **Referrer index**: Reverse index of who references which entry; file-based in `content/_referrers.json`; full reindex when file is missing; `GET /api/content/:type/:slug/referrers`
|
||||
- **Reusable partials**: `reusable` schemas and `useFields` for shared field groups (e.g. layout)
|
||||
- **Optional API auth**: Protect write access (POST/PUT/DELETE) with an API key via env
|
||||
- **Admin UI**: Next.js web interface for browsing collections, creating and editing content; manage types (list, create, edit, delete) with schema files and JSON Schema export updated on save
|
||||
@@ -125,6 +126,10 @@ RUSTYCMS_STORE=sqlite cargo run
|
||||
RUSTYCMS_API_KEY=your-secret-token cargo run
|
||||
```
|
||||
|
||||
### Referrer index
|
||||
|
||||
When not using `RUSTYCMS_ENVIRONMENTS`, the API maintains a **reverse index** of references: for each entry it knows which other entries reference it. This is stored as a single JSON file in the content directory: **`content/_referrers.json`**. On startup, if that file is missing, a full reindex is run over all collections and locales; on every create/update/delete the index is updated incrementally. Use **`GET /api/content/:type/:slug/referrers`** to list referrers (response: array of `{ collection, slug, field, locale? }`). Documented in Swagger UI and OpenAPI spec.
|
||||
|
||||
## Project structure
|
||||
|
||||
```
|
||||
@@ -259,6 +264,8 @@ Add a `.json5` file under `types/`:
|
||||
| `fields` | object | Nested fields for object type |
|
||||
| `collection`| string | Target collection for reference type |
|
||||
| `useFields` | string | For `type: "object"`: use fields from this schema (partial) |
|
||||
| `widget` | string | For `string`: `"textarea"` = multi-line; `"code"` = code editor with syntax highlighting (requires `codeLanguage`) |
|
||||
| `codeLanguage` | string | When `widget: "code"`: `"css"`, `"javascript"`, `"json"`, or `"html"` – used for highlighting and copy in admin UI |
|
||||
|
||||
### Field types
|
||||
|
||||
@@ -427,6 +434,7 @@ curl -X POST http://localhost:3000/api/content/product \
|
||||
| `DELETE` | `/api/schemas/:type` | Delete type definition (Admin UI: Delete type) |
|
||||
| `GET` | `/api/content/:type` | List all entries |
|
||||
| `GET` | `/api/content/:type/:slug` | Get single entry |
|
||||
| `GET` | `/api/content/:type/:slug/referrers` | List entries that reference this entry |
|
||||
| `POST` | `/api/content/:type` | Create entry |
|
||||
| `PUT` | `/api/content/:type/:slug` | Update entry |
|
||||
| `DELETE` | `/api/content/:type/:slug` | Delete entry |
|
||||
|
||||
Reference in New Issue
Block a user