deneljs 0.0.0-stage → 1.0.0

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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/drizzle/0000_lonely_reptil.sql +27 -0
  4. package/drizzle/0001_misty_wendigo.sql +74 -0
  5. package/drizzle/meta/0000_snapshot.json +179 -0
  6. package/drizzle/meta/0001_snapshot.json +492 -0
  7. package/drizzle/meta/_journal.json +20 -0
  8. package/package.json +55 -4
  9. package/src/admin/auth.ts +851 -0
  10. package/src/admin/layout.ts +419 -0
  11. package/src/admin/pages/categories.ts +223 -0
  12. package/src/admin/pages/dashboard.ts +192 -0
  13. package/src/admin/pages/media.ts +270 -0
  14. package/src/admin/pages/posts.ts +804 -0
  15. package/src/admin/pages/settings.ts +169 -0
  16. package/src/admin/pages/themes.ts +461 -0
  17. package/src/admin/pages/users.ts +501 -0
  18. package/src/admin/routes.ts +455 -0
  19. package/src/admin/tiptap-bundle.ts +48 -0
  20. package/src/admin/tiptap-entry.ts +226 -0
  21. package/src/ai/generator.ts +296 -0
  22. package/src/ai/index.ts +22 -0
  23. package/src/ai/schema.ts +13 -0
  24. package/src/ai/spec.ts +193 -0
  25. package/src/cli.ts +151 -0
  26. package/src/db/index.ts +278 -0
  27. package/src/db/schema.ts +115 -0
  28. package/src/engine/index.ts +52 -0
  29. package/src/engine/renderer.ts +533 -0
  30. package/src/engine/sandbox.ts +108 -0
  31. package/src/engine/schema.ts +71 -0
  32. package/src/engine/validator.ts +404 -0
  33. package/src/routes/admin-api.ts +1035 -0
  34. package/src/routes/posts.ts +294 -0
  35. package/src/routes/uploads.ts +119 -0
  36. package/src/server.ts +672 -0
  37. package/src/utils/sanitize-html.ts +145 -0
  38. package/themes/.gitkeep +1 -0
  39. package/themes/default/assets/style.css +799 -0
  40. package/themes/default/layouts/base.liquid +31 -0
  41. package/themes/default/layouts/home.liquid +180 -0
  42. package/themes/default/layouts/page.liquid +21 -0
  43. package/themes/default/layouts/post.liquid +55 -0
  44. package/themes/default/partials/footer.liquid +33 -0
  45. package/themes/default/partials/navbar.liquid +49 -0
  46. package/themes/default/theme.json +59 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 deneljs contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,58 @@
