create-celsian 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ThenJS
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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ // create-celsian — Project scaffolder
3
+ import { mkdirSync, writeFileSync } from 'node:fs';
4
+ import { join, dirname } from 'node:path';
5
+ import { basicTemplate } from './templates/basic.js';
6
+ import { restApiTemplate } from './templates/rest-api.js';
7
+ import { rpcApiTemplate } from './templates/rpc-api.js';
8
+ const templates = {
9
+ basic: basicTemplate,
10
+ 'rest-api': restApiTemplate,
11
+ 'rpc-api': rpcApiTemplate,
12
+ };
13
+ const args = process.argv.slice(2);
14
+ const name = args[0];
15
+ const templateFlag = args.indexOf('--template');
16
+ const template = templateFlag !== -1 ? args[templateFlag + 1] ?? 'basic' : 'basic';
17
+ if (!name) {
18
+ console.log('Usage: create-celsian <project-name> [--template basic|rest-api|rpc-api]');
19
+ console.log('');
20
+ console.log('Templates:');
21
+ console.log(' basic Minimal API server (default)');
22
+ console.log(' rest-api REST + TypeBox schemas');
23
+ console.log(' rpc-api RPC-first with typed client');
24
+ process.exit(1);
25
+ }
26
+ const files = templates[template];
27
+ if (!files) {
28
+ console.error(`Unknown template: ${template}`);
29
+ console.error('Available: basic, rest-api, rpc-api');
30
+ process.exit(1);
31
+ }
32
+ const dir = join(process.cwd(), name);
33
+ console.log(`\nCreating Celsian project: ${name}\n`);
34
+ for (const [filePath, content] of Object.entries(files)) {
35
+ const fullPath = join(dir, filePath);
36
+ const fileDir = dirname(fullPath);
37
+ mkdirSync(fileDir, { recursive: true });
38
+ writeFileSync(fullPath, content.replace(/\{\{name\}\}/g, name));
39
+ console.log(` + ${filePath}`);
40
+ }
41
+ console.log(`\nDone! Next steps:\n`);
42
+ console.log(` cd ${name}`);
43
+ console.log(' npm install');
44
+ console.log(' npm run dev');
45
+ console.log('');
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,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,CAAC,GAAG,CAAC,+BAA+B,IAAI,IAAI,CAAC,CAAC;AAErD,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AACrC,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;AAC5B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7B,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const basicTemplate: {
2
+ 'package.json': string;
3
+ 'tsconfig.json': string;
4
+ 'src/index.ts': string;
5
+ };
6
+ //# sourceMappingURL=basic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/templates/basic.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;CAqDzB,CAAC"}
@@ -0,0 +1,47 @@
1
+ export const basicTemplate = {
2
+ 'package.json': JSON.stringify({
3
+ name: '{{name}}',
4
+ version: '0.0.1',
5
+ type: 'module',
6
+ scripts: {
7
+ dev: 'npx celsian dev',
8
+ build: 'tsc',
9
+ start: 'node dist/index.js',
10
+ },
11
+ dependencies: {
12
+ celsian: '^0.1.0',
13
+ },
14
+ devDependencies: {
15
+ typescript: '^5.7.0',
16
+ tsx: '^4.0.0',
17
+ },
18
+ }, null, 2),
19
+ 'tsconfig.json': JSON.stringify({
20
+ compilerOptions: {
21
+ target: 'ES2022',
22
+ module: 'ESNext',
23
+ moduleResolution: 'bundler',
24
+ strict: true,
25
+ esModuleInterop: true,
26
+ skipLibCheck: true,
27
+ outDir: 'dist',
28
+ rootDir: 'src',
29
+ },
30
+ include: ['src'],
31
+ }, null, 2),
32
+ 'src/index.ts': `import { createApp, serve } from 'celsian';
33
+
34
+ const app = createApp();
35
+
36
+ app.get('/health', (req, reply) => {
37
+ return reply.json({ status: 'ok', timestamp: new Date().toISOString() });
38
+ });
39
+
40
+ app.get('/hello/:name', (req, reply) => {
41
+ return reply.json({ message: \`Hello, \${req.params.name}!\` });
42
+ });
43
+
44
+ serve(app, { port: 3000 });
45
+ `,
46
+ };
47
+ //# sourceMappingURL=basic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic.js","sourceRoot":"","sources":["../../src/templates/basic.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc,EAAE,IAAI,CAAC,SAAS,CAC5B;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,GAAG,EAAE,iBAAiB;YACtB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,oBAAoB;SAC5B;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,QAAQ;SAClB;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,QAAQ;SACd;KACF,EACD,IAAI,EACJ,CAAC,CACF;IACD,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,SAAS;YAC3B,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,EACD,IAAI,EACJ,CAAC,CACF;IACD,cAAc,EAAE;;;;;;;;;;;;;CAajB;CACA,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const restApiTemplate: {
2
+ 'package.json': string;
3
+ 'tsconfig.json': string;
4
+ 'src/index.ts': string;
5
+ };
6
+ //# sourceMappingURL=rest-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-api.d.ts","sourceRoot":"","sources":["../../src/templates/rest-api.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;CA6E3B,CAAC"}
@@ -0,0 +1,71 @@
1
+ export const restApiTemplate = {
2
+ 'package.json': JSON.stringify({
3
+ name: '{{name}}',
4
+ version: '0.0.1',
5
+ type: 'module',
6
+ scripts: {
7
+ dev: 'npx celsian dev',
8
+ build: 'tsc',
9
+ start: 'node dist/index.js',
10
+ },
11
+ dependencies: {
12
+ celsian: '^0.1.0',
13
+ '@sinclair/typebox': '^0.34.0',
14
+ },
15
+ devDependencies: {
16
+ typescript: '^5.7.0',
17
+ tsx: '^4.0.0',
18
+ },
19
+ }, null, 2),
20
+ 'tsconfig.json': JSON.stringify({
21
+ compilerOptions: {
22
+ target: 'ES2022',
23
+ module: 'ESNext',
24
+ moduleResolution: 'bundler',
25
+ strict: true,
26
+ esModuleInterop: true,
27
+ skipLibCheck: true,
28
+ outDir: 'dist',
29
+ rootDir: 'src',
30
+ },
31
+ include: ['src'],
32
+ }, null, 2),
33
+ 'src/index.ts': `import { createApp, serve } from 'celsian';
34
+ import { Type } from '@sinclair/typebox';
35
+
36
+ const app = createApp();
37
+
38
+ const CreateUserSchema = Type.Object({
39
+ name: Type.String(),
40
+ email: Type.String({ format: 'email' }),
41
+ });
42
+
43
+ const users: Array<{ id: number; name: string; email: string }> = [];
44
+ let nextId = 1;
45
+
46
+ app.get('/users', (req, reply) => {
47
+ return reply.json(users);
48
+ });
49
+
50
+ app.route({
51
+ method: 'POST',
52
+ url: '/users',
53
+ schema: { body: CreateUserSchema },
54
+ handler(req, reply) {
55
+ const { name, email } = req.parsedBody as { name: string; email: string };
56
+ const user = { id: nextId++, name, email };
57
+ users.push(user);
58
+ return reply.status(201).json(user);
59
+ },
60
+ });
61
+
62
+ app.get('/users/:id', (req, reply) => {
63
+ const user = users.find(u => u.id === Number(req.params.id));
64
+ if (!user) return reply.status(404).json({ error: 'User not found' });
65
+ return reply.json(user);
66
+ });
67
+
68
+ serve(app, { port: 3000 });
69
+ `,
70
+ };
71
+ //# sourceMappingURL=rest-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-api.js","sourceRoot":"","sources":["../../src/templates/rest-api.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,cAAc,EAAE,IAAI,CAAC,SAAS,CAC5B;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,GAAG,EAAE,iBAAiB;YACtB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,oBAAoB;SAC5B;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,QAAQ;YACjB,mBAAmB,EAAE,SAAS;SAC/B;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,QAAQ;SACd;KACF,EACD,IAAI,EACJ,CAAC,CACF;IACD,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,SAAS;YAC3B,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,EACD,IAAI,EACJ,CAAC,CACF;IACD,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCjB;CACA,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const rpcApiTemplate: {
2
+ 'package.json': string;
3
+ 'tsconfig.json': string;
4
+ 'src/index.ts': string;
5
+ };
6
+ //# sourceMappingURL=rpc-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-api.d.ts","sourceRoot":"","sources":["../../src/templates/rpc-api.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;CA8E1B,CAAC"}
@@ -0,0 +1,72 @@
1
+ export const rpcApiTemplate = {
2
+ 'package.json': JSON.stringify({
3
+ name: '{{name}}',
4
+ version: '0.0.1',
5
+ type: 'module',
6
+ scripts: {
7
+ dev: 'npx celsian dev',
8
+ build: 'tsc',
9
+ start: 'node dist/index.js',
10
+ },
11
+ dependencies: {
12
+ celsian: '^0.1.0',
13
+ '@celsian/rpc': '^0.1.0',
14
+ '@sinclair/typebox': '^0.34.0',
15
+ },
16
+ devDependencies: {
17
+ typescript: '^5.7.0',
18
+ tsx: '^4.0.0',
19
+ },
20
+ }, null, 2),
21
+ 'tsconfig.json': JSON.stringify({
22
+ compilerOptions: {
23
+ target: 'ES2022',
24
+ module: 'ESNext',
25
+ moduleResolution: 'bundler',
26
+ strict: true,
27
+ esModuleInterop: true,
28
+ skipLibCheck: true,
29
+ outDir: 'dist',
30
+ rootDir: 'src',
31
+ },
32
+ include: ['src'],
33
+ }, null, 2),
34
+ 'src/index.ts': `import { createApp, serve } from 'celsian';
35
+ import { procedure, router, RPCHandler } from '@celsian/rpc';
36
+ import { Type } from '@sinclair/typebox';
37
+
38
+ const app = createApp();
39
+
40
+ const appRouter = router({
41
+ greeting: {
42
+ hello: procedure
43
+ .input(Type.Object({ name: Type.String() }))
44
+ .query(({ input }) => {
45
+ return { message: \\\`Hello, \\\${input.name}!\\\` };
46
+ }),
47
+ },
48
+ math: {
49
+ add: procedure
50
+ .input(Type.Object({ a: Type.Number(), b: Type.Number() }))
51
+ .query(({ input }) => {
52
+ return { result: input.a + input.b };
53
+ }),
54
+ },
55
+ });
56
+
57
+ const rpcHandler = new RPCHandler(appRouter);
58
+
59
+ app.route({
60
+ method: ['GET', 'POST'],
61
+ url: '/_rpc/*path',
62
+ handler(req) {
63
+ return rpcHandler.handle(req);
64
+ },
65
+ });
66
+
67
+ serve(app, { port: 3000 });
68
+
69
+ export type AppRouter = typeof appRouter;
70
+ `,
71
+ };
72
+ //# sourceMappingURL=rpc-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-api.js","sourceRoot":"","sources":["../../src/templates/rpc-api.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,cAAc,EAAE,IAAI,CAAC,SAAS,CAC5B;QACE,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP,GAAG,EAAE,iBAAiB;YACtB,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,oBAAoB;SAC5B;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,QAAQ;YACjB,cAAc,EAAE,QAAQ;YACxB,mBAAmB,EAAE,SAAS;SAC/B;QACD,eAAe,EAAE;YACf,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,QAAQ;SACd;KACF,EACD,IAAI,EACJ,CAAC,CACF;IACD,eAAe,EAAE,IAAI,CAAC,SAAS,CAC7B;QACE,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,gBAAgB,EAAE,SAAS;YAC3B,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI;YACrB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE,CAAC,KAAK,CAAC;KACjB,EACD,IAAI,EACJ,CAAC,CACF;IACD,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCjB;CACA,CAAC"}
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "create-celsian",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "create-celsian": "dist/index.js"
7
+ },
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "license": "MIT",
14
+ "scripts": {
15
+ "build": "tsc -b"
16
+ }
17
+ }