@cellajs/create-cella 0.2.0 → 0.2.2
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/configs/default-config.ts.template +378 -0
- package/dist/index.js +816 -0
- package/dist/index.js.map +1 -0
- package/package.json +29 -21
- package/LICENSE +0 -21
- package/src/add-remote.ts +0 -40
- package/src/constants.ts +0 -106
- package/src/create-cella-cli.ts +0 -141
- package/src/create.ts +0 -114
- package/src/modules/cli/commands.ts +0 -58
- package/src/modules/cli/display.ts +0 -62
- package/src/modules/cli/index.ts +0 -3
- package/src/modules/cli/types.ts +0 -35
- package/src/utils/clean-template.ts +0 -159
- package/src/utils/detect-used-ports.ts +0 -57
- package/src/utils/extract-package-json-version-from-uri.ts +0 -29
- package/src/utils/git/command.ts +0 -89
- package/src/utils/git/index.ts +0 -11
- package/src/utils/is-empty-directory.ts +0 -15
- package/src/utils/progress.ts +0 -118
- package/src/utils/run-package-manager-command.ts +0 -49
- package/src/utils/validate-project-name.ts +0 -19
- package/tests/e2e.test.ts +0 -108
- package/tests/validate-project-name.test.ts +0 -22
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -23
- package/vitest.config.ts +0 -17
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placeholder default config for new forks created by `create-cella`.
|
|
3
|
+
*
|
|
4
|
+
* This file replaces `shared/config/config.default.ts` during project creation.
|
|
5
|
+
* Tokens `__project_name__` and `__project_slug__` are interpolated with the
|
|
6
|
+
* project name chosen by the user. All Cella-specific branding, URLs, tokens
|
|
7
|
+
* and company details are replaced with safe placeholder values.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This file is NOT compiled or imported — it is copied and interpolated
|
|
10
|
+
* as plain text. The import path below is relative to `shared/config/` (its destination).
|
|
11
|
+
*/
|
|
12
|
+
import type { ConfigMode, RequiredConfig, S3ConfigInput } from '../src/config-builder/types';
|
|
13
|
+
|
|
14
|
+
// Re-export for external consumers
|
|
15
|
+
export { roles, hierarchy } from './hierarchy-config';
|
|
16
|
+
|
|
17
|
+
export const config = {
|
|
18
|
+
|
|
19
|
+
/******************************************************************************
|
|
20
|
+
* ENTITY DATA MODEL
|
|
21
|
+
******************************************************************************/
|
|
22
|
+
|
|
23
|
+
/** All entity types in the app - must match hierarchy.allTypes. */
|
|
24
|
+
entityTypes: ['user', 'organization', 'attachment', 'page'] as const,
|
|
25
|
+
|
|
26
|
+
/** Context entities with memberships - must match hierarchy.contextTypes. */
|
|
27
|
+
contextEntityTypes: ['organization'] as const,
|
|
28
|
+
|
|
29
|
+
/** Product/content entities - must match hierarchy.productTypes. */
|
|
30
|
+
productEntityTypes: ['attachment', 'page'] as const,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Product entity types tracked for seen/unseen counts.
|
|
34
|
+
* Unseen counts are grouped by the parent context entity of each tracked type.
|
|
35
|
+
*/
|
|
36
|
+
seenTrackedEntityTypes: ['attachment'] as const,
|
|
37
|
+
|
|
38
|
+
/** Maps entity types to their ID column names - must match entityTypes */
|
|
39
|
+
entityIdColumnKeys: {
|
|
40
|
+
user: 'userId',
|
|
41
|
+
organization: 'organizationId',
|
|
42
|
+
attachment: 'attachmentId',
|
|
43
|
+
page: 'pageId',
|
|
44
|
+
} as const,
|
|
45
|
+
|
|
46
|
+
/** Available CRUD actions for permission checks */
|
|
47
|
+
entityActions: ['create', 'read', 'update', 'delete'] as const,
|
|
48
|
+
|
|
49
|
+
/** Resource types that are not entities but have activities logged */
|
|
50
|
+
resourceTypes: ['request', 'membership', 'inactive_membership', 'tenant'] as const,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Entity embeddings: declares which entities are embedded as ID arrays inside
|
|
54
|
+
* other entities. Forks extend when adding new embedding relationships.
|
|
55
|
+
*/
|
|
56
|
+
entityEmbeddings: [] as readonly { readonly embeddedEntity: string; readonly hostEntity: string; readonly hostColumn: string }[],
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* User menu structure of context entities with optional nested subentities.
|
|
60
|
+
* If subentityType is set, the table must include `${entity}Id` foreign key.
|
|
61
|
+
*/
|
|
62
|
+
menuStructure: [
|
|
63
|
+
{ entityType: 'organization', subentityType: null } as const,
|
|
64
|
+
],
|
|
65
|
+
|
|
66
|
+
/** Default restrictions for tenants (entity quotas and rate limits) */
|
|
67
|
+
defaultRestrictions: {
|
|
68
|
+
quotas: {
|
|
69
|
+
organization: 5,
|
|
70
|
+
user: 1000,
|
|
71
|
+
attachment: 100,
|
|
72
|
+
},
|
|
73
|
+
rateLimits: {
|
|
74
|
+
apiPointsPerHour: 1000,
|
|
75
|
+
},
|
|
76
|
+
} as const,
|
|
77
|
+
|
|
78
|
+
/******************************************************************************
|
|
79
|
+
* SYSTEM ROLES
|
|
80
|
+
******************************************************************************/
|
|
81
|
+
|
|
82
|
+
systemRoles: ['admin'] as const,
|
|
83
|
+
|
|
84
|
+
/******************************************************************************
|
|
85
|
+
* APP IDENTITY
|
|
86
|
+
******************************************************************************/
|
|
87
|
+
|
|
88
|
+
/** App display name shown in UI and emails */
|
|
89
|
+
name: '__project_name__',
|
|
90
|
+
/** URL-safe identifier used in paths and storage */
|
|
91
|
+
slug: '__project_slug__',
|
|
92
|
+
/** Primary domain for the app */
|
|
93
|
+
domain: '__project_slug__.example.com',
|
|
94
|
+
/** App description for SEO and meta tags */
|
|
95
|
+
description: '__project_name__ — powered by Cella.',
|
|
96
|
+
/** SEO keywords for search engines */
|
|
97
|
+
keywords:
|
|
98
|
+
'starter kit, fullstack, monorepo, typescript, hono, honojs, drizzle, baseui, react, postgres, pwa, offline, instant updates, realtime data, sync engine',
|
|
99
|
+
|
|
100
|
+
/******************************************************************************
|
|
101
|
+
* URLS & ENDPOINTS
|
|
102
|
+
******************************************************************************/
|
|
103
|
+
|
|
104
|
+
/** Frontend SPA base URL */
|
|
105
|
+
frontendUrl: 'https://__project_slug__.example.com',
|
|
106
|
+
/** Backend API base URL */
|
|
107
|
+
backendUrl: 'https://api.__project_slug__.example.com',
|
|
108
|
+
/** OAuth callback base URL */
|
|
109
|
+
backendAuthUrl: 'https://api.__project_slug__.example.com/auth',
|
|
110
|
+
/** Yjs realtime relay URL */
|
|
111
|
+
yjsUrl: 'wss://yjs.__project_slug__.example.com',
|
|
112
|
+
/** AI service base URL */
|
|
113
|
+
aiUrl: 'https://ai.__project_slug__.example.com',
|
|
114
|
+
|
|
115
|
+
/** About page URL */
|
|
116
|
+
aboutUrl: '/about',
|
|
117
|
+
/** Status page URL for uptime monitoring */
|
|
118
|
+
statusUrl: 'https://status.__project_slug__.example.com',
|
|
119
|
+
/** Canonical production URL */
|
|
120
|
+
productionUrl: 'https://__project_slug__.example.com',
|
|
121
|
+
|
|
122
|
+
/** Default redirect path after login */
|
|
123
|
+
defaultRedirectPath: '/home',
|
|
124
|
+
/** Redirect path for first-time users */
|
|
125
|
+
welcomeRedirectPath: '/welcome',
|
|
126
|
+
|
|
127
|
+
/******************************************************************************
|
|
128
|
+
* EMAIL
|
|
129
|
+
******************************************************************************/
|
|
130
|
+
|
|
131
|
+
/** From address for system notifications */
|
|
132
|
+
senderEmail: 'notifications@__project_slug__.example.com',
|
|
133
|
+
/** Email address for user support inquiries */
|
|
134
|
+
supportEmail: 'support@__project_slug__.example.com',
|
|
135
|
+
/** Receive security warnings */
|
|
136
|
+
securityEmail: 'security@__project_slug__.example.com',
|
|
137
|
+
|
|
138
|
+
/******************************************************************************
|
|
139
|
+
* MODE & FLAGS
|
|
140
|
+
******************************************************************************/
|
|
141
|
+
|
|
142
|
+
/** Runtime mode - overridden per environment file */
|
|
143
|
+
mode: 'development' as ConfigMode,
|
|
144
|
+
/** Enable maintenance mode (blocks all requests) */
|
|
145
|
+
maintenance: false,
|
|
146
|
+
/** Cookie version - increment when changing cookie structure to invalidate old cookies */
|
|
147
|
+
cookieVersion: 'v1',
|
|
148
|
+
|
|
149
|
+
/******************************************************************************
|
|
150
|
+
* FEATURE FLAGS
|
|
151
|
+
******************************************************************************/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Feature toggles for app capabilities.
|
|
155
|
+
* Use to enable/disable major features without code changes.
|
|
156
|
+
*/
|
|
157
|
+
has: {
|
|
158
|
+
/** Progressive Web App support for preloading static assets and offline support */
|
|
159
|
+
pwa: true as boolean,
|
|
160
|
+
/** Allow users to sign up. If false, the app is by invitation only */
|
|
161
|
+
selfRegistration: false as boolean,
|
|
162
|
+
/** Suggest a waitlist for unknown emails when sign up is disabled */
|
|
163
|
+
waitlist: false as boolean,
|
|
164
|
+
/** S3 fully configured - if false, files will be stored in local browser (IndexedDB) */
|
|
165
|
+
uploadEnabled: false as boolean,
|
|
166
|
+
/** Customer support chat widget (Gleap). Unrelated to the AI module. */
|
|
167
|
+
chatSupport: false as boolean,
|
|
168
|
+
/** Yjs realtime collaboration */
|
|
169
|
+
yjs: false as boolean,
|
|
170
|
+
/** AI capability layer: tool registry + model runner + MCP endpoint. */
|
|
171
|
+
ai: false as boolean,
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
/******************************************************************************
|
|
175
|
+
* AUTHENTICATION
|
|
176
|
+
******************************************************************************/
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Enabled authentication strategies.
|
|
180
|
+
* TOTP can only be used as MFA fallback with passkey as primary.
|
|
181
|
+
*/
|
|
182
|
+
enabledAuthStrategies: ['passkey', 'oauth', 'totp', 'magic'] as const,
|
|
183
|
+
|
|
184
|
+
/** Enabled OAuth providers - currently supports: github, google, microsoft */
|
|
185
|
+
enabledOAuthProviders: ['github'] as const,
|
|
186
|
+
|
|
187
|
+
/** Token types used for verification flows */
|
|
188
|
+
tokenTypes: ['email-verification', 'oauth-verification', 'invitation', 'confirm-mfa', 'magic'] as const,
|
|
189
|
+
|
|
190
|
+
/** TOTP configuration for MFA */
|
|
191
|
+
totpConfig: {
|
|
192
|
+
intervalInSeconds: 30,
|
|
193
|
+
gracePeriodInSeconds: 60,
|
|
194
|
+
digits: 6,
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
/******************************************************************************
|
|
198
|
+
* API CONFIGURATION
|
|
199
|
+
******************************************************************************/
|
|
200
|
+
|
|
201
|
+
/** API version prefix for endpoints */
|
|
202
|
+
apiVersion: 'v1',
|
|
203
|
+
/** API documentation description shown in Scalar */
|
|
204
|
+
apiDescription: `⚠️ ATTENTION: PRERELEASE!
|
|
205
|
+
This API is organized into modules based on logical domains.`,
|
|
206
|
+
|
|
207
|
+
/******************************************************************************
|
|
208
|
+
* REQUEST LIMITS
|
|
209
|
+
******************************************************************************/
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Default page sizes for list endpoints. Backend enforces max 1000.
|
|
213
|
+
* Must include 'default' key as fallback.
|
|
214
|
+
*/
|
|
215
|
+
requestLimits: {
|
|
216
|
+
default: 40,
|
|
217
|
+
users: 100,
|
|
218
|
+
members: 40,
|
|
219
|
+
organizations: 40,
|
|
220
|
+
requests: 40,
|
|
221
|
+
attachments: 40,
|
|
222
|
+
pages: 100,
|
|
223
|
+
pendingMemberships: 20,
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
/** Max JSON body size in bytes */
|
|
227
|
+
jsonBodyLimit: 1 * 1024 * 1024,
|
|
228
|
+
/** Max file upload size in bytes */
|
|
229
|
+
fileUploadLimit: 20 * 1024 * 1024,
|
|
230
|
+
/** Default body size limit in bytes */
|
|
231
|
+
defaultBodyLimit: 1 * 1024 * 1024,
|
|
232
|
+
|
|
233
|
+
/******************************************************************************
|
|
234
|
+
* STORAGE & UPLOADS (S3)
|
|
235
|
+
******************************************************************************/
|
|
236
|
+
|
|
237
|
+
/** S3-compatible storage configuration. Only region and host are required; the rest is derived from the slug. */
|
|
238
|
+
s3: {
|
|
239
|
+
region: '',
|
|
240
|
+
host: '',
|
|
241
|
+
} as S3ConfigInput,
|
|
242
|
+
|
|
243
|
+
/** Upload template IDs for Transloadit processing pipelines */
|
|
244
|
+
uploadTemplateIds: ['avatar', 'cover', 'attachment'] as const,
|
|
245
|
+
|
|
246
|
+
/** Uppy upload widget default restrictions */
|
|
247
|
+
uppy: {
|
|
248
|
+
defaultRestrictions: {
|
|
249
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
250
|
+
maxNumberOfFiles: 1,
|
|
251
|
+
allowedFileTypes: ['.jpg', '.jpeg', '.png'],
|
|
252
|
+
maxTotalFileSize: 100 * 1024 * 1024,
|
|
253
|
+
minFileSize: null,
|
|
254
|
+
minNumberOfFiles: null,
|
|
255
|
+
requiredMetaFields: [],
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Local blob storage restrictions (IndexedDB/Dexie).
|
|
261
|
+
* Controls which attachments are cached locally for offline access.
|
|
262
|
+
*/
|
|
263
|
+
localBlobStorage: {
|
|
264
|
+
enabled: true,
|
|
265
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
266
|
+
maxTotalSize: 100 * 1024 * 1024,
|
|
267
|
+
allowedContentTypes: [] as string[],
|
|
268
|
+
excludedContentTypes: ['video/*'] as string[],
|
|
269
|
+
downloadConcurrency: 2,
|
|
270
|
+
uploadRetryAttempts: 3,
|
|
271
|
+
uploadRetryDelays: [60000, 300000, 900000] as const,
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
/******************************************************************************
|
|
275
|
+
* THIRD-PARTY SERVICES
|
|
276
|
+
******************************************************************************/
|
|
277
|
+
|
|
278
|
+
/** Gleap token for customer support widget */
|
|
279
|
+
gleapToken: '',
|
|
280
|
+
/** Google Maps API key */
|
|
281
|
+
googleMapsKey: '',
|
|
282
|
+
/** Matrix homeserver URL for chat integration */
|
|
283
|
+
matrixURL: 'https://matrix-client.matrix.org',
|
|
284
|
+
|
|
285
|
+
/******************************************************************************
|
|
286
|
+
* THEMING & UI
|
|
287
|
+
******************************************************************************/
|
|
288
|
+
|
|
289
|
+
/** Primary theme color for PWA manifest and browser chrome */
|
|
290
|
+
themeColor: '#26262b',
|
|
291
|
+
/** Theme configuration for UI components */
|
|
292
|
+
theme: {
|
|
293
|
+
navigation: {
|
|
294
|
+
hasSidebarTextLabels: false,
|
|
295
|
+
sidebarWidthExpanded: '16rem',
|
|
296
|
+
sidebarWidthCollapsed: '4rem',
|
|
297
|
+
sheetPanelWidth: '20rem',
|
|
298
|
+
},
|
|
299
|
+
colors: {},
|
|
300
|
+
strokeWidth: 1.5,
|
|
301
|
+
screenSizes: {
|
|
302
|
+
xs: '420px',
|
|
303
|
+
sm: '640px',
|
|
304
|
+
md: '768px',
|
|
305
|
+
lg: '1024px',
|
|
306
|
+
xl: '1280px',
|
|
307
|
+
'2xl': '1400px',
|
|
308
|
+
},
|
|
309
|
+
} as const,
|
|
310
|
+
/** Placeholder background colors for avatars without images */
|
|
311
|
+
placeholderColors: [
|
|
312
|
+
'bg-blue-300',
|
|
313
|
+
'bg-lime-300',
|
|
314
|
+
'bg-orange-300',
|
|
315
|
+
'bg-yellow-300',
|
|
316
|
+
'bg-green-300',
|
|
317
|
+
'bg-teal-300',
|
|
318
|
+
'bg-indigo-300',
|
|
319
|
+
'bg-purple-300',
|
|
320
|
+
'bg-pink-300',
|
|
321
|
+
'bg-red-300',
|
|
322
|
+
],
|
|
323
|
+
|
|
324
|
+
/******************************************************************************
|
|
325
|
+
* LOCALIZATION
|
|
326
|
+
******************************************************************************/
|
|
327
|
+
|
|
328
|
+
/** Default language code */
|
|
329
|
+
defaultLanguage: 'en' as const,
|
|
330
|
+
/** Available language codes - first is fallback */
|
|
331
|
+
languages: ['en', 'nl'] as const,
|
|
332
|
+
/** Common reference data */
|
|
333
|
+
c: {
|
|
334
|
+
countries: ['fr', 'de', 'nl', 'ua', 'us', 'gb'],
|
|
335
|
+
timezones: [],
|
|
336
|
+
},
|
|
337
|
+
|
|
338
|
+
/******************************************************************************
|
|
339
|
+
* COMPANY DETAILS
|
|
340
|
+
******************************************************************************/
|
|
341
|
+
|
|
342
|
+
/** Company/organization details for footer, legal pages, and contact info */
|
|
343
|
+
company: {
|
|
344
|
+
name: '__project_name__',
|
|
345
|
+
shortName: '__project_name__',
|
|
346
|
+
email: 'info@__project_slug__.example.com',
|
|
347
|
+
supportEmail: 'support@__project_slug__.example.com',
|
|
348
|
+
tel: '',
|
|
349
|
+
streetAddress: '',
|
|
350
|
+
postcode: '',
|
|
351
|
+
city: '',
|
|
352
|
+
country: '',
|
|
353
|
+
registration: '',
|
|
354
|
+
bankAccount: '',
|
|
355
|
+
googleMapsUrl: '',
|
|
356
|
+
scheduleCallUrl: '',
|
|
357
|
+
blueskyUrl: '',
|
|
358
|
+
blueskyHandle: '',
|
|
359
|
+
element: '',
|
|
360
|
+
githubUrl: '',
|
|
361
|
+
mapZoom: 4,
|
|
362
|
+
coordinates: {
|
|
363
|
+
lat: 0,
|
|
364
|
+
lng: 0,
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
/******************************************************************************
|
|
369
|
+
* USER DEFAULTS
|
|
370
|
+
******************************************************************************/
|
|
371
|
+
|
|
372
|
+
/** Default user flags applied to new users */
|
|
373
|
+
defaultUserFlags: {
|
|
374
|
+
finishedOnboarding: false,
|
|
375
|
+
},
|
|
376
|
+
} satisfies RequiredConfig;
|
|
377
|
+
|
|
378
|
+
export default config;
|