1
- # Temporary Holding Version
1
+ # deneljs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A fast CMS built with **Bun**, **ElysiaJS**, **Drizzle ORM (`bun:sqlite`)**, **sandboxed LiquidJS themes**, **Tiptap rich-text editing**, and **AI theme generation**.
4
+
5
+ ## Requirements
6
+
7
+ - [Bun](https://bun.sh) `>= 1.2.0` (uses `bun:sqlite`, `Bun.password`, `Bun.build`, and `HTMLRewriter`).
8
+
9
+ ## Quick Start (CLI)
10
+
11
+ Run directly in any empty project folder:
12
+
13
+ ```bash
14
+ bunx deneljs --port 3000
15
+ ```
16
+
17
+ Or install globally:
18
+
19
+ ```bash
20
+ bun add -g deneljs
21
+ deneljs --port 3000 --data-dir ./my-site
22
+ ```
23
+
24
+ On first launch, the CLI initializes:
25
+
26
+ - `data/app.db` (SQLite + Drizzle migrations)
27
+ - `themes/default/` (starter LiquidJS theme)
28
+ - `public/uploads/` (media uploads directory)
29
+
30
+ Visit `http://localhost:3000/admin/setup` to create the initial admin account.
31
+
32
+ ## CLI Options & Environment Variables
33
+
34
+ | Option | Env Variable | Default | Description |
35
+ | --- | --- | --- | --- |
36
+ | `-p, --port <port>` | `PORT` | `3000` | HTTP port to bind |
37
+ | `-d, --data-dir <path>` | — | `process.cwd()` | Base directory for SQLite, themes, and uploads |
38
+ | — | `DATABASE_URL` | `<data-dir>/data/app.db` | SQLite path or `:memory:` |
39
+ | — | `THEMES_DIR` | `<data-dir>/themes` | Themes storage directory |
40
+ | — | `UPLOADS_DIR` | `<data-dir>/public/uploads` | Media uploads directory |
41
+ | — | `SESSION_SECRET` | — | Signing secret for session cookies |
42
+ | — | `AI_API_KEY` | — | API key for `/api/ai/generate-theme` |
43
+
44
+ ## Local Development
45
+
46
+ ```bash
47
+ bun install
48
+ bun run dev
49
+ bun run typecheck
50
+ ```
51
+
52
+ ## Publishing to npm
53
+
54
+ ```bash
55
+ bun pm pack --dry-run
56
+ npm login
57
+ npm publish --access public
58
+ ```
@@ -0,0 +1,27 @@
1
+ CREATE TABLE `posts` (
2
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3
+ `slug` text NOT NULL,
4
+ `title` text NOT NULL,
5
+ `content` text NOT NULL,
6
+ `status` text DEFAULT 'draft' NOT NULL,
7
+ `created_at` integer NOT NULL
8
+ );
9
+ --> statement-breakpoint
10
+ CREATE UNIQUE INDEX `posts_slug_unique` ON `posts` (`slug`);--> statement-breakpoint
11
+ CREATE TABLE `settings` (
12
+ `key` text PRIMARY KEY NOT NULL,
13
+ `value` text NOT NULL
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE TABLE `themes` (
17
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
18
+ `slug` text NOT NULL,
19
+ `name` text NOT NULL,
20
+ `version` text NOT NULL,
21
+ `author` text NOT NULL,
22
+ `config_json` text DEFAULT '{}' NOT NULL,
23
+ `custom_settings_json` text DEFAULT '{}' NOT NULL,
24
+ `created_at` integer NOT NULL
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE UNIQUE INDEX `themes_slug_unique` ON `themes` (`slug`);
@@ -0,0 +1,74 @@
1
+ CREATE TABLE `categories` (
2
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
3
+ `name` text NOT NULL,
4
+ `slug` text NOT NULL,
5
+ `description` text DEFAULT '' NOT NULL,
6
+ `created_at` integer DEFAULT 0 NOT NULL
7
+ );
8
+ --> statement-breakpoint
9
+ CREATE UNIQUE INDEX `categories_slug_unique` ON `categories` (`slug`);--> statement-breakpoint
10
+ CREATE TABLE `media` (
11
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
12
+ `filename` text NOT NULL,
13
+ `original_name` text NOT NULL,
14
+ `mime_type` text NOT NULL,
15
+ `size_bytes` integer NOT NULL,
16
+ `url` text NOT NULL,
17
+ `alt_text` text DEFAULT '' NOT NULL,
18
+ `uploaded_by` integer,
19
+ `created_at` integer DEFAULT 0 NOT NULL,
20
+ FOREIGN KEY (`uploaded_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
21
+ );
22
+ --> statement-breakpoint
23
+ CREATE UNIQUE INDEX `media_filename_unique` ON `media` (`filename`);--> statement-breakpoint
24
+ CREATE TABLE `users` (
25
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
26
+ `name` text NOT NULL,
27
+ `email` text NOT NULL,
28
+ `password_hash` text NOT NULL,
29
+ `role` text DEFAULT 'author' NOT NULL,
30
+ `avatar_url` text DEFAULT '' NOT NULL,
31
+ `status` text DEFAULT 'active' NOT NULL,
32
+ `created_at` integer DEFAULT 0 NOT NULL
33
+ );
34
+ --> statement-breakpoint
35
+ CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
36
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
37
+ CREATE TABLE `__new_posts` (
38
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
39
+ `slug` text NOT NULL,
40
+ `title` text NOT NULL,
41
+ `content` text NOT NULL,
42
+ `excerpt` text DEFAULT '' NOT NULL,
43
+ `featured_image` text DEFAULT '' NOT NULL,
44
+ `category_id` integer,
45
+ `author_id` integer,
46
+ `meta_title` text DEFAULT '' NOT NULL,
47
+ `meta_description` text DEFAULT '' NOT NULL,
48
+ `status` text DEFAULT 'draft' NOT NULL,
49
+ `created_at` integer DEFAULT 0 NOT NULL,
50
+ `updated_at` integer DEFAULT 0 NOT NULL,
51
+ FOREIGN KEY (`category_id`) REFERENCES `categories`(`id`) ON UPDATE no action ON DELETE set null,
52
+ FOREIGN KEY (`author_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
53
+ );
54
+ --> statement-breakpoint
55
+ INSERT INTO `__new_posts`("id", "slug", "title", "content", "excerpt", "featured_image", "category_id", "author_id", "meta_title", "meta_description", "status", "created_at", "updated_at") SELECT "id", "slug", "title", "content", '', '', NULL, NULL, '', '', "status", "created_at", "created_at" FROM `posts`;--> statement-breakpoint
56
+ DROP TABLE `posts`;--> statement-breakpoint
57
+ ALTER TABLE `__new_posts` RENAME TO `posts`;--> statement-breakpoint
58
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
59
+ CREATE UNIQUE INDEX `posts_slug_unique` ON `posts` (`slug`);--> statement-breakpoint
60
+ CREATE TABLE `__new_themes` (
61
+ `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
62
+ `slug` text NOT NULL,
63
+ `name` text NOT NULL,
64
+ `version` text NOT NULL,
65
+ `author` text NOT NULL,
66
+ `config_json` text DEFAULT '{}' NOT NULL,
67
+ `custom_settings_json` text DEFAULT '{}' NOT NULL,
68
+ `created_at` integer DEFAULT 0 NOT NULL
69
+ );
70
+ --> statement-breakpoint
71
+ INSERT INTO `__new_themes`("id", "slug", "name", "version", "author", "config_json", "custom_settings_json", "created_at") SELECT "id", "slug", "name", "version", "author", "config_json", "custom_settings_json", "created_at" FROM `themes`;--> statement-breakpoint
72
+ DROP TABLE `themes`;--> statement-breakpoint
73
+ ALTER TABLE `__new_themes` RENAME TO `themes`;--> statement-breakpoint
74
+ CREATE UNIQUE INDEX `themes_slug_unique` ON `themes` (`slug`);
@@ -0,0 +1,179 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "4c4cc45f-c97b-4c18-a2cc-ca45abf1cc88",
5
+ "prevId": "00000000-0000-0000-0000-000000000000",
6
+ "tables": {
7
+ "posts": {
8
+ "name": "posts",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "integer",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": true
16
+ },
17
+ "slug": {
18
+ "name": "slug",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "title": {
25
+ "name": "title",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "content": {
32
+ "name": "content",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "status": {
39
+ "name": "status",
40
+ "type": "text",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false,
44
+ "default": "'draft'"
45
+ },
46
+ "created_at": {
47
+ "name": "created_at",
48
+ "type": "integer",
49
+ "primaryKey": false,
50
+ "notNull": true,
51
+ "autoincrement": false
52
+ }
53
+ },
54
+ "indexes": {
55
+ "posts_slug_unique": {
56
+ "name": "posts_slug_unique",
57
+ "columns": [
58
+ "slug"
59
+ ],
60
+ "isUnique": true
61
+ }
62
+ },
63
+ "foreignKeys": {},
64
+ "compositePrimaryKeys": {},
65
+ "uniqueConstraints": {},
66
+ "checkConstraints": {}
67
+ },
68
+ "settings": {
69
+ "name": "settings",
70
+ "columns": {
71
+ "key": {
72
+ "name": "key",
73
+ "type": "text",
74
+ "primaryKey": true,
75
+ "notNull": true,
76
+ "autoincrement": false
77
+ },
78
+ "value": {
79
+ "name": "value",
80
+ "type": "text",
81
+ "primaryKey": false,
82
+ "notNull": true,
83
+ "autoincrement": false
84
+ }
85
+ },
86
+ "indexes": {},
87
+ "foreignKeys": {},
88
+ "compositePrimaryKeys": {},
89
+ "uniqueConstraints": {},
90
+ "checkConstraints": {}
91
+ },
92
+ "themes": {
93
+ "name": "themes",
94
+ "columns": {
95
+ "id": {
96
+ "name": "id",
97
+ "type": "integer",
98
+ "primaryKey": true,
99
+ "notNull": true,
100
+ "autoincrement": true
101
+ },
102
+ "slug": {
103
+ "name": "slug",
104
+ "type": "text",
105
+ "primaryKey": false,
106
+ "notNull": true,
107
+ "autoincrement": false
108
+ },
109
+ "name": {
110
+ "name": "name",
111
+ "type": "text",
112
+ "primaryKey": false,
113
+ "notNull": true,
114
+ "autoincrement": false
115
+ },
116
+ "version": {
117
+ "name": "version",
118
+ "type": "text",
119
+ "primaryKey": false,
120
+ "notNull": true,
121
+ "autoincrement": false
122
+ },
123
+ "author": {
124
+ "name": "author",
125
+ "type": "text",
126
+ "primaryKey": false,
127
+ "notNull": true,
128
+ "autoincrement": false
129
+ },
130
+ "config_json": {
131
+ "name": "config_json",
132
+ "type": "text",
133
+ "primaryKey": false,
134
+ "notNull": true,
135
+ "autoincrement": false,
136
+ "default": "'{}'"
137
+ },
138
+ "custom_settings_json": {
139
+ "name": "custom_settings_json",
140
+ "type": "text",
141
+ "primaryKey": false,
142
+ "notNull": true,
143
+ "autoincrement": false,
144
+ "default": "'{}'"
145
+ },
146
+ "created_at": {
147
+ "name": "created_at",
148
+ "type": "integer",
149
+ "primaryKey": false,
150
+ "notNull": true,
151
+ "autoincrement": false
152
+ }
153
+ },
154
+ "indexes": {
155
+ "themes_slug_unique": {
156
+ "name": "themes_slug_unique",
157
+ "columns": [
158
+ "slug"
159
+ ],
160
+ "isUnique": true
161
+ }
162
+ },
163
+ "foreignKeys": {},
164
+ "compositePrimaryKeys": {},
165
+ "uniqueConstraints": {},
166
+ "checkConstraints": {}
167
+ }
168
+ },
169
+ "views": {},
170
+ "enums": {},
171
+ "_meta": {
172
+ "schemas": {},
173
+ "tables": {},
174
+ "columns": {}
175
+ },
176
+ "internal": {
177
+ "indexes": {}
178
+ }
179
+ }