create-seamless 0.0.2 → 0.0.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/.github/workflows/release.yml +40 -0
- package/LICENSE +79 -21
- package/LICENSE.md +26 -0
- package/README.md +107 -50
- package/SECURITY.md +80 -0
- package/index.js +287 -31
- package/package.json +9 -6
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to npm
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Use Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: 20
|
|
23
|
+
registry-url: https://registry.npmjs.org
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm ci
|
|
27
|
+
|
|
28
|
+
- name: Verify tag matches package version
|
|
29
|
+
run: |
|
|
30
|
+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
|
|
31
|
+
PKG_VERSION=$(node -p "require('./package.json').version")
|
|
32
|
+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
|
|
33
|
+
echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
- name: Publish to npm
|
|
38
|
+
run: npm publish
|
|
39
|
+
env:
|
|
40
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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)
|
|
4
4
|
[](https://www.npmjs.com/package/create-seamless)
|
|
5
5
|
|
|
6
|
-
|
|
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
|
-
|
|
8
|
+
It provisions a local, production-shaped development environment that can include:
|
|
10
9
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
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
|
-
|
|
14
|
+
The generated project is fully local and requires no hosted services or external accounts to run.
|
|
21
15
|
|
|
22
|
-
|
|
23
|
-
# Create a new project
|
|
24
|
-
npx create-seamless my-app
|
|
16
|
+
---
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
npm install
|
|
28
|
-
npm run dev
|
|
29
|
-
```
|
|
18
|
+
## What this creates
|
|
30
19
|
|
|
31
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
30
|
+
Each service is independently runnable and preconfigured to work together using local URLs and environment variables.
|
|
40
31
|
|
|
41
|
-
|
|
32
|
+
The intended development workflow is to run each service in its own terminal:
|
|
42
33
|
|
|
43
34
|
```bash
|
|
44
|
-
#
|
|
45
|
-
|
|
35
|
+
# terminal 1
|
|
36
|
+
cd auth && npm run dev
|
|
46
37
|
|
|
47
|
-
#
|
|
48
|
-
|
|
38
|
+
# terminal 2
|
|
39
|
+
cd api && npm run dev
|
|
40
|
+
|
|
41
|
+
# terminal 3
|
|
42
|
+
cd web && npm run dev
|
|
49
43
|
```
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+
---
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
## Usage
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
124
|
+
---
|
|
70
125
|
|
|
71
|
-
|
|
126
|
+
## License
|
|
72
127
|
|
|
73
|
-
|
|
128
|
+
**AGPL-3.0-only** © 2026 Fells Code LLC
|
|
74
129
|
|
|
75
|
-
|
|
130
|
+
This license ensures:
|
|
76
131
|
|
|
77
|
-
|
|
132
|
+
- transparency of security-critical code
|
|
133
|
+
- freedom to self-host and modify
|
|
134
|
+
- sustainability of the managed service offering
|
|
78
135
|
|
|
79
|
-
|
|
136
|
+
See [`LICENSE`](./LICENSE) for details.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
Seamless Auth takes security seriously.
|
|
6
|
+
We appreciate responsible disclosure and will work quickly with researchers and users to investigate and resolve issues.
|
|
7
|
+
|
|
8
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## How to Report
|
|
13
|
+
|
|
14
|
+
If you believe you have found a security vulnerability, please report it privately by emailing:
|
|
15
|
+
|
|
16
|
+
security@seamlessauth.com
|
|
17
|
+
|
|
18
|
+
Include as much detail as possible:
|
|
19
|
+
|
|
20
|
+
- A clear description of the issue
|
|
21
|
+
- Steps to reproduce (proof-of-concept if available)
|
|
22
|
+
- Affected package(s) and version(s)
|
|
23
|
+
- Potential impact (authentication bypass, privilege escalation, data exposure, etc.)
|
|
24
|
+
|
|
25
|
+
Encrypted reports are welcome. If you need a public PGP key, request one in your initial email.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Scope
|
|
30
|
+
|
|
31
|
+
This policy applies to:
|
|
32
|
+
|
|
33
|
+
- @seamless-auth/core
|
|
34
|
+
- @seamless-auth/express
|
|
35
|
+
- @seamless-auth/react
|
|
36
|
+
- Seamless Auth Api
|
|
37
|
+
- Create seamless
|
|
38
|
+
- Official Docker images published under the Seamless Auth organization
|
|
39
|
+
|
|
40
|
+
Third-party dependencies are not covered, but reports identifying vulnerable dependency usage are appreciated.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## What to Expect
|
|
45
|
+
|
|
46
|
+
- **Acknowledgement** within 72 hours
|
|
47
|
+
- **Initial assessment** within 5 business days
|
|
48
|
+
- **Fix or mitigation** as quickly as possible depending on severity
|
|
49
|
+
|
|
50
|
+
We will coordinate disclosure timing with you if a fix requires public communication.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Supported Versions
|
|
55
|
+
|
|
56
|
+
Security fixes are applied to:
|
|
57
|
+
|
|
58
|
+
- The latest published version
|
|
59
|
+
- The current development branch
|
|
60
|
+
|
|
61
|
+
Older versions may not receive patches unless the issue is critical.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Responsible Disclosure
|
|
66
|
+
|
|
67
|
+
We kindly ask that you:
|
|
68
|
+
|
|
69
|
+
- Allow reasonable time to investigate and remediate
|
|
70
|
+
- Avoid exploiting vulnerabilities beyond proof-of-concept
|
|
71
|
+
- Avoid public disclosure until a fix is released or coordinated
|
|
72
|
+
|
|
73
|
+
We believe responsible disclosure helps keep the ecosystem safer for everyone.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
Thank you for helping keep Seamless Auth secure.
|
|
78
|
+
|
|
79
|
+
— Fells Code, LLC
|
|
80
|
+
https://seamlessauth.com
|
package/index.js
CHANGED
|
@@ -1,46 +1,302 @@
|
|
|
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
|
|
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
|
+
if (nodeMajor < MIN_NODE_MAJOR) {
|
|
17
|
+
console.error(`
|
|
18
|
+
❌ Seamless requires Node ${MIN_NODE_MAJOR}+.
|
|
19
|
+
You are running Node ${process.versions.node}
|
|
20
|
+
|
|
21
|
+
Upgrade at https://nodejs.org
|
|
22
|
+
`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const args = process.argv.slice(2);
|
|
27
|
+
const projectName = args.find((a) => !a.startsWith("--")) ?? "seamless-app";
|
|
28
|
+
|
|
29
|
+
const hasFlag = (flag) => args.includes(`--${flag}`);
|
|
30
|
+
const getFlag = (flag, fallback) => {
|
|
31
|
+
const i = args.indexOf(`--${flag}`);
|
|
32
|
+
return i !== -1 ? args[i + 1] : fallback;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const includeAuth = hasFlag("auth");
|
|
36
|
+
const includeWeb = hasFlag("web");
|
|
37
|
+
const includeApi = hasFlag("api");
|
|
38
|
+
const installDeps = hasFlag("install");
|
|
39
|
+
const skipGit = hasFlag("no-git");
|
|
40
|
+
|
|
41
|
+
const authPort = getFlag("auth-port", "5312");
|
|
42
|
+
const apiPort = getFlag("api-port", "3000");
|
|
43
|
+
const webPort = getFlag("web-port", "5173");
|
|
44
|
+
|
|
45
|
+
const wantsSomething = includeAuth || includeWeb || includeApi;
|
|
46
|
+
const AUTH = wantsSomething ? includeAuth : true;
|
|
47
|
+
const WEB = wantsSomething ? includeWeb : true;
|
|
48
|
+
const API = wantsSomething ? includeApi : true;
|
|
49
|
+
|
|
50
|
+
const REPOS = {
|
|
51
|
+
auth: "fells-code/seamless-auth-api",
|
|
52
|
+
web: "fells-code/seamless-auth-starter-react",
|
|
53
|
+
api: "fells-code/seamless-auth-starter-express",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const GENERATED_README = (projectName) => `# ${projectName}
|
|
57
|
+
|
|
58
|
+
This project was generated with \`create-seamless\` and provides a fully local,
|
|
59
|
+
open source authentication stack built on **Seamless Auth**.
|
|
60
|
+
|
|
61
|
+
It is designed for development environments where you want:
|
|
62
|
+
|
|
63
|
+
- Passwordless authentication
|
|
64
|
+
- No hosted dependencies
|
|
65
|
+
- No redirects or third-party auth services
|
|
66
|
+
- A production-shaped local setup
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Project layout
|
|
71
|
+
|
|
72
|
+
\`\`\`text
|
|
73
|
+
.
|
|
74
|
+
├─ auth/ # Seamless Auth open source server
|
|
75
|
+
├─ api/ # Backend API server (optional)
|
|
76
|
+
├─ web/ # Frontend web application (optional)
|
|
77
|
+
└─ README.md
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Running the stack
|
|
83
|
+
|
|
84
|
+
Open separate terminals and run each service independently.
|
|
85
|
+
|
|
86
|
+
### Auth server
|
|
87
|
+
|
|
88
|
+
\`\`\`bash
|
|
89
|
+
cd auth
|
|
90
|
+
npm run dev
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
Default port: \`3000\`
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### API server
|
|
98
|
+
|
|
99
|
+
\`\`\`bash
|
|
100
|
+
cd api
|
|
101
|
+
npm run dev
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
Default port: \`4000\`
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### Web application
|
|
109
|
+
|
|
110
|
+
\`\`\`bash
|
|
111
|
+
cd web
|
|
112
|
+
npm run dev
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
Default port: \`5173\`
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
Full Seamless Auth documentation:
|
|
122
|
+
|
|
123
|
+
https://seamlessauth.com/docs
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Included open source projects
|
|
6
128
|
|
|
7
|
-
|
|
129
|
+
- Seamless Auth Server
|
|
130
|
+
https://github.com/fells-code/seamless-auth-server
|
|
8
131
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
132
|
+
- Seamless Auth React Starter
|
|
133
|
+
https://github.com/fells-code/seamless-auth-starter-react
|
|
134
|
+
|
|
135
|
+
- Seamless Auth API Starter
|
|
136
|
+
https://github.com/fells-code/seamless-auth-starter-express
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
This generated project inherits the licenses of the open source components it
|
|
143
|
+
includes.
|
|
144
|
+
|
|
145
|
+
Review each subproject for its specific license before deploying to production.
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
function writeEnv(dir, values) {
|
|
149
|
+
const env = Object.entries(values)
|
|
150
|
+
.map(([k, v]) => `${k}=${v}`)
|
|
151
|
+
.join("\n");
|
|
152
|
+
fs.writeFileSync(path.join(dir, ".env"), env + "\n");
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
async function downloadRepo(repo, dest) {
|
|
156
|
+
const url = `https://codeload.github.com/${repo}/zip/refs/heads/main`;
|
|
157
|
+
const res = await fetch(url);
|
|
158
|
+
if (!res.ok || !res.body) {
|
|
159
|
+
throw new Error(`Failed to download ${repo}`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const zipPath = path.join(dest, "_repo.zip");
|
|
163
|
+
await streamPipeline(res.body, createWriteStream(zipPath));
|
|
164
|
+
|
|
165
|
+
const zip = new AdmZip(zipPath);
|
|
166
|
+
zip.extractAllTo(dest, true);
|
|
167
|
+
fs.unlinkSync(zipPath);
|
|
168
|
+
|
|
169
|
+
const inner = fs.readdirSync(dest).find((f) => f.endsWith("-main"));
|
|
170
|
+
if (!inner) throw new Error("Unexpected repo structure");
|
|
171
|
+
|
|
172
|
+
const innerPath = path.join(dest, inner);
|
|
173
|
+
for (const file of fs.readdirSync(innerPath)) {
|
|
174
|
+
fs.renameSync(path.join(innerPath, file), path.join(dest, file));
|
|
13
175
|
}
|
|
176
|
+
fs.rmdirSync(innerPath);
|
|
14
177
|
}
|
|
15
178
|
|
|
16
|
-
|
|
17
|
-
|
|
179
|
+
(async () => {
|
|
180
|
+
const root = path.join(process.cwd(), projectName);
|
|
181
|
+
|
|
182
|
+
if (fs.existsSync(root)) {
|
|
183
|
+
console.error("❌ Directory already exists.");
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
fs.mkdirSync(root);
|
|
188
|
+
|
|
189
|
+
console.log(`\nCreating Seamless project: ${projectName}\n`);
|
|
190
|
+
const API_SERVICE_TOKEN = randomBytes(32).toString("hex");
|
|
191
|
+
|
|
192
|
+
if (AUTH) {
|
|
193
|
+
const dir = path.join(root, "auth");
|
|
194
|
+
fs.mkdirSync(dir);
|
|
195
|
+
console.log("Fetching Seamless Auth OSS...");
|
|
196
|
+
await downloadRepo(REPOS.auth, dir);
|
|
197
|
+
|
|
198
|
+
writeEnv(dir, {
|
|
199
|
+
PORT: authPort,
|
|
200
|
+
NODE_ENV: "development",
|
|
201
|
+
|
|
202
|
+
VERSION: "1.0.0",
|
|
203
|
+
APP_NAME: "Seamless Auth Example",
|
|
204
|
+
APP_ID: "local-dev",
|
|
205
|
+
APP_ORIGIN: "http://localhost:3000",
|
|
206
|
+
ISSUER: "http://localhost:5312",
|
|
207
|
+
|
|
208
|
+
AUTH_MODE: "server",
|
|
209
|
+
DEMO: "true",
|
|
210
|
+
|
|
211
|
+
DEFAULT_ROLES: "user,betaUser",
|
|
212
|
+
AVAILABLE_ROLES: "user,admin,betaUser,team",
|
|
18
213
|
|
|
19
|
-
|
|
20
|
-
execSync(`npx degit fells-code/seamless-auth-starter-react#main ${project}`, {
|
|
21
|
-
stdio: "inherit",
|
|
22
|
-
});
|
|
214
|
+
DATABASE_URL: "postgres://myuser:mypassword@localhost:5432/seamless-auth",
|
|
23
215
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
216
|
+
ACCESS_TOKEN_TTL: "30m",
|
|
217
|
+
REFRESH_TOKEN_TTL: "1h",
|
|
218
|
+
RATE_LIMIT: "100",
|
|
219
|
+
DELAY_AFTER: "50",
|
|
220
|
+
|
|
221
|
+
API_SERVICE_TOKEN: API_SERVICE_TOKEN,
|
|
222
|
+
|
|
223
|
+
JWKS_ACTIVE_KID: "dev-main",
|
|
224
|
+
|
|
225
|
+
RPID: "localhost",
|
|
226
|
+
ORIGINS: "http://localhost:3000",
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (API) {
|
|
231
|
+
const dir = path.join(root, "api");
|
|
232
|
+
fs.mkdirSync(dir);
|
|
233
|
+
console.log("Fetching API starter...");
|
|
234
|
+
await downloadRepo(REPOS.api, dir);
|
|
235
|
+
|
|
236
|
+
writeEnv(dir, {
|
|
237
|
+
AUTH_SERVER_URL: `http://localhost${authPort}`,
|
|
238
|
+
APP_ORIGIN: `http://localhost:${apiPort}`,
|
|
239
|
+
COOKIE_SIGNING_KEY: randomBytes(32).toString("hex"),
|
|
240
|
+
API_SERVICE_TOKEN: API_SERVICE_TOKEN,
|
|
241
|
+
DATABASE_URL: `postgres://myuser:mypassword@localhost:5432/seamless`,
|
|
242
|
+
DB_NAME: "seamless",
|
|
243
|
+
SQL_LOGGING: "false",
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (WEB) {
|
|
248
|
+
const dir = path.join(root, "web");
|
|
249
|
+
fs.mkdirSync(dir);
|
|
250
|
+
console.log("Fetching Web starter...");
|
|
251
|
+
await downloadRepo(REPOS.web, dir);
|
|
252
|
+
|
|
253
|
+
writeEnv(dir, {
|
|
254
|
+
VITE_AUTH_SERVER_URL: `http://localhost:${apiPort}`,
|
|
255
|
+
VITE_API_URL: `http://localhost:${apiPort}`,
|
|
256
|
+
PORT: webPort,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
fs.writeFileSync(path.join(root, "README.md"), GENERATED_README(projectName));
|
|
261
|
+
|
|
262
|
+
if (!skipGit) {
|
|
263
|
+
execSync("git init", { cwd: root });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (installDeps) {
|
|
267
|
+
for (const dir of ["auth", "api", "web"]) {
|
|
268
|
+
const full = path.join(root, dir);
|
|
269
|
+
if (fs.existsSync(full)) {
|
|
270
|
+
console.log(`Installing deps in ${dir}...`);
|
|
271
|
+
execSync("npm install", { cwd: full, stdio: "inherit" });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
29
274
|
}
|
|
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
275
|
|
|
34
276
|
console.log(`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
277
|
+
╔════════════════════════════════════════╗
|
|
278
|
+
║ S E A M L E S S ║
|
|
279
|
+
╚════════════════════════════════════════╝
|
|
280
|
+
|
|
281
|
+
Your local auth stack is ready.
|
|
282
|
+
|
|
283
|
+
Start development:
|
|
39
284
|
|
|
40
|
-
|
|
285
|
+
cd ${projectName}
|
|
286
|
+
|
|
287
|
+
# terminal 1
|
|
288
|
+
cd auth && npm i && npm run dev
|
|
289
|
+
|
|
290
|
+
# terminal 2
|
|
291
|
+
cd api && npm i && npm run dev
|
|
292
|
+
|
|
293
|
+
# terminal 3
|
|
294
|
+
cd web && npm i && npm run dev
|
|
295
|
+
|
|
296
|
+
Docs: https://docs.seamlessauth.com/docs
|
|
297
|
+
Happy hacking. 🚀
|
|
41
298
|
`);
|
|
42
|
-
}
|
|
43
|
-
console.error(
|
|
44
|
-
cleanUp();
|
|
299
|
+
})().catch((err) => {
|
|
300
|
+
console.error("\n❌ Error:", err.message);
|
|
45
301
|
process.exit(1);
|
|
46
|
-
}
|
|
302
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-seamless",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "The starter script for Seamless Auth
|
|
3
|
+
"version": "0.0.3",
|
|
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,8 +10,8 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/fells-code/create-seamless.git"
|
|
12
12
|
},
|
|
13
|
-
"license": "
|
|
14
|
-
"author": "
|
|
13
|
+
"license": "AGPL-3.0-only",
|
|
14
|
+
"author": "Fells Code, LLC",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"scripts": {
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"create-seamlessauth": "index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
|
|
24
|
+
"adm-zip": "^0.5.16"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/adm-zip": "^0.5.7",
|
|
28
|
+
"@types/node": "^24.10.1"
|
|
26
29
|
}
|
|
27
30
|
}
|