create-start-serenojs 0.1.0 → 0.1.4

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 CHANGED
@@ -65,16 +65,16 @@ my-app/
65
65
  .agents/
66
66
  skills/ # coding-agent skills (e.g. serenojs-schema)
67
67
  src/
68
- schemas/ # todos example collection + locales
68
+ schemas/ # field-showcase collection + locales
69
69
  middleware/ # mounts the SerenoJS Hono app
70
- pages/ # todos example app
70
+ pages/ # field-showcase app
71
71
  styles.css # example app styles
72
72
  public/
73
73
  README.md
74
74
  ```
75
75
 
76
76
  The generated `package.json` uses the published `@eutobias/serenojs` range;
77
- `workspace:` specs from the monorepo template are rewritten automatically.
77
+ legacy `workspace:` specs are still normalized when present.
78
78
 
79
79
  If a git repository is requested, the CLI runs `git init`, stages the files and
80
80
  attempts an initial commit. The commit is skipped silently when git user
@@ -87,9 +87,10 @@ single source of truth for the starter app — it is not copied from another
87
87
  directory. The same folder is a pnpm workspace package (`serenojs-starter`) so
88
88
  it can be developed and built in this repository.
89
89
 
90
- The starter includes a small example app (todos CRUD) that consumes the public
91
- REST API. You are free to use any component library or styling solution; the
92
- admin panel brings its own bundled styles and is not affected by the host app.
90
+ The starter includes a small example app that renders a collection with one
91
+ field of every type and consumes the public REST API. You are free to use any
92
+ component library or styling solution; the admin panel brings its own bundled
93
+ styles and is not affected by the host app.
93
94
 
94
95
  Template-only files:
95
96
 
@@ -127,4 +128,4 @@ automatically. The published tarball contains `dist/`, the template and this
127
128
  README.
128
129
 
129
130
  Publish `@eutobias/serenojs` first: the template depends on the published
130
- version (`^0.1.1` after the scaffold rewrite).
131
+ version (`^0.1.4` after the scaffold rewrite).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-start-serenojs",
3
- "version": "0.1.0",
3
+ "version": "0.1.4",
4
4
  "description": "Scaffold a SerenoJS starter (Waku + @eutobias/serenojs).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,14 +40,14 @@ forms, API handlers and validation from the descriptors.
40
40
  ```ts
41
41
  import type { CollectionDef } from "@eutobias/serenojs/config";
