Rustelo/resources/README.md

95 lines
3.5 KiB
Markdown
Raw Normal View History

2026-07-18 20:16:16 +01:00
# Rustelo Resource Library
Base resources for all Rustelo implementations. These are the framework-level
schemas, contracts, translations, and templates that any site built on Rustelo
can import and override.
## Structure
```
resources/
├── nickel/ NCL schemas and contracts (validation layer)
├── i18n/ Base FTL translations (framework-level only)
└── templates/ Base templates for email and build tooling
```
## nickel/ — Nickel Schemas
Type contracts and default values for every configuration area. Implementations
import these to validate their `site/config/` files at compile time.
| Directory | Validates |
|---------------------|------------------------------------------------|
| `site/` | `site/config/index.ncl` — full site config |
| `rbac/` | `site/rbac.ncl` — access policy |
| `routes/` | Route definitions and menu entries |
| `themes/` | Theme configuration |
| `content/` | Content types and post metadata |
| `security/` | Security headers and CSP |
| `server/` | HTTP server configuration |
| `features/` | Feature flags |
| `menus/` | Navigation menu entries |
| `footer/` | Footer configuration |
| `email/` | Email provider configuration |
| `pipelines/` | CI/CD and NATS pipeline configuration |
| `external-services/`| Third-party service integration |
| `deps/` | Dependency version constraints |
`nickel/rbac/rbac-starter.ncl` is a minimal starter policy to copy into a new
implementation's `site/rbac.ncl`.
## i18n/ — Base Translations
Framework-level FTL strings covering authentication, common UI, navigation,
cookie consent, generic page messages, and admin tooling.
Implementations override individual keys by providing the same key in their
own FTL files — the registration system applies implementation strings with
higher priority than framework defaults.
### Naming convention
All keys are prefixed by their domain to avoid collisions across plugins:
```
auth-sign-in auth-*
nav-home nav-*
footer-copyright footer-*
cookie-accept cookie-*
content-read-more content-*
form-submit form-*
```
### What is NOT here
Site-specific page strings (home page, about, contact, services, etc.) live
in the implementation's `site/i18n/locales/` and are never part of the
framework resource library.
## templates/ — Base Templates
| Directory | Contents |
|-----------------|--------------------------------------------------|
| `email/` | OTP code emails, form submission notifications |
| `build-tools/` | Tera templates for build-time documentation |
## Usage in implementations
```nickel
# site/config/index.ncl
let C = import "path/to/rustelo/resources/nickel/site/contracts.ncl" in
{
site = { name = "My Site", ... },
...
} | C.SiteConfig
```
```nickel
# site/rbac.ncl — start from the starter template
# cp rustelo/resources/nickel/rbac/rbac-starter.ncl site/rbac.ncl
```
FTL strings are loaded automatically at startup via `ResourceContributor`
no manual import required. Implementation strings override framework defaults.