create-seamless 0.0.2 → 0.0.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.
Files changed (5) hide show
  1. package/LICENSE +79 -21
  2. package/LICENSE.md +26 -0
  3. package/README.md +107 -50
  4. package/index.js +423 -31
  5. package/package.json +15 -6
package/LICENSE CHANGED
@@ -1,21 +1,79 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Fells Code LLC <Brandon Corbett>
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.
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc.
5
+ <https://fsf.org/>
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ This license is identical to the GNU General Public License, except that it also
10
+ ensures that software running as a network service makes its source code
11
+ available to users.
12
+
13
+ ---
14
+
15
+ TERMS AND CONDITIONS
16
+
17
+ 0. Definitions.
18
+
19
+ “This License” refers to version 3 of the GNU Affero General Public License.
20
+
21
+ “Copyright” also means copyright-like laws that apply to other kinds of works,
22
+ such as semiconductor masks.
23
+
24
+ The “Program” refers to any copyrightable work licensed under this License.
25
+ Each licensee is addressed as “you”.
26
+
27
+ To “modify” a work means to copy from or adapt all or part of the work in a
28
+ fashion requiring copyright permission, other than the making of an exact copy.
29
+
30
+ To “propagate” a work means to do anything with it that, without permission,
31
+ would make you directly or secondarily liable for infringement under applicable
32
+ copyright law, except executing it on a computer or modifying a private copy.
33
+
34
+ To “convey” a work means any kind of propagation that enables other parties to
35
+ make or receive copies.
36
+
37
+ An interactive user interface displays “Appropriate Legal Notices” to the extent
38
+ that it includes a convenient and prominently visible feature that displays an
39
+ appropriate copyright notice, and tells the user that there is no warranty for
40
+ the work (except to the extent that warranties are provided), that licensees may
41
+ convey the work under this License, and how to view a copy of this License.
42
+
43
+ ---
44
+
45
+ 13. Remote Network Interaction; Use with the GNU General Public License.
46
+
47
+ Notwithstanding any other provision of this License, if you modify the Program,
48
+ your modified version must prominently offer all users interacting with it
49
+ remotely through a computer network an opportunity to receive the Corresponding
50
+ Source of your version by providing access to the Corresponding Source from a
51
+ network server at no charge, through some standard or customary means of
52
+ facilitating copying of software.
53
+
54
+ ---
55
+
56
+ 15. Disclaimer of Warranty.
57
+
58
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
59
+ EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
60
+ PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
61
+ EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
62
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
63
+
64
+ ---
65
+
66
+ 16. Limitation of Liability.
67
+
68
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
69
+ COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS
70
+ PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
71
+ INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
72
+ THE PROGRAM.
73
+
74
+ ---
75
+
76
+ END OF TERMS AND CONDITIONS
77
+
78
+ You should have received a copy of the GNU Affero General Public License along
79
+ with this program. If not, see <https://www.gnu.org/licenses/>.
package/LICENSE.md ADDED
@@ -0,0 +1,26 @@
1
+ # License
2
+
3
+ Create Seamless ("create-seamless) is licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0-only)**.
4
+
5
+ - SPDX: `AGPL-3.0-only`
6
+
7
+ ## What this means (high level)
8
+
9
+ - You are free to **use**, **modify**, and **self-host** this software.
10
+ - If you **modify** this software and **run it as a network service** (for example, hosting it for others to use), you must **make the complete corresponding source code of your modified version available** to users of that service, under the AGPL.
11
+
12
+ This summary is not legal advice and does not replace the license text.
13
+
14
+ ## Full license text
15
+
16
+ The full license text is available here:
17
+
18
+ - https://www.gnu.org/licenses/agpl-3.0.html
19
+
20
+ You should include a copy of the AGPLv3 license in your distribution. If this repository does not contain the full license text yet, add it as `LICENSE` or `LICENSE.txt` (recommended), and keep this `LICENSE.md` as the human-friendly summary.
21
+
22
+ ## Commercial licensing
23
+
24
+ If you would like to embed Seamless Auth API into a proprietary product, redistribute it under different terms, or offer it as a managed service without AGPL obligations, commercial licensing may be available.
25
+
26
+ Contact: support@seamlessauth.com
package/README.md CHANGED
@@ -1,79 +1,136 @@
1
1
  # create-seamless
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
3
+ [![License: AGPL-3](https://img.shields.io/badge/License-AGPL3-yellow.svg)](LICENSE)
4
4
  [![npm version](https://img.shields.io/npm/v/create-seamless.svg?style=flat)](https://www.npmjs.com/package/create-seamless)
5
5
 
6
- 🚀 A simple way to bootstrap a new project with [SeamlessAuth](https://seamlessauth.com).
7
- This CLI helps you quickly spin up a React + Vite starter template (with HTTPS preconfigured) so you can start building secure apps right away.
6
+ `create-seamless` is a project scaffolding tool for building applications with **Seamless Auth**, an open source, passwordless authentication system.
8
7
 
9
- ## Features
8
+ It provisions a local, production-shaped development environment that can include:
10
9
 
11
- - 📦 **One command setup** with `npx create-seamless <project-name>`
12
- - 🔒 **HTTPS ready** out of the box (self-signed certs auto-generated)
13
- - **Vite + React starter** integrated with SeamlessAuth
14
- - 🧹 Automatic cleanup on errors (no half-created projects)
15
- - 🔮 Future support for:
16
- - API server scaffolding
17
- - Mode flags (`--web`, `--server`)
18
- - Multiple starter templates
10
+ - The Seamless Auth open source server
11
+ - A starter web application
12
+ - A starter API server
19
13
 
20
- ## 🚀 Quick Start
14
+ The generated project is fully local and requires no hosted services or external accounts to run.
21
15
 
22
- ```bash
23
- # Create a new project
24
- npx create-seamless my-app
16
+ ---
25
17
 
26
- cd my-app
27
- npm install
28
- npm run dev
29
- ```
18
+ ## What this creates
30
19
 
31
- Once the dev server starts, open https://localhost:5001.
32
- Your browser may ask you to trust the local certificate the first time.
20
+ Depending on the flags provided, `create-seamless` scaffolds a local project with the following structure:
33
21
 
34
- ## 🛠 Requirements
35
-
36
- - Node.js v20+
37
- - npm or pnpm
22
+ ```text
23
+ my-app/
24
+ ├─ auth/ # Seamless Auth OSS server
25
+ ├─ web/ # Starter web application (optional)
26
+ ├─ api/ # Starter API server (optional)
27
+ └─ README.md
28
+ ```
38
29
 
39
- ## ⚙️ Options (coming soon)
30
+ Each service is independently runnable and preconfigured to work together using local URLs and environment variables.
40
31
 
41
- We plan to add support for additional flags to customize your setup:
32
+ The intended development workflow is to run each service in its own terminal:
42
33
 
43
34
  ```bash
44
- # React web starter (default)
45
- npx create-seamless my-app --react
35
+ # terminal 1
36
+ cd auth && npm run dev
46
37
 
47
- # Include a working web server for backend validations
48
- npx create-seamless my-app --server
38
+ # terminal 2
39
+ cd api && npm run dev
40
+
41
+ # terminal 3
42
+ cd web && npm run dev
49
43
  ```
50
44
 
51
- ## 📂 Project Structure
45
+ ---
52
46
 
53
- After running the command, you’ll get:
47
+ ## Usage
54
48
 
55
- ```graphql
56
- my-app/
57
- ├─ .cert/ # Self-signed certificates for local HTTPS
58
- ├─ src/ # React source code
59
- ├─ vite.config.js # Preconfigured with HTTPS + SeamlessAuth
60
- ├─ package.json
61
- └─ README.md
49
+ Run via `npx`:
50
+
51
+ ```bash
52
+ npx create-seamless my-app
62
53
  ```
63
54
 
64
- ## 🔒 HTTPS Certificates
55
+ By default, this scaffolds the full local stack:
56
+
57
+ - Seamless Auth server
58
+ - Web application
59
+ - API server
60
+
61
+ ---
62
+
63
+ ## CLI options
64
+
65
+ | Flag | Description |
66
+ | ------------- | -------------------------------------------- |
67
+ | `--auth` | Include the Seamless Auth open source server |
68
+ | `--web` | Include the starter web application |
69
+ | `--api` | Include the starter API server |
70
+ | `--install` | Automatically install dependencies |
71
+ | `--no-git` | Skip git initialization |
72
+ | `--auth-port` | Auth server port (default: 3000) |
73
+ | `--api-port` | API server port (default: 4000) |
74
+ | `--web-port` | Web dev server port (default: 5173) |
75
+
76
+ If no component flags are provided, all components are included.
65
77
 
66
- The CLI automatically generates self-signed certificates in .cert/.
67
- These are used only for local development. If your browser warns you, simply trust the certificate.
78
+ ---
79
+
80
+ ## Included projects
81
+
82
+ `create-seamless` pulls directly from the following open source repositories:
83
+
84
+ - Seamless Auth Server
85
+ [https://github.com/fells-code/seamless-auth-api](https://github.com/fells-code/seamless-auth-api)
86
+
87
+ - Seamless Auth React Starter
88
+ [https://github.com/fells-code/seamless-auth-starter-react](https://github.com/fells-code/seamless-auth-starter-react)
89
+
90
+ - Seamless Auth API Starter
91
+ [https://github.com/fells-code/seamless-auth-starter-express](https://github.com/fells-code/seamless-auth-starter-express)
92
+
93
+ Each repository can be used independently, but `create-seamless` wires them together for local development out of the box.
94
+
95
+ ---
96
+
97
+ ## Documentation
98
+
99
+ Full documentation for Seamless Auth, including architecture, configuration, and deployment guidance, is available at:
100
+
101
+ [https://seamlessauth.com/docs](https://seamlessauth.com/docs)
102
+
103
+ ---
104
+
105
+ ## Philosophy
106
+
107
+ Seamless Auth is designed around:
108
+
109
+ - Passwordless authentication only
110
+ - Embedded auth (no redirects or callbacks)
111
+ - Self-hosted, open source foundations
112
+ - Production-shaped local development
113
+ - Minimal assumptions and explicit configuration
114
+
115
+ `create-seamless` exists to make getting started with this model straightforward and repeatable.
116
+
117
+ ---
118
+
119
+ ## Requirements
120
+
121
+ - Node.js 18 or newer
122
+ - npm or pnpm
68
123
 
69
- ## 🧹 Cleanup on Errors
124
+ ---
70
125
 
71
- If the setup process fails at any step, create-seamless will automatically remove the partially created project folder to avoid clutter.
126
+ ## License
72
127
 
73
- ## 🤝 Contributing
128
+ **AGPL-3.0-only** © 2026 Fells Code LLC
74
129
 
75
- We welcome contributions!
130
+ This license ensures:
76
131
 
77
- Report issues via [GitHub Issues](https://seamlessauth.com/create-seamless/issues)
132
+ - transparency of security-critical code
133
+ - freedom to self-host and modify
134
+ - sustainability of the managed service offering
78
135
 
79
- Open PRs for bug fixes or new features
136
+ See [`LICENSE`](./LICENSE) for details.
package/index.js CHANGED
@@ -1,46 +1,438 @@
1
1
  #!/usr/bin/env node
2
- import { execSync } from "child_process";
3
- import path from "path";
4
2
  import fs from "fs";
5
- import selfsigned from "selfsigned";
3
+ import path from "path";
4
+ import { execSync } from "child_process";
5
+ import { pipeline } from "stream";
6
+ import { promisify } from "util";
7
+ import { createWriteStream } from "fs";
8
+ import AdmZip from "adm-zip";
9
+ import { randomBytes } from "crypto";
10
+
11
+ const streamPipeline = promisify(pipeline);
12
+
13
+ const MIN_NODE_MAJOR = 18;
14
+ const nodeMajor = Number(process.versions.node.split(".")[0]);
15
+
16
+ function printHelp() {
17
+ console.log(`
18
+ create-seamless
19
+
20
+ Scaffold a local Seamless Auth development environment.
21
+
22
+ Usage:
23
+ npx create-seamless [project-name] [options]
24
+
25
+ Options:
26
+ --auth Include the Seamless Auth server
27
+ --api Include the Express API example
28
+ --web Include the React web application
29
+ --no-git Skip git initialization
30
+
31
+ --auth-port <n> Auth server port (default: 5312)
32
+ --api-port <n> API server port (default: 3000)
33
+ --web-port <n> Web server port (default: 5173)
34
+
35
+ -h, --help Show this help message
36
+
37
+ If no component flags are provided, all components are included.
38
+
39
+ Docs:
40
+ https://docs.seamlessauth.com
41
+ `);
42
+ }
43
+
44
+ if (nodeMajor < MIN_NODE_MAJOR) {
45
+ console.error(`
46
+ ❌ Seamless requires Node ${MIN_NODE_MAJOR}+.
47
+ You are running Node ${process.versions.node}
48
+
49
+ Upgrade at https://nodejs.org
50
+ `);
51
+ process.exit(1);
52
+ }
53
+
54
+ const args = process.argv.slice(2);
55
+
56
+ if (args.includes("-h") || args.includes("--help")) {
57
+ printHelp();
58
+ process.exit(0);
59
+ }
60
+ const projectName = args.find((a) => !a.startsWith("--")) ?? "seamless-app";
61
+
62
+ const hasFlag = (flag) => args.includes(`--${flag}`);
63
+ const getFlag = (flag, fallback) => {
64
+ const i = args.indexOf(`--${flag}`);
65
+ return i !== -1 ? args[i + 1] : fallback;
66
+ };
67
+
68
+ const includeAuth = hasFlag("auth");
69
+ const includeWeb = hasFlag("web");
70
+ const includeApi = hasFlag("api");
71
+ const skipGit = hasFlag("no-git");
72
+
73
+ const authPort = getFlag("auth-port", "5312");
74
+ const apiPort = getFlag("api-port", "3000");
75
+ const webPort = getFlag("web-port", "5173");
76
+
77
+ const wantsSomething = includeAuth || includeWeb || includeApi;
78
+ const AUTH = wantsSomething ? includeAuth : true;
79
+ const WEB = wantsSomething ? includeWeb : true;
80
+ const API = wantsSomething ? includeApi : true;
81
+
82
+ const REPOS = {
83
+ auth: "fells-code/seamless-auth-api",
84
+ web: "fells-code/seamless-auth-starter-react",
85
+ api: "fells-code/seamless-auth-starter-express",
86
+ };
87
+
88
+ const GENERATED_README = (projectName) => `# ${projectName}
89
+
90
+ This project was generated with \`create-seamless\` and provides a fully local,
91
+ open source authentication stack built on **Seamless Auth**.
92
+
93
+ It is designed for development environments where you want:
94
+
95
+ - Passwordless authentication
96
+ - No hosted dependencies
97
+ - No redirects or third-party auth services
98
+ - A production-shaped local setup
99
+
100
+ ---
101
+
102
+ ## Project layout
103
+
104
+ \`\`\`text
105
+ .
106
+ ├─ auth/ # Seamless Auth open source server
107
+ ├─ api/ # Backend API server (optional)
108
+ ├─ web/ # Frontend web application (optional)
109
+ ├─ Docker-compose.yml # Docker compose for one command spin up of dev environment
110
+ └─ README.md
111
+ \`\`\`
112
+
113
+ ---
114
+
115
+ ## Running the stack
116
+
117
+ ### Running with Docker (optional)
118
+
119
+ This project includes a Docker Compose configuration that allows you to run the
120
+ entire Seamless Auth stack locally with a single command.
121
+
122
+ ### Requirements
123
+
124
+ * Docker
125
+ * Docker Compose
126
+
127
+ ### Start the stack
128
+
129
+ From the project root, run:
130
+
131
+ \`\`\`bash
132
+ docker compose up
133
+ \`\`\`
134
+
135
+ This will start the following services in development mode:
136
+
137
+ * Postgres database
138
+ * Seamless Auth server
139
+ * API server
140
+ * Web UI
141
+
142
+ All services are configured with hot reload. Changes to the source code will be
143
+ picked up automatically.
144
+
145
+ ### Access the application
146
+
147
+ Once all services are running, open:
148
+
149
+ \`\`\`
150
+ http://localhost:5001
151
+ \`\`\`
152
+
153
+ This is the main entry point for the web application.
154
+
155
+ ### Stopping the stack
156
+
157
+ To stop all services:
158
+
159
+ \`\`\`bash
160
+ docker compose down
161
+ \`\`\`
162
+
163
+ This will shut down all containers while preserving the local database volume.
164
+
165
+ Open separate terminals and run each service independently.
166
+
167
+ ### Auth server
168
+
169
+ \`\`\`bash
170
+ cd auth
171
+ npm run dev
172
+ \`\`\`
173
+
174
+ Default port: \`5312\`
175
+
176
+ ---
6
177
 
7
- const project = process.argv[2] || "demo-app";
178
+ ### API server
8
179
 
9
- function cleanUp() {
10
- if (fs.existsSync(process.cwd(), project)) {
11
- console.log(`\n🧹 Cleaning up ${project} directory due to error...`);
12
- fs.rmSync(projectPath, { recursive: true, force: true });
180
+ \`\`\`bash
181
+ cd api
182
+ npm run dev
183
+ \`\`\`
184
+
185
+ Default port: \`3000\`
186
+
187
+ ---
188
+
189
+ ### Web application
190
+
191
+ \`\`\`bash
192
+ cd web
193
+ npm run dev
194
+ \`\`\`
195
+
196
+ Default port: \`5001\`
197
+
198
+ ---
199
+
200
+ ## Documentation
201
+
202
+ Full Seamless Auth documentation:
203
+
204
+ https://seamlessauth.com/docs
205
+
206
+ ---
207
+
208
+ ## Included open source projects
209
+
210
+ - Seamless Auth Server
211
+ https://github.com/fells-code/seamless-auth-server
212
+
213
+ - Seamless Auth React Starter
214
+ https://github.com/fells-code/seamless-auth-starter-react
215
+
216
+ - Seamless Auth API Starter
217
+ https://github.com/fells-code/seamless-auth-starter-express
218
+
219
+ ---
220
+
221
+ ## License
222
+
223
+ This generated project inherits the licenses of the open source components it
224
+ includes.
225
+
226
+ Review each subproject for its specific license before deploying to production.
227
+ `;
228
+
229
+ const GENERATED_DOCKER_COMPOSE = `
230
+ version: "3.9"
231
+
232
+ services:
233
+ db:
234
+ image: postgres:16
235
+ container_name: seamless-db
236
+ ports:
237
+ - "5432:5432"
238
+ environment:
239
+ POSTGRES_USER: seamless
240
+ POSTGRES_PASSWORD: seamless
241
+ POSTGRES_DB: seamless
242
+ volumes:
243
+ - pgdata:/var/lib/postgresql/data
244
+
245
+ auth:
246
+ container_name: seamless-auth
247
+ build: ./auth
248
+ ports:
249
+ - "5312:5312"
250
+ env_file:
251
+ - ./auth/.env
252
+ volumes:
253
+ - ./auth:/app
254
+ depends_on:
255
+ - db
256
+
257
+ api:
258
+ container_name: seamless-api
259
+ build: ./api
260
+ ports:
261
+ - "3000:3000"
262
+ env_file:
263
+ - ./api/.env
264
+ volumes:
265
+ - ./api:/app
266
+ depends_on:
267
+ - auth
268
+ - db
269
+
270
+ web:
271
+ container_name: seamless-web
272
+ build: ./web
273
+ ports:
274
+ - "5001:5001"
275
+ env_file:
276
+ - ./web/.env
277
+ volumes:
278
+ - ./web:/app
279
+ depends_on:
280
+ - auth
281
+ - api
282
+
283
+ volumes:
284
+ pgdata:
285
+ `;
286
+
287
+ function writeEnv(dir, values) {
288
+ const env = Object.entries(values)
289
+ .map(([k, v]) => `${k}=${v}`)
290
+ .join("\n");
291
+ fs.writeFileSync(path.join(dir, ".env"), env + "\n");
292
+ }
293
+
294
+ async function downloadRepo(repo, dest) {
295
+ const url = `https://codeload.github.com/${repo}/zip/refs/heads/main`;
296
+ const res = await fetch(url);
297
+ if (!res.ok || !res.body) {
298
+ throw new Error(`Failed to download ${repo}`);
299
+ }
300
+
301
+ const zipPath = path.join(dest, "_repo.zip");
302
+ await streamPipeline(res.body, createWriteStream(zipPath));
303
+
304
+ const zip = new AdmZip(zipPath);
305
+ zip.extractAllTo(dest, true);
306
+ fs.unlinkSync(zipPath);
307
+
308
+ const inner = fs.readdirSync(dest).find((f) => f.endsWith("-main"));
309
+ if (!inner) throw new Error("Unexpected repo structure");
310
+
311
+ const innerPath = path.join(dest, inner);
312
+ for (const file of fs.readdirSync(innerPath)) {
313
+ fs.renameSync(path.join(innerPath, file), path.join(dest, file));
13
314
  }
315
+ fs.rmdirSync(innerPath);
14
316
  }
15
317
 
16
- try {
17
- console.log(`🚀 Creating project: ${project}...\n`);
318
+ (async () => {
319
+ const root = path.join(process.cwd(), projectName);
320
+
321
+ if (fs.existsSync(root)) {
322
+ console.error("❌ Directory already exists.");
323
+ process.exit(1);
324
+ }
325
+
326
+ fs.mkdirSync(root);
327
+
328
+ console.log(`\nCreating Seamless project: ${projectName}\n`);
329
+ const API_SERVICE_TOKEN = randomBytes(32).toString("hex");
330
+
331
+ if (AUTH) {
332
+ const dir = path.join(root, "auth");
333
+ fs.mkdirSync(dir);
334
+ console.log("Fetching Seamless Auth OSS...");
335
+ await downloadRepo(REPOS.auth, dir);
336
+
337
+ writeEnv(dir, {
338
+ PORT: authPort,
339
+ NODE_ENV: "development",
340
+
341
+ VERSION: "1.0.0",
342
+ APP_NAME: "Seamless Auth Example",
343
+ APP_ID: "local-dev",
344
+ APP_ORIGIN: `http://localhost:${apiPort}`,
345
+ ISSUER: `http://localhost:${authPort}`,
346
+
347
+ AUTH_MODE: "server",
348
+ DEMO: "true",
349
+
350
+ DEFAULT_ROLES: "user,betaUser",
351
+ AVAILABLE_ROLES: "user,admin,betaUser,team",
352
+
353
+ DATABASE_URL: "postgres://myuser:mypassword@localhost:5432/seamless-auth",
354
+
355
+ ACCESS_TOKEN_TTL: "30m",
356
+ REFRESH_TOKEN_TTL: "1h",
357
+ RATE_LIMIT: "100",
358
+ DELAY_AFTER: "50",
359
+
360
+ API_SERVICE_TOKEN: API_SERVICE_TOKEN,
361
+
362
+ JWKS_ACTIVE_KID: "dev-main",
363
+
364
+ RPID: "localhost",
365
+ ORIGINS: `http://localhost:${apiPort}`,
366
+ });
367
+ }
18
368
 
19
- // Step 1: Clone the starter template
20
- execSync(`npx degit fells-code/seamless-auth-starter-react#main ${project}`, {
21
- stdio: "inherit",
22
- });
369
+ if (API) {
370
+ const dir = path.join(root, "api");
371
+ fs.mkdirSync(dir);
372
+ console.log("Fetching API starter...");
373
+ await downloadRepo(REPOS.api, dir);
23
374
 
24
- // Step 2: Generate HTTPS certs for Vite
25
- console.log(`\n🔒 Generating HTTPS certificates...\n`);
26
- const certDir = path.join(process.cwd(), project, ".cert");
27
- if (!fs.existsSync(certDir)) {
28
- fs.mkdirSync(certDir);
375
+ writeEnv(dir, {
376
+ AUTH_SERVER_URL: `http://localhost:${authPort}`,
377
+ APP_ORIGIN: `http://localhost:${apiPort}`,
378
+ COOKIE_SIGNING_KEY: randomBytes(32).toString("hex"),
379
+ API_SERVICE_TOKEN: API_SERVICE_TOKEN,
380
+ DATABASE_URL: `postgres://myuser:mypassword@localhost:5432/seamless`,
381
+ DB_NAME: "seamless",
382
+ SQL_LOGGING: "false",
383
+ });
384
+ }
385
+
386
+ if (WEB) {
387
+ const dir = path.join(root, "web");
388
+ fs.mkdirSync(dir);
389
+ console.log("Fetching Web starter...");
390
+ await downloadRepo(REPOS.web, dir);
391
+
392
+ writeEnv(dir, {
393
+ VITE_AUTH_SERVER_URL: `http://localhost:${apiPort}`,
394
+ VITE_API_URL: `http://localhost:${apiPort}`,
395
+ PORT: webPort,
396
+ });
397
+ }
398
+
399
+ fs.writeFileSync(path.join(root, "README.md"), GENERATED_README(projectName));
400
+
401
+ if (!skipGit) {
402
+ execSync("git init", { cwd: root });
403
+ }
404
+
405
+ if (AUTH && API && WEB) {
406
+ fs.writeFileSync(
407
+ path.join(root, "Docker-compose.yml"),
408
+ GENERATED_DOCKER_COMPOSE,
409
+ );
29
410
  }
30
- const pems = selfsigned.generate(null, { days: 365, keySize: 2048 });
31
- fs.writeFileSync(path.join(certDir, "cert.pem"), pems.cert);
32
- fs.writeFileSync(path.join(certDir, "key.pem"), pems.private);
33
411
 
34
412
  console.log(`
35
- ✅ Done!
36
- cd ${project}
37
- → npm install
38
- → npm run dev
413
+ ╔════════════════════════════════════════╗
414
+ ║ S E A M L E S S ║
415
+ ╚════════════════════════════════════════╝
39
416
 
40
- 💡 Note: The browser may ask you to trust the certificate the first time.
417
+ Your local auth stack is ready.
418
+
419
+ Start development:
420
+
421
+ cd ${projectName}
422
+
423
+ # terminal 1
424
+ cd auth && npm i && npm run dev
425
+
426
+ # terminal 2
427
+ cd api && npm i && npm run dev
428
+
429
+ # terminal 3
430
+ cd web && npm i && npm run dev
431
+
432
+ Docs: https://docs.seamlessauth.com/docs
433
+ Happy hacking. 🚀
41
434
  `);
42
- } catch (err) {
43
- console.error(`\n❌ Error: ${err.message}`);
44
- cleanUp();
435
+ })().catch((err) => {
436
+ console.error("\n❌ Error:", err.message);
45
437
  process.exit(1);
46
- }
438
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-seamless",
3
- "version": "0.0.2",
4
- "description": "The starter script for Seamless Auth + AI",
3
+ "version": "0.0.4",
4
+ "description": "The starter script for Seamless Auth",
5
5
  "homepage": "https://github.com/fells-code/create-seamless#readme",
6
6
  "bugs": {
7
7
  "url": "https://github.com/fells-code/create-seamless/issues"
@@ -10,10 +10,16 @@
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/fells-code/create-seamless.git"
12
12
  },
13
- "license": "MIT",
14
- "author": "Brandon Corbett <brandon.corbett@fellscode.com>",
13
+ "license": "AGPL-3.0-only",
14
+ "author": "Fells Code, LLC",
15
15
  "type": "module",
16
16
  "main": "index.js",
17
+ "files": [
18
+ "index.js",
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
17
23
  "scripts": {
18
24
  "test": "echo \"Error: no test specified\" && exit 1"
19
25
  },
@@ -21,7 +27,10 @@
21
27
  "create-seamlessauth": "index.js"
22
28
  },
23
29
  "dependencies": {
24
- "degit": "^2.8.4",
25
- "selfsigned": "^3.0.1"
30
+ "adm-zip": "^0.5.16"
31
+ },
32
+ "devDependencies": {
33
+ "@types/adm-zip": "^0.5.7",
34
+ "@types/node": "^24.10.1"
26
35
  }
27
36
  }