42
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)
43
+ export const showcase: CollectionDef = {
44
+ slug: "showcase", // URL + table name source (kebab-case)
45
+ label: "Showcase", // shown in admin UI
46
+ icon: "layout", // optional Feather icon name (see registry below)
47
47
  description: "...", // optional
48
48
  standalone: false, // true = single-record collection
49
49
  locales: ["pt", "en"], // omit to fall back to [defaultLocale]
50
- list: ["id", "title", "done"], // list-view columns; omit = all fields
50
+ list: ["id", "title", "published"], // list-view columns; omit = all fields
51
51
  access: { // per-operation API access (see below)
52
52
  read: "public",
53
53
  create: "private",
@@ -71,14 +71,14 @@ export const todos: CollectionDef = {
71
71
  - `label` is shown in the admin UI. Schema labels are **not** translated by the
72
72
  admin language selector (EN/PT) — write them in the language your editors
73
73
  use.
74
- - `type` must be one of the 11 field types — see `references/fields.md`.
74
+ - `type` must be one of the 13 field types — see `references/fields.md`.
75
75
  - `required` is enforced per locale for localized fields (no fallback).
76
76
 
77
77
  ## Localization (`localized`)
78
78
 
79
- - Defaults to `true` for `text`, `textarea`, `email`, `list`; `false` for the
80
- rest (`number`, `boolean`, `date`, `select`, `relation`, `media`,
81
- `media-list`).
79
+ - Defaults to `true` for `text`, `textarea`, `richtext`, `email`, `list`;
80
+ `false` for the rest (`number`, `boolean`, `date`, `select`, `relation`,
81
+ `media`, `media-list`).
82
82
  - Set `localized: false` to keep a text field language-independent (e.g. `slug`,
83
83
  `url`, `icon`).
84
84
  - Storage is one column per locale (`name_pt`, `name_en`); the API/form shape is
@@ -155,7 +155,7 @@ Never use emoji/unicode glyphs. Unknown names fall back to `grid`.
155
155
  - Assuming `write` exists as an access key — it was replaced by
156
156
  `create`/`update`/`delete`.
157
157
  - Setting a relation `to` slug that isn't registered.
158
- - Using a field type outside the 11 supported types.
158
+ - Using a field type outside the 13 supported types.
159
159
  - Hardcoding the API prefix (`/api`) in frontend code — paths come from the config.
160
160
  - Expecting schema labels to be translated by the admin UI language selector.
161
161
 
@@ -9,7 +9,7 @@ source: `src/core/types.ts`). Common props first, then per-type options.
9
9
  |---|---|---|
10
10
  | `name` | `string` | stable id, API key, column name |
11
11
  | `label` | `string` | admin label; not translated by the UI language selector |
12
- | `type` | `FieldType` | one of the 11 below |
12
+ | `type` | `FieldType` | one of the 13 below |
13
13
  | `required?` | `boolean` | per-locale for localized fields |
14
14
  | `placeholder?` | `string` | input placeholder |
15
15
  | `help?` | `string` | helper text under the field |
@@ -73,6 +73,15 @@ Date input, stored as a `TEXT` string (ISO `YYYY-MM-DD`). Not localized.
73
73
  { name: "dueDate", label: "Prazo", type: "date" }
74
74
  ```
75
75
 
76
+ ### richtext
77
+ Markdown stored as a plain string in a `TEXT` column. The admin renders a
78
+ textarea with the GitHub markdown toolbar and a sanitized live preview. The
79
+ stored value remains Markdown; the host decides how to render it. Localized by
80
+ default.
81
+ ```ts
82
+ { name: "body", label: "Corpo", type: "richtext" }
83
+ ```
84
+
76
85
  ### relation
77
86
  Reference to another collection. Requires `relation: { to, type }`. Not localized.
78
87
  - `type`: `"one-to-one"` | `"one-to-many"` | `"many-to-many"`.
@@ -110,12 +119,30 @@ array. Localized by default.
110
119
  { name: "highlights", label: "Destaques", type: "list" }
111
120
  ```
112
121
 
122
+ ### object-list
123
+ Ordered array of objects (JSON in a `TEXT` column). Each object is built from
124
+ the subfields in `fields`. Supported subfields: `text`, `email`, `textarea`,
125
+ `number`, `boolean`, `select`, `date` and `list`; relations, media and nested
126
+ `object-list` are rejected. Not localized by default (set `localized: true` for
127
+ one array per locale).
128
+ ```ts
129
+ {
130
+ name: "links",
131
+ label: "Links",
132
+ type: "object-list",
133
+ fields: [
134
+ { name: "label", label: "Rótulo", type: "text", required: true },
135
+ { name: "url", label: "URL", type: "text" },
136
+ ],
137
+ }
138
+ ```
139
+
113
140
  ## Localization defaults
114
141
 
115
142
  | default | types |
116
143
  |---|---|
117
- | localized | `text`, `textarea`, `email`, `list` |
118
- | not localized | `number`, `boolean`, `date`, `select`, `relation`, `media`, `media-list` |
144
+ | localized | `text`, `textarea`, `richtext`, `email`, `list` |
145
+ | not localized | `number`, `boolean`, `date`, `select`, `relation`, `media`, `media-list`, `object-list` |
119
146
 
120
147
  Override with `localized: true/false` on any field. Localized columns are
121
148
  `<name>_<locale>` and required is checked for every locale.
@@ -7,8 +7,9 @@ external services.
7
7
 
8
8
  The app ships:
9
9
 
10
- - a demo `todos` collection (`src/schemas/todos.ts`);
11
- - a small todos example app that consumes the public API
10
+ - a demo `showcase` collection with one field of every type
11
+ (`src/schemas/showcase.ts`);
12
+ - a field-showcase page that consumes the public API
12
13
  (`src/pages/index.tsx`);
13
14
  - the admin panel mounted at `/admin`;
14
15
  - content localization configured for `pt` (default) and `en`;
@@ -71,13 +72,13 @@ src/
71
72
  schemas/ # SOURCE OF TRUTH for content types
72
73
  index.ts # exports `collections`
73
74
  locales.ts # locale registry + defaultLocale
74
- todos.ts # example collection
75
+ showcase.ts # one field of every type
75
76
  middleware/
76
77
  serenojs.ts # mounts @eutobias/serenojs/server
77
78
  no-trailing-slash.ts
78
79
  pages/
79
80
  _layout.tsx # root layout (imports the stylesheet)
80
- index.tsx # todos example app
81
+ index.tsx # field showcase app
81
82
  styles.css # example app styles
82
83
  pages.gen.ts # generated by `pnpm typegen` - do not edit
83
84
  ```
@@ -87,11 +88,12 @@ requests before Waku's file-system router sees them.
87
88
 
88
89
  ### Example app
89
90
 
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.
91
+ The starter includes a small field-showcase app (`src/pages/index.tsx`) that
92
+ consumes the public REST API and renders every field type. It is intentionally
93
+ self-contained: keep it, rewrite it, or remove it. You are free to use any
94
+ component library and any styling solution you prefer. Nothing in the app is
95
+ tied to the admin panel, which ships its own bundled styles and is not
96
+ affected by the host app.
95
97
 
96
98
  ## Content modeling
97
99
 
@@ -103,8 +105,9 @@ To add a content type:
103
105
  3. Restart the dev server — SQLite is migrated lazily and the admin/API pick up
104
106
  the new collection automatically.
105
107
 
106
- Supported field types: `text`, `email`, `textarea`, `number`, `boolean`,
107
- `select`, `date`, `relation`, `media`, `media-list` and `list`.
108
+ Supported field types: `text`, `email`, `textarea`, `richtext`, `number`,
109
+ `boolean`, `select`, `date`, `relation`, `media`, `media-list`, `list` and
110
+ `object-list`.
108
111
 
109
112
  Collections are private by default for writes. `access` controls each API
110
113
  operation (`read`, `create`, `update`, `delete`); the demo opens everything up:
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "serenojs-starter",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "engines": {
@@ -14,7 +14,7 @@
14
14
  "typegen": "waku router typegen"
15
15
  },
16
16
  "dependencies": {
17
- "@eutobias/serenojs": "workspace:^0.1.1",
17
+ "@eutobias/serenojs": "workspace:^0.1.4",
18
18
  "hono": "^4.12.14",
19
19
  "react": "~19.3.0",
20
20
  "react-dom": "~19.3.0",
@@ -0,0 +1,28 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 630" role="img" aria-labelledby="title">
2
+ <title id="title">SerenoJS field showcase</title>
3
+ <defs>
4
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
5
+ <stop offset="0" stop-color="#04241b"/>
6
+ <stop offset="0.55" stop-color="#065f46"/>
7
+ <stop offset="1" stop-color="#0e7490"/>
8
+ </linearGradient>
9
+ <radialGradient id="glow" cx="0.2" cy="0.15" r="0.7">
10
+ <stop offset="0" stop-color="#34d399" stop-opacity="0.55"/>
11
+ <stop offset="1" stop-color="#34d399" stop-opacity="0"/>
12
+ </radialGradient>
13
+ </defs>
14
+ <rect width="1200" height="630" fill="url(#bg)"/>
15
+ <rect width="1200" height="630" fill="url(#glow)"/>
16
+ <g fill="none" stroke="#a7f3d0" stroke-opacity="0.35">
17
+ <circle cx="1020" cy="110" r="190"/>
18
+ <circle cx="1020" cy="110" r="260"/>
19
+ <circle cx="1020" cy="110" r="330"/>
20
+ </g>
21
+ <text x="96" y="285" fill="#ecfdf5" font-family="ui-sans-serif, system-ui, sans-serif" font-size="82" font-weight="700" letter-spacing="-3">SerenoJS</text>
22
+ <text x="100" y="352" fill="#a7f3d0" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="26" letter-spacing="4">FIELD SHOWCASE</text>
23
+ <g fill="#d1fae5" font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="20">
24
+ <text x="100" y="435">text · email · textarea · number · boolean</text>
25
+ <text x="100" y="470">select · date · relation · media · media-list</text>
26
+ <text x="100" y="505">list · object-list</text>
27
+ </g>
28
+ </svg>
@@ -1,6 +1,6 @@
1
1
  import { defineCmsConfig } from "@eutobias/serenojs/config";
2
2
 
3
- import { collections } from "./src/schemas";
3
+ import { collections, schemaTitle } from "./src/schemas";
4
4
  import { defaultLocale, locales } from "./src/schemas/locales";
5
5
 
6
6
  /**
@@ -8,7 +8,7 @@ import { defaultLocale, locales } from "./src/schemas/locales";
8
8
  * mounted by `src/middleware/serenojs.ts` at the paths below.
9
9
  */
10
10
  export default defineCmsConfig({
11
- title: "SerenoJS",
11
+ title: schemaTitle,
12
12
  collections,
13
13
  locales,
14
14
  defaultLocale,
@@ -28,5 +28,6 @@ export default defineCmsConfig({
28
28
  intervalHours: Number(process.env.ADMIN_BACKUP_INTERVAL_HOURS ?? "24"),
29
29
  keep: Number(process.env.ADMIN_BACKUP_KEEP ?? "10"),
30
30
  },
31
+ schemas: { path: "src/schemas" },
31
32
  db: { path: process.env.ADMIN_DB_PATH ?? ".data/admin.db" },
32
33
  });