create-start-serenojs 0.0.0-stage → 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 (32) hide show
  1. package/README.md +129 -2
  2. package/dist/args.d.ts +14 -0
  3. package/dist/args.js +54 -0
  4. package/dist/banner.d.ts +1 -0
  5. package/dist/banner.js +18 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +244 -0
  8. package/dist/pm.d.ts +9 -0
  9. package/dist/pm.js +17 -0
  10. package/dist/template.d.ts +12 -0
  11. package/dist/template.js +92 -0
  12. package/package.json +49 -3
  13. package/templates/starter/.agents/skills/serenojs-schema/SKILL.md +165 -0
  14. package/templates/starter/.agents/skills/serenojs-schema/assets/collection.template.ts +27 -0
  15. package/templates/starter/.agents/skills/serenojs-schema/references/fields.md +121 -0
  16. package/templates/starter/README.md +190 -0
  17. package/templates/starter/gitignore +11 -0
  18. package/templates/starter/package.json +33 -0
  19. package/templates/starter/public/.gitkeep +0 -0
  20. package/templates/starter/serenojs.config.ts +33 -0
  21. package/templates/starter/src/global.d.ts +1 -0
  22. package/templates/starter/src/middleware/no-trailing-slash.ts +14 -0
  23. package/templates/starter/src/middleware/serenojs.ts +9 -0
  24. package/templates/starter/src/pages/_layout.tsx +13 -0
  25. package/templates/starter/src/pages/index.tsx +319 -0
  26. package/templates/starter/src/pages.gen.ts +23 -0
  27. package/templates/starter/src/schemas/index.ts +17 -0
  28. package/templates/starter/src/schemas/locales.ts +27 -0
  29. package/templates/starter/src/schemas/todos.ts +38 -0
  30. package/templates/starter/src/styles.css +741 -0
  31. package/templates/starter/tsconfig.json +32 -0
  32. package/templates/starter/waku.config.ts +20 -0
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: serenojs-schema
3
+ description: Use when creating, editing, or designing a SerenoJS collection descriptor (schema) — adding a new collection or field, configuring relations, standalone collections, access control, or localization — in the src/schemas directory of this project.
4
+ ---
5
+
6
+ # SerenoJS — Collection schema
7
+
8
+ This project's admin panel, REST API, validation and SQLite tables are all
9
+ generated from `CollectionDef` descriptors in `src/schemas/`. The schema is the
10
+ single source of truth. Get the descriptor right and everything else follows.
11
+
12
+ Mount paths (admin, API, auth, media, files, backup) and the global locale
13
+ registry live in `serenojs.config.ts`. Collections reference those settings but
14
+ never hardcode paths.
15
+
16
+ ## When to use
17
+
18
+ - Adding a new collection.
19
+ - Adding/editing a field on an existing collection.
20
+ - Configuring relations, standalone records, access control, or locales.
21
+
22
+ When NOT to use: hand-writing SQL tables/forms (never do that), or editing the
23
+ admin UI/API routes directly (those are generated at runtime).
24
+
25
+ ## Process (do this every time)
26
+
27
+ 1. Read `references/fields.md` to pick the right field type and options.
28
+ 2. Create `src/schemas/<name>.ts` exporting a typed `CollectionDef`.
29
+ Start from `assets/collection.template.ts`.
30
+ 3. Register it in `src/schemas/index.ts` (add to the `collections` array).
31
+ 4. Restart the dev server — the DB migrates lazily on first open.
32
+ 5. Verify: `pnpm typegen` (only if you also added pages) and `pnpm build`
33
+ (or `tsc --noEmit`).
34
+
35
+ No route files or admin rebuilds are needed: the package generates the admin
36
+ forms, API handlers and validation from the descriptors.
37
+
38
+ ## Descriptor anatomy
39
+
40
+ ```ts
41
+ import type { CollectionDef } from "@eutobias/serenojs/config";
42
+
43
+ export const todos: CollectionDef = {
44
+ slug: "todos", // URL + table name source (kebab-case)
45
+ label: "Tarefas", // shown in admin UI
46
+ icon: "box", // optional Feather icon name (see registry below)
47
+ description: "...", // optional
48
+ standalone: false, // true = single-record collection
49
+ locales: ["pt", "en"], // omit to fall back to [defaultLocale]
50
+ list: ["id", "title", "done"], // list-view columns; omit = all fields
51
+ access: { // per-operation API access (see below)
52
+ read: "public",
53
+ create: "private",
54
+ update: "private",
55
+ delete: "private",
56
+ },
57
+ fields: [
58
+ { name: "title", label: "Título", type: "text", required: true },
59
+ ],
60
+ };
61
+ ```
62
+
63
+ `list` accepts field names plus the managed columns `id`, `createdAt` and
64
+ `updatedAt`. `locales` must be a subset of the registry in
65
+ `src/schemas/locales.ts` (re-exported by `serenojs.config.ts`).
66
+
67
+ ## Field rules
68
+
69
+ - `name` is the stable identifier (snake_case/camelCase). It becomes the API
70
+ key and the physical column name (or `<name>_<locale>` when localized).
71
+ - `label` is shown in the admin UI. Schema labels are **not** translated by the
72
+ admin language selector (EN/PT) — write them in the language your editors
73
+ use.
74
+ - `type` must be one of the 11 field types — see `references/fields.md`.
75
+ - `required` is enforced per locale for localized fields (no fallback).
76
+
77
+ ## Localization (`localized`)
78
+
79
+ - Defaults to `true` for `text`, `textarea`, `email`, `list`; `false` for the
80
+ rest (`number`, `boolean`, `date`, `select`, `relation`, `media`,
81
+ `media-list`).
82
+ - Set `localized: false` to keep a text field language-independent (e.g. `slug`,
83
+ `url`, `icon`).
84
+ - Storage is one column per locale (`name_pt`, `name_en`); the API/form shape is
85
+ nested `{ "name": { "pt": "...", "en": "..." } }`.
86
+ - Partial updates only touch the locales present in the payload.
87
+ - Admin lists and relation labels render the default locale.
88
+ - A collection without any localized field renders only the "Geral" section in
89
+ the admin (no locale tabs).
90
+
91
+ ## Access control (`access`)
92
+
93
+ Each key maps to HTTP methods on `<api.path>/<slug>` — by default
94
+ `/api/<slug>`, configurable through `serenojs.config.ts` (`api.path`):
95
+
96
+ | key | method | default |
97
+ |---|---|---|
98
+ | `read` | `GET` / `HEAD` / `OPTIONS` | `"public"` |
99
+ | `create` | `POST` | `"private"` |
100
+ | `update` | `PATCH` / `PUT` | `"private"` |
101
+ | `delete` | `DELETE` | `"private"` |
102
+
103
+ `"public"` = no auth; `"private"` = auth required. Omit `access` for defaults.
104
+
105
+ ## API shape
106
+
107
+ With the default API mount (`/api`):
108
+
109
+ - `GET /api/<slug>?page=1&limit=10&q=search` →
110
+ `{ items, total, page, limit, totalPages }`.
111
+ - `GET /api/<slug>/:id` → `{ item }`.
112
+ - `POST /api/<slug>` → `{ item }` (201).
113
+ - `PATCH` / `PUT /api/<slug>/:id` → `{ item }`. `PUT` uses the same partial
114
+ update handler as `PATCH`; it is not a full replace.
115
+ - `DELETE /api/<slug>/:id` → `{ ok: true }`.
116
+ - `GET /api/<slug>/relations` → `{ options }` (auth required).
117
+ - Errors: `{ message, errors? }` with `400/401/403/404/405/409/422/500`.
118
+
119
+ Never hardcode the API prefix in clients — read it from the CMS config (`/api` by default).
120
+
121
+ ## Relations (`type: "relation"`)
122
+
123
+ ```ts
124
+ { name: "author", label: "Autor", type: "relation", relation: { to: "users", type: "one-to-one" } }
125
+ { name: "tags", label: "Tags", type: "relation", relation: { to: "tags", type: "many-to-many" } }
126
+ ```
127
+
128
+ - `one-to-one` → INTEGER column (single id).
129
+ - `one-to-many` / `many-to-many` → join table `r_<collection>_<field>`.
130
+ - Target `to` must be the slug of another registered collection.
131
+ - Deletes cascade: `deleteItem` removes join rows and nulls/clears references.
132
+
133
+ ## Standalone collections
134
+
135
+ `standalone: true` = exactly one record. The admin shows an inline form (no
136
+ table/CRUD); the API exposes `GET` and `PATCH <api.path>/<slug>` (no id) and
137
+ rejects `POST`/`DELETE` with `405`. Both return the single record as `{ item }`.
138
+
139
+ ## Icon registry
140
+
141
+ `collection.icon` must be one of the Feather names registered in the package at
142
+ `@eutobias/serenojs` → `src/ui/admin/collection-icon.tsx`:
143
+
144
+ `archive`, `box`, `fileText`, `folder`, `grid`, `image`, `layout`, `settings`,
145
+ `star`, `tag`, `user`, `users`.
146
+
147
+ Never use emoji/unicode glyphs. Unknown names fall back to `grid`.
148
+
149
+ ## Common mistakes
150
+
151
+ - Forgetting to register the collection in `src/schemas/index.ts` — it silently
152
+ won't appear.
153
+ - Renaming a field `name` after data exists — `migrate()` adds a new column, it
154
+ does not rename (except the legacy single→localized column case).
155
+ - Assuming `write` exists as an access key — it was replaced by
156
+ `create`/`update`/`delete`.
157
+ - Setting a relation `to` slug that isn't registered.
158
+ - Using a field type outside the 11 supported types.
159
+ - Hardcoding the API prefix (`/api`) in frontend code — paths come from the config.
160
+ - Expecting schema labels to be translated by the admin UI language selector.
161
+
162
+ ## Reference files
163
+
164
+ - `references/fields.md` — full field-type reference with options per type.
165
+ - `assets/collection.template.ts` — copy-paste starting point.
@@ -0,0 +1,27 @@
1
+ import type { CollectionDef } from "@eutobias/serenojs/config";
2
+
3
+ export const example: CollectionDef = {
4
+ slug: "example",
5
+ label: "Exemplo",
6
+ icon: "box",
7
+ description: "Descrição curta do que esta coleção guarda.",
8
+ // access: { read: "public", create: "private", update: "private", delete: "private" },
9
+ // standalone: true,
10
+ // locales: ["pt", "en"],
11
+ list: ["id", "title", "createdAt"],
12
+ fields: [
13
+ { name: "title", label: "Título", type: "text", required: true },
14
+ { name: "description", label: "Descrição", type: "textarea" },
15
+ {
16
+ name: "status",
17
+ label: "Status",
18
+ type: "select",
19
+ defaultValue: "draft",
20
+ options: [
21
+ { label: "Rascunho", value: "draft" },
22
+ { label: "Publicado", value: "published" },
23
+ ],
24
+ },
25
+ { name: "published", label: "Publicado", type: "boolean", defaultValue: false },
26
+ ],
27
+ };
@@ -0,0 +1,121 @@
1
+ # Field type reference
2
+
3
+ Every field is a `FieldDef` exported from `@eutobias/serenojs/config` (package
4
+ source: `src/core/types.ts`). Common props first, then per-type options.
5
+
6
+ ## Common props (all types)
7
+
8
+ | prop | type | notes |
9
+ |---|---|---|
10
+ | `name` | `string` | stable id, API key, column name |
11
+ | `label` | `string` | admin label; not translated by the UI language selector |
12
+ | `type` | `FieldType` | one of the 11 below |
13
+ | `required?` | `boolean` | per-locale for localized fields |
14
+ | `placeholder?` | `string` | input placeholder |
15
+ | `help?` | `string` | helper text under the field |
16
+ | `localized?` | `boolean` | override the per-type default |
17
+ | `defaultValue?` | `string \| number \| boolean` | applied on create when the field is absent |
18
+
19
+ `createdAt` and `updatedAt` are managed by the package; do not declare them as
20
+ fields. They can be used in `collection.list`.
21
+
22
+ ## Types
23
+
24
+ ### text
25
+ Single-line string. Localized by default.
26
+ ```ts
27
+ { name: "title", label: "Título", type: "text", required: true }
28
+ ```
29
+
30
+ ### email
31
+ String validated against an email regex. Localized by default.
32
+ ```ts
33
+ { name: "email", label: "E-mail", type: "email", required: true }
34
+ ```
35
+
36
+ ### textarea
37
+ Multi-line string. Localized by default.
38
+ ```ts
39
+ { name: "description", label: "Descrição", type: "textarea" }
40
+ ```
41
+
42
+ ### number
43
+ Number, coerced and range-checked. Options: `min`, `max`. Not localized.
44
+ On create it defaults to `min` (or `0`).
45
+ ```ts
46
+ { name: "order", label: "Ordem", type: "number", min: 0, defaultValue: 0 }
47
+ ```
48
+
49
+ ### boolean
50
+ Checkbox. Stored as INTEGER 0/1. Not localized. Defaults to `false` on create.
51
+ ```ts
52
+ { name: "done", label: "Concluída", type: "boolean", defaultValue: false }
53
+ ```
54
+
55
+ ### select
56
+ Single choice from `options`. Not localized. `defaultValue` should match one
57
+ of the option values; when omitted, the first option is used.
58
+ ```ts
59
+ {
60
+ name: "priority", label: "Prioridade", type: "select",
61
+ options: [
62
+ { label: "Baixa", value: "low" },
63
+ { label: "Média", value: "medium" },
64
+ { label: "Alta", value: "high" },
65
+ ],
66
+ defaultValue: "medium",
67
+ }
68
+ ```
69
+
70
+ ### date
71
+ Date input, stored as a `TEXT` string (ISO `YYYY-MM-DD`). Not localized.
72
+ ```ts
73
+ { name: "dueDate", label: "Prazo", type: "date" }
74
+ ```
75
+
76
+ ### relation
77
+ Reference to another collection. Requires `relation: { to, type }`. Not localized.
78
+ - `type`: `"one-to-one"` | `"one-to-many"` | `"many-to-many"`.
79
+ - `one-to-one` → single INTEGER column.
80
+ - `one-to-many` / `many-to-many` → join table `r_<collection>_<field>`.
81
+ - Values are numeric ids (or arrays of ids for the join-table variants).
82
+ - Defaults to `null` (`one-to-one`) or an empty array on create.
83
+
84
+ ```ts
85
+ { name: "author", label: "Autor", type: "relation", relation: { to: "users", type: "one-to-one" } }
86
+ { name: "tags", label: "Tags", type: "relation", relation: { to: "tags", type: "many-to-many" } }
87
+ ```
88
+
89
+ ### media
90
+ Single upload, stored as the served URL at the configured files path (default
91
+ `/files/<name>`). Options: `accept` (MIME types or extensions), `maxSize`
92
+ (bytes). Omit `accept` to allow only images and PDFs; `maxSize` defaults to
93
+ 10 MB. Not localized.
94
+ ```ts
95
+ { name: "cover", label: "Capa", type: "media", accept: ["image/*"], maxSize: 5 * 1024 * 1024 }
96
+ ```
97
+
98
+ ### media-list
99
+ Ordered array of `{ url, alt?, primary? }` (at most one `primary`). Stored as
100
+ JSON in a `TEXT` column. Options: `accept`, `maxSize` (default 10 MB). The
101
+ first item becomes `primary` when none is marked. Not localized.
102
+ ```ts
103
+ { name: "medias", label: "Mídias", type: "media-list", accept: ["image/*"] }
104
+ ```
105
+
106
+ ### list
107
+ Ordered array of short strings (JSON in a `TEXT` column). Defaults to an empty
108
+ array. Localized by default.
109
+ ```ts
110
+ { name: "highlights", label: "Destaques", type: "list" }
111
+ ```
112
+
113
+ ## Localization defaults
114
+
115
+ | default | types |
116
+ |---|---|
117
+ | localized | `text`, `textarea`, `email`, `list` |
118
+ | not localized | `number`, `boolean`, `date`, `select`, `relation`, `media`, `media-list` |
119
+
120
+ Override with `localized: true/false` on any field. Localized columns are
121
+ `<name>_<locale>` and required is checked for every locale.
@@ -0,0 +1,190 @@
1
+ # SerenoJS Starter
2
+
3
+ A minimal [SerenoJS](https://github.com/eutobias/serenojs) starter built on
4
+ [Waku](https://waku.gg): React 19 server components, a schema-driven admin
5
+ panel, a REST API, cookie authentication and SQLite — with no ORM and no
6
+ external services.
7
+
8
+ The app ships:
9
+
10
+ - a demo `todos` collection (`src/schemas/todos.ts`);
11
+ - a small todos example app that consumes the public API
12
+ (`src/pages/index.tsx`);
13
+ - the admin panel mounted at `/admin`;
14
+ - content localization configured for `pt` (default) and `en`;
15
+ - agent skills that teach coding assistants how to extend the CMS
16
+ (`.agents/skills/`).
17
+
18
+ ## Requirements
19
+
20
+ - **Node `>=22.15`** (uses `node:sqlite`) or **Bun `>=1.4.3`**
21
+ - `pnpm` recommended (`npm`, `yarn` and `bun` also work)
22
+
23
+ ## Getting started
24
+
25
+ If you scaffolded this project with `create-start-serenojs`, dependencies are
26
+ already installed. Otherwise:
27
+
28
+ ```sh
29
+ pnpm install
30
+ ```
31
+
32
+ Start the development server:
33
+
34
+ ```sh
35
+ pnpm dev
36
+ ```
37
+
38
+ Then open:
39
+
40
+ - Example app: <http://localhost:3000>
41
+ - Admin panel: <http://localhost:3000/admin>
42
+
43
+ ### First login
44
+
45
+ The first boot seeds an administrator:
46
+
47
+ | E-mail | Password |
48
+ | --- | --- |
49
+ | `admin@example.com` | `admin123` |
50
+
51
+ Change the password (or create a new user) before deploying. Override the seed
52
+ with `ADMIN_EMAIL` / `ADMIN_PASSWORD` **before the first boot**.
53
+
54
+ ## Scripts
55
+
56
+ | Script | What it does |
57
+ | --- | --- |
58
+ | `pnpm dev` | Start Waku in development mode |
59
+ | `pnpm build` | Build for production |
60
+ | `pnpm start` | Serve the production build |
61
+ | `pnpm typegen` | Regenerate `src/pages.gen.ts` after adding/removing pages |
62
+
63
+ ## Project structure
64
+
65
+ ```
66
+ serenojs.config.ts # collections, locales and mount paths
67
+ .agents/
68
+ skills/
69
+ serenojs-schema/ # agent skill: how to model collections
70
+ src/
71
+ schemas/ # SOURCE OF TRUTH for content types
72
+ index.ts # exports `collections`
73
+ locales.ts # locale registry + defaultLocale
74
+ todos.ts # example collection
75
+ middleware/
76
+ serenojs.ts # mounts @eutobias/serenojs/server
77
+ no-trailing-slash.ts
78
+ pages/
79
+ _layout.tsx # root layout (imports the stylesheet)
80
+ index.tsx # todos example app
81
+ styles.css # example app styles
82
+ pages.gen.ts # generated by `pnpm typegen` - do not edit
83
+ ```
84
+
85
+ There are no admin/API/auth route files: the package middleware answers those
86
+ requests before Waku's file-system router sees them.
87
+
88
+ ### Example app
89
+
90
+ The starter includes a small todos app (`src/pages/index.tsx`) that consumes the
91
+ public REST API. It is intentionally self-contained: keep it, rewrite it, or
92
+ remove it. You are free to use any component library and any styling solution
93
+ you prefer. Nothing in the app is tied to the admin panel, which ships its own
94
+ bundled styles and is not affected by the host app.
95
+
96
+ ## Content modeling
97
+
98
+ Collections live in `src/schemas/` and are aggregated by `src/schemas/index.ts`.
99
+ To add a content type:
100
+
101
+ 1. Create `src/schemas/<name>.ts` exporting a `CollectionDef`.
102
+ 2. Register it in the `collections` array in `src/schemas/index.ts`.
103
+ 3. Restart the dev server — SQLite is migrated lazily and the admin/API pick up
104
+ the new collection automatically.
105
+
106
+ Supported field types: `text`, `email`, `textarea`, `number`, `boolean`,
107
+ `select`, `date`, `relation`, `media`, `media-list` and `list`.
108
+
109
+ Collections are private by default for writes. `access` controls each API
110
+ operation (`read`, `create`, `update`, `delete`); the demo opens everything up:
111
+
112
+ ```ts
113
+ access: { read: "public", create: "public", update: "public", delete: "public" },
114
+ ```
115
+
116
+ ## AI agent skills
117
+
118
+ The project ships coding-agent skills in `.agents/skills/`. They are plain
119
+ Markdown and are picked up automatically by assistants that support the
120
+ `.agents/skills` convention (no build step needed).
121
+
122
+ - **`serenojs-schema`** — how to create and edit collection descriptors:
123
+ field types, relations, standalone collections, access control, validation,
124
+ localization and naming conventions. It includes a ready-to-edit collection
125
+ template (`assets/collection.template.ts`) and a field reference
126
+ (`references/fields.md`).
127
+
128
+ When asking an assistant for a new content type, point it at
129
+ `.agents/skills/serenojs-schema/SKILL.md` or simply mention that a SerenoJS
130
+ collection is needed — the skill documents the project-specific rules so the
131
+ schema matches what the admin and API expect.
132
+
133
+ ## Configuration
134
+
135
+ `serenojs.config.ts` defines the admin mount path, API paths, locales, DB file,
136
+ media and backups. Useful environment variables:
137
+
138
+ | Variable | Default | Purpose |
139
+ | --- | --- | --- |
140
+ | `ADMIN_PATH` | `/admin` | Admin panel mount path |
141
+ | `ADMIN_ENABLED` | `true` | Set to `false` to disable the panel |
142
+ | `ADMIN_API_PATH` | `/api` | REST API prefix |
143
+ | `ADMIN_AUTH_PATH` | `/auth` | Auth prefix |
144
+ | `ADMIN_DB_PATH` | `.data/admin.db` | SQLite database file |
145
+ | `ADMIN_BACKUP` | `true` | Set to `false` to disable backups |
146
+ | `ADMIN_EMAIL` / `ADMIN_PASSWORD` | `admin@example.com` / `admin123` | Seed administrator |
147
+
148
+ ## API
149
+
150
+ | Method | Route | Description |
151
+ | --- | --- | --- |
152
+ | `GET` / `POST` | `/api/:collection` | List / create |
153
+ | `GET` / `PATCH` / `PUT` / `DELETE` | `/api/:collection/:id` | Read / update / delete (`PUT` is a partial update) |
154
+ | `GET` | `/api/:collection/relations` | Relation picker options (auth) |
155
+ | `POST` | `/auth/login` / `/auth/logout` / `/auth/refresh` | Session management |
156
+ | `GET` | `/auth/me` | Current user |
157
+ | `GET` / `POST` | `/auth/users` | List / create users (auth) |
158
+ | `GET` / `PATCH` / `PUT` / `DELETE` | `/auth/users/:id` | Manage users (auth) |
159
+ | `POST` / `DELETE` | `/media` | Media upload and deletion (auth) |
160
+ | `GET` | `/files/*` | Served uploads |
161
+ | `GET` / `POST` / `PUT` / `DELETE` | `/backup` | Backup management (auth) |
162
+
163
+ Errors return `{ "message": "...", "errors": { ... } }`.
164
+
165
+ ## Storage and backups
166
+
167
+ - Database: `.data/admin.db` (SQLite, WAL mode).
168
+ - Uploads: `public/files/`.
169
+ - Backups: gzip JSON archives in `.data/backups/`, scheduled every 24 hours by
170
+ default (10 kept).
171
+
172
+ All of these are created automatically and should stay out of version control.
173
+
174
+ ## Localization
175
+
176
+ Locales are declared in `src/schemas/locales.ts` and in `serenojs.config.ts`.
177
+ Localized fields are stored as one column per locale (`title_pt`, `title_en`)
178
+ and exposed by the API as nested objects:
179
+
180
+ ```json
181
+ { "title": { "pt": "Comprar pão", "en": "Buy bread" } }
182
+ ```
183
+
184
+ The admin UI language (English/Portuguese) is independent from content
185
+ localization and can be switched in the sidebar.
186
+
187
+ ## Learn more
188
+
189
+ - SerenoJS package documentation: <https://github.com/eutobias/serenojs>
190
+ - Waku documentation: <https://waku.gg>
@@ -0,0 +1,11 @@
1
+ node_modules
2
+ dist
3
+ .env*
4
+ .data
5
+ public/files
6
+ *.tsbuildinfo
7
+ .cache
8
+ .DS_Store
9
+ *.pem
10
+
11
+ packages/serenojs/admin-dist
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "serenojs-starter",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "engines": {
7
+ "node": ">=22.15",
8
+ "bun": ">=1.4.3"
9
+ },
10
+ "scripts": {
11
+ "dev": "waku dev",
12
+ "build": "waku build",
13
+ "start": "waku start",
14
+ "typegen": "waku router typegen"
15
+ },
16
+ "dependencies": {
17
+ "@eutobias/serenojs": "^0.1.2",
18
+ "hono": "^4.12.14",
19
+ "react": "~19.3.0",
20
+ "react-dom": "~19.3.0",
21
+ "react-server-dom-webpack": "~19.3.0",
22
+ "waku": "1.0.0-rc.1"
23
+ },
24
+ "devDependencies": {
25
+ "@rolldown/plugin-babel": "^0.2.3",
26
+ "@types/react": "^19.3.0",
27
+ "@types/react-dom": "^19.3.0",
28
+ "@vitejs/plugin-react": "^6.0.1",
29
+ "babel-plugin-react-compiler": "^1.0.0",
30
+ "typescript": "^6.0.3",
31
+ "vite": "^8.0.0"
32
+ }
33
+ }
File without changes
@@ -0,0 +1,33 @@
1
+ import { defineCmsConfig } from "@eutobias/serenojs/config";
2
+
3
+ import { collections, schemaTitle } from "./src/schemas";
4
+ import { defaultLocale, locales } from "./src/schemas/locales";
5
+
6
+ /**
7
+ * Host-side configuration. The admin SPA, REST API and auth endpoints are
8
+ * mounted by `src/middleware/serenojs.ts` at the paths below.
9
+ */
10
+ export default defineCmsConfig({
11
+ title: schemaTitle,
12
+ collections,
13
+ locales,
14
+ defaultLocale,
15
+ admin: {
16
+ // Change this to hide the panel at a custom path (e.g. "/painel").
17
+ path: process.env.ADMIN_PATH ?? "/admin",
18
+ enabled: process.env.ADMIN_ENABLED !== "false",
19
+ noindex: true,
20
+ },
21
+ api: { path: process.env.ADMIN_API_PATH ?? "/api" },
22
+ auth: { path: process.env.ADMIN_AUTH_PATH ?? "/auth" },
23
+ media: { path: "/media" },
24
+ files: { path: "/files" },
25
+ backup: {
26
+ path: "/backup",
27
+ enabled: process.env.ADMIN_BACKUP !== "false",
28
+ intervalHours: Number(process.env.ADMIN_BACKUP_INTERVAL_HOURS ?? "24"),
29
+ keep: Number(process.env.ADMIN_BACKUP_KEEP ?? "10"),
30
+ },
31
+ schemas: { path: "src/schemas" },
32
+ db: { path: process.env.ADMIN_DB_PATH ?? ".data/admin.db" },
33
+ });
@@ -0,0 +1 @@
1
+ declare module '*.css';
@@ -0,0 +1,14 @@
1
+ import { trimTrailingSlash } from 'hono/trailing-slash';
2
+
3
+ export default () => trimTrailingSlash({ alwaysRedirect: true });
4
+
5
+ // Usage of appendTrailingSlash
6
+ /*
7
+ import { appendTrailingSlash } from 'hono/trailing-slash';
8
+
9
+ export default () =>
10
+ appendTrailingSlash({
11
+ alwaysRedirect: true,
12
+ skip: (path) => /\.\w+$/.test(path),
13
+ });
14
+ */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Single entry point for the packaged CMS. Everything (admin SPA, REST API,
3
+ * auth, media, uploads and backups) is mounted by the package at the paths
4
+ * declared in `serenojs.config.ts`.
5
+ */
6
+ import config from "../../serenojs.config";
7
+ import { createCmsMiddleware } from "@eutobias/serenojs/server";
8
+
9
+ export default createCmsMiddleware(config);
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ import "../styles.css";
4
+
5
+ type RootLayoutProps = { children: ReactNode };
6
+
7
+ export default async function RootLayout({ children }: RootLayoutProps) {
8
+ return <>{children}</>;
9
+ }
10
+
11
+ export const getConfig = async () => {
12
+ return { render: "static" } as const;
13
+ };