@cellajs/create-cella 0.2.1 → 0.2.3
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/LICENSE +21 -0
- package/configs/default-config.ts.template +79 -81
- package/dist/index.js +303 -133
- package/dist/index.js.map +1 -1
- package/package.json +22 -22
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 CellaJS
|
|
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.
|
|
@@ -9,33 +9,34 @@
|
|
|
9
9
|
* NOTE: This file is NOT compiled or imported — it is copied and interpolated
|
|
10
10
|
* as plain text. The import path below is relative to `shared/config/` (its destination).
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { ConfigMode, RequiredConfig, S3ConfigInput } from '../src/config-builder/types';
|
|
13
13
|
|
|
14
14
|
// Re-export for external consumers
|
|
15
15
|
export { roles, hierarchy } from './hierarchy-config';
|
|
16
16
|
|
|
17
|
+
// Set these early for reuse
|
|
18
|
+
const entityTypes = ['user', 'organization', 'attachment', 'page'] as const;
|
|
19
|
+
const productEntityTypes = ['attachment', 'page'] as const;
|
|
20
|
+
|
|
17
21
|
export const config = {
|
|
18
22
|
|
|
19
23
|
/******************************************************************************
|
|
20
24
|
* ENTITY DATA MODEL
|
|
21
25
|
******************************************************************************/
|
|
22
26
|
|
|
23
|
-
/** All entity types in the app - must match hierarchy.allTypes.
|
|
24
|
-
entityTypes
|
|
27
|
+
/** All entity types in the app - must match hierarchy.allTypes. */
|
|
28
|
+
entityTypes,
|
|
25
29
|
|
|
26
|
-
/** Context entities with memberships - must match hierarchy.contextTypes.
|
|
30
|
+
/** Context entities with memberships - must match hierarchy.contextTypes. */
|
|
27
31
|
contextEntityTypes: ['organization'] as const,
|
|
28
|
-
|
|
29
|
-
/** Product/content entities - must match hierarchy.productTypes.
|
|
30
|
-
productEntityTypes
|
|
32
|
+
|
|
33
|
+
/** Product/content entities - must match hierarchy.productTypes. */
|
|
34
|
+
productEntityTypes,
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
37
|
+
* Product entity types tracked for seen/unseen counts.
|
|
38
|
+
* Unseen counts are grouped by the parent context entity of each tracked type.
|
|
35
39
|
*/
|
|
36
|
-
parentlessProductEntityTypes: ['page'] as const,
|
|
37
|
-
|
|
38
|
-
/** Product entity types tracked for seen/unseen counts. Must be org-scoped (not parentless). */
|
|
39
40
|
seenTrackedEntityTypes: ['attachment'] as const,
|
|
40
41
|
|
|
41
42
|
/** Maps entity types to their ID column names - must match entityTypes */
|
|
@@ -52,12 +53,22 @@ export const config = {
|
|
|
52
53
|
/** Resource types that are not entities but have activities logged */
|
|
53
54
|
resourceTypes: ['request', 'membership', 'inactive_membership', 'tenant'] as const,
|
|
54
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Entity embeddings: declares which entities are embedded as ID arrays inside
|
|
58
|
+
* other entities. Forks extend when adding new embedding relationships.
|
|
59
|
+
*/
|
|
60
|
+
entityEmbeddings: [] as readonly {
|
|
61
|
+
readonly embeddedEntity: (typeof productEntityTypes)[number];
|
|
62
|
+
readonly hostEntity: (typeof productEntityTypes)[number];
|
|
63
|
+
readonly hostColumn: string;
|
|
64
|
+
}[],
|
|
65
|
+
|
|
55
66
|
/**
|
|
56
67
|
* User menu structure of context entities with optional nested subentities.
|
|
57
68
|
* If subentityType is set, the table must include `${entity}Id` foreign key.
|
|
58
69
|
*/
|
|
59
70
|
menuStructure: [
|
|
60
|
-
{ entityType: 'organization',subentityType: null} as const,
|
|
71
|
+
{ entityType: 'organization', subentityType: null } as const,
|
|
61
72
|
],
|
|
62
73
|
|
|
63
74
|
/** Default restrictions for tenants (entity quotas and rate limits) */
|
|
@@ -72,17 +83,10 @@ export const config = {
|
|
|
72
83
|
},
|
|
73
84
|
} as const,
|
|
74
85
|
|
|
75
|
-
/** Public tenant for platform-wide content (pages, docs, etc.) */
|
|
76
|
-
publicTenant: { id: 'public', name: 'Public' },
|
|
77
|
-
|
|
78
86
|
/******************************************************************************
|
|
79
87
|
* SYSTEM ROLES
|
|
80
88
|
******************************************************************************/
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* System-wide roles stored in DB.
|
|
84
|
-
* Must include 'admin' for system administration access.
|
|
85
|
-
*/
|
|
89
|
+
|
|
86
90
|
systemRoles: ['admin'] as const,
|
|
87
91
|
|
|
88
92
|
/******************************************************************************
|
|
@@ -99,7 +103,7 @@ export const config = {
|
|
|
99
103
|
description: '__project_name__ — powered by Cella.',
|
|
100
104
|
/** SEO keywords for search engines */
|
|
101
105
|
keywords:
|
|
102
|
-
'starter kit, fullstack, monorepo, typescript, hono, honojs, drizzle,
|
|
106
|
+
'starter kit, fullstack, monorepo, typescript, hono, honojs, drizzle, baseui, react, postgres, pwa, offline, instant updates, realtime data, sync engine',
|
|
103
107
|
|
|
104
108
|
/******************************************************************************
|
|
105
109
|
* URLS & ENDPOINTS
|
|
@@ -111,9 +115,29 @@ export const config = {
|
|
|
111
115
|
backendUrl: 'https://api.__project_slug__.example.com',
|
|
112
116
|
/** OAuth callback base URL */
|
|
113
117
|
backendAuthUrl: 'https://api.__project_slug__.example.com/auth',
|
|
118
|
+
/** Yjs realtime relay URL */
|
|
119
|
+
yjsUrl: 'wss://yjs.__project_slug__.example.com',
|
|
120
|
+
/** AI service base URL */
|
|
121
|
+
aiUrl: 'https://ai.__project_slug__.example.com',
|
|
122
|
+
/**
|
|
123
|
+
* Per-service toggles and public URLs. `enabled` controls whether the service
|
|
124
|
+
* is wired up; `publicUrl` is the externally reachable endpoint.
|
|
125
|
+
*/
|
|
126
|
+
services: {
|
|
127
|
+
frontend: { enabled: true as boolean, publicUrl: 'https://__project_slug__.example.com' },
|
|
128
|
+
backend: { enabled: true as boolean, publicUrl: 'https://api.__project_slug__.example.com' },
|
|
129
|
+
cdc: { enabled: true as boolean },
|
|
130
|
+
yjs: { enabled: false as boolean, publicUrl: 'wss://yjs.__project_slug__.example.com' },
|
|
131
|
+
ai: { enabled: false as boolean, publicUrl: 'https://ai.__project_slug__.example.com' },
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
// Cost escape hatch: when true the backend (MODE=api) also boots every enabled
|
|
135
|
+
// service in-process — one VM for previews/small forks. Default false keeps the
|
|
136
|
+
// split (one service per process). cdc co-hosting forfeits API blue-green.
|
|
137
|
+
singleVM: false as boolean,
|
|
114
138
|
|
|
115
139
|
/** About page URL */
|
|
116
|
-
aboutUrl: '
|
|
140
|
+
aboutUrl: '/about',
|
|
117
141
|
/** Status page URL for uptime monitoring */
|
|
118
142
|
statusUrl: 'https://status.__project_slug__.example.com',
|
|
119
143
|
/** Canonical production URL */
|
|
@@ -128,27 +152,25 @@ export const config = {
|
|
|
128
152
|
* EMAIL
|
|
129
153
|
******************************************************************************/
|
|
130
154
|
|
|
131
|
-
/** Email address for user support inquiries */
|
|
132
|
-
supportEmail: 'support@__project_slug__.example.com',
|
|
133
|
-
|
|
134
155
|
/** From address for system notifications */
|
|
135
156
|
senderEmail: 'notifications@__project_slug__.example.com',
|
|
136
|
-
|
|
137
|
-
|
|
157
|
+
/** Email address for user support inquiries */
|
|
158
|
+
supportEmail: 'support@__project_slug__.example.com',
|
|
159
|
+
/** Receive security warnings */
|
|
138
160
|
securityEmail: 'security@__project_slug__.example.com',
|
|
139
161
|
|
|
140
162
|
/******************************************************************************
|
|
141
163
|
* MODE & FLAGS
|
|
142
164
|
******************************************************************************/
|
|
143
|
-
|
|
165
|
+
|
|
144
166
|
/** Runtime mode - overridden per environment file */
|
|
145
167
|
mode: 'development' as ConfigMode,
|
|
146
|
-
/** Enable debug logging and dev tools */
|
|
147
|
-
debug: false,
|
|
148
168
|
/** Enable maintenance mode (blocks all requests) */
|
|
149
169
|
maintenance: false,
|
|
150
170
|
/** Cookie version - increment when changing cookie structure to invalidate old cookies */
|
|
151
171
|
cookieVersion: 'v1',
|
|
172
|
+
/** Persisted client query-cache shape - bump on a breaking change to a cached entity so clients wipe stale cache. See info/SCHEMA_EVOLUTION.md */
|
|
173
|
+
clientCacheVersion: 'v1',
|
|
152
174
|
|
|
153
175
|
/******************************************************************************
|
|
154
176
|
* FEATURE FLAGS
|
|
@@ -160,13 +182,15 @@ export const config = {
|
|
|
160
182
|
*/
|
|
161
183
|
has: {
|
|
162
184
|
/** Progressive Web App support for preloading static assets and offline support */
|
|
163
|
-
pwa: true,
|
|
185
|
+
pwa: true as boolean,
|
|
164
186
|
/** Allow users to sign up. If false, the app is by invitation only */
|
|
165
|
-
|
|
187
|
+
selfRegistration: false as boolean,
|
|
166
188
|
/** Suggest a waitlist for unknown emails when sign up is disabled */
|
|
167
|
-
waitlist:
|
|
189
|
+
waitlist: false as boolean,
|
|
168
190
|
/** S3 fully configured - if false, files will be stored in local browser (IndexedDB) */
|
|
169
|
-
uploadEnabled: false,
|
|
191
|
+
uploadEnabled: false as boolean,
|
|
192
|
+
/** Customer support chat widget (Gleap). Unrelated to the AI module. */
|
|
193
|
+
chatSupport: false as boolean,
|
|
170
194
|
},
|
|
171
195
|
|
|
172
196
|
/******************************************************************************
|
|
@@ -177,13 +201,13 @@ export const config = {
|
|
|
177
201
|
* Enabled authentication strategies.
|
|
178
202
|
* TOTP can only be used as MFA fallback with passkey as primary.
|
|
179
203
|
*/
|
|
180
|
-
enabledAuthStrategies: ['
|
|
204
|
+
enabledAuthStrategies: ['passkey', 'oauth', 'totp', 'magic'] as const,
|
|
181
205
|
|
|
182
206
|
/** Enabled OAuth providers - currently supports: github, google, microsoft */
|
|
183
|
-
enabledOAuthProviders: []
|
|
207
|
+
enabledOAuthProviders: ['github'] as const,
|
|
184
208
|
|
|
185
209
|
/** Token types used for verification flows */
|
|
186
|
-
tokenTypes: ['email-verification', 'oauth-verification', '
|
|
210
|
+
tokenTypes: ['email-verification', 'oauth-verification', 'invitation', 'confirm-mfa', 'magic'] as const,
|
|
187
211
|
|
|
188
212
|
/** TOTP configuration for MFA */
|
|
189
213
|
totpConfig: {
|
|
@@ -199,12 +223,8 @@ export const config = {
|
|
|
199
223
|
/** API version prefix for endpoints */
|
|
200
224
|
apiVersion: 'v1',
|
|
201
225
|
/** API documentation description shown in Scalar */
|
|
202
|
-
apiDescription: `⚠️ ATTENTION: PRERELEASE!
|
|
203
|
-
This API is organized into modules based on logical domains
|
|
204
|
-
Each module includes a set of endpoints that expose functionality related to a specific resource or cross resource logic.
|
|
205
|
-
|
|
206
|
-
The documentation is generated from source code using \`zod\` schemas, converted into OpenAPI via \`zod-openapi\` and served through the \`hono\` framework.`,
|
|
207
|
-
|
|
226
|
+
apiDescription: `⚠️ ATTENTION: PRERELEASE!
|
|
227
|
+
This API is organized into modules based on logical domains.`,
|
|
208
228
|
|
|
209
229
|
/******************************************************************************
|
|
210
230
|
* REQUEST LIMITS
|
|
@@ -221,7 +241,7 @@ export const config = {
|
|
|
221
241
|
organizations: 40,
|
|
222
242
|
requests: 40,
|
|
223
243
|
attachments: 40,
|
|
224
|
-
pages:
|
|
244
|
+
pages: 100,
|
|
225
245
|
pendingMemberships: 20,
|
|
226
246
|
},
|
|
227
247
|
|
|
@@ -236,23 +256,11 @@ export const config = {
|
|
|
236
256
|
* STORAGE & UPLOADS (S3)
|
|
237
257
|
******************************************************************************/
|
|
238
258
|
|
|
239
|
-
/** S3-compatible storage configuration */
|
|
259
|
+
/** S3-compatible storage configuration. Only region and host are required; the rest is derived from the slug. */
|
|
240
260
|
s3: {
|
|
241
|
-
/** Prefix to namespace files when sharing a bucket across apps or envs */
|
|
242
|
-
bucketPrefix: '__project_slug__',
|
|
243
|
-
/** Public bucket name for publicly accessible files */
|
|
244
|
-
publicBucket: '',
|
|
245
|
-
/** Private bucket name for authenticated-only files */
|
|
246
|
-
privateBucket: '',
|
|
247
|
-
/** S3 region identifier */
|
|
248
261
|
region: '',
|
|
249
|
-
/** S3 host endpoint */
|
|
250
262
|
host: '',
|
|
251
|
-
|
|
252
|
-
privateCDNUrl: '',
|
|
253
|
-
/** CDN URL for public bucket */
|
|
254
|
-
publicCDNUrl: '',
|
|
255
|
-
} satisfies S3Config,
|
|
263
|
+
} as S3ConfigInput,
|
|
256
264
|
|
|
257
265
|
/** Upload template IDs for Transloadit processing pipelines */
|
|
258
266
|
uploadTemplateIds: ['avatar', 'cover', 'attachment'] as const,
|
|
@@ -275,36 +283,28 @@ export const config = {
|
|
|
275
283
|
* Controls which attachments are cached locally for offline access.
|
|
276
284
|
*/
|
|
277
285
|
localBlobStorage: {
|
|
278
|
-
enabled: true,
|
|
279
|
-
maxFileSize: 10 * 1024 * 1024,
|
|
280
|
-
maxTotalSize: 100 * 1024 * 1024,
|
|
281
|
-
allowedContentTypes: [] as string[],
|
|
282
|
-
excludedContentTypes: ['video/*'] as string[],
|
|
283
|
-
downloadConcurrency: 2,
|
|
284
|
-
uploadRetryAttempts: 3,
|
|
285
|
-
uploadRetryDelays: [60000, 300000, 900000] as const,
|
|
286
|
+
enabled: true,
|
|
287
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
288
|
+
maxTotalSize: 100 * 1024 * 1024,
|
|
289
|
+
allowedContentTypes: [] as string[],
|
|
290
|
+
excludedContentTypes: ['video/*'] as string[],
|
|
291
|
+
downloadConcurrency: 2,
|
|
292
|
+
uploadRetryAttempts: 3,
|
|
293
|
+
uploadRetryDelays: [60000, 300000, 900000] as const,
|
|
286
294
|
},
|
|
287
295
|
|
|
288
296
|
/******************************************************************************
|
|
289
297
|
* THIRD-PARTY SERVICES
|
|
290
298
|
******************************************************************************/
|
|
291
299
|
|
|
292
|
-
/** Paddle client token for payments */
|
|
293
|
-
paddleToken: '',
|
|
294
|
-
/** Paddle price IDs for subscription products */
|
|
295
|
-
paddlePriceIds: {
|
|
296
|
-
donate: '',
|
|
297
|
-
},
|
|
298
|
-
/** Sentry DSN for error tracking */
|
|
299
|
-
sentryDsn: '',
|
|
300
|
-
/** Upload source maps to Sentry on build */
|
|
301
|
-
sentSentrySourceMaps: false,
|
|
302
300
|
/** Gleap token for customer support widget */
|
|
303
301
|
gleapToken: '',
|
|
304
302
|
/** Google Maps API key */
|
|
305
303
|
googleMapsKey: '',
|
|
306
304
|
/** Matrix homeserver URL for chat integration */
|
|
307
305
|
matrixURL: 'https://matrix-client.matrix.org',
|
|
306
|
+
/** Maple.dev public ingest key, safe to embed in the frontend bundle (empty disables frontend export) */
|
|
307
|
+
maplePublicIngestKey: '',
|
|
308
308
|
|
|
309
309
|
/******************************************************************************
|
|
310
310
|
* THEMING & UI
|
|
@@ -320,9 +320,7 @@ export const config = {
|
|
|
320
320
|
sidebarWidthCollapsed: '4rem',
|
|
321
321
|
sheetPanelWidth: '20rem',
|
|
322
322
|
},
|
|
323
|
-
colors: {
|
|
324
|
-
rose: '#e11d48',
|
|
325
|
-
},
|
|
323
|
+
colors: {},
|
|
326
324
|
strokeWidth: 1.5,
|
|
327
325
|
screenSizes: {
|
|
328
326
|
xs: '420px',
|
|
@@ -380,7 +378,7 @@ export const config = {
|
|
|
380
378
|
bankAccount: '',
|
|
381
379
|
googleMapsUrl: '',
|
|
382
380
|
scheduleCallUrl: '',
|
|
383
|
-
|
|
381
|
+
socialUrl: '',
|
|
384
382
|
blueskyHandle: '',
|
|
385
383
|
element: '',
|
|
386
384
|
githubUrl: '',
|