@nulvless/nulvless-js 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 Nulvless
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.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # @nulvless/nulvless-js
2
+
3
+ The official JavaScript SDK for [Nulvless](https://nulvless.com) — authentication, authorization and communications for the browser and the server.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@nulvless/nulvless-js)](https://www.npmjs.com/package/@nulvless/nulvless-js)
6
+ [![CI](https://github.com/nulvless/nulvless-js/actions/workflows/ci.yml/badge.svg)](https://github.com/nulvless/nulvless-js/actions/workflows/ci.yml)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
8
+
9
+ [Documentation](https://nulvless.com/docs/sdk) · [Quickstart](https://nulvless.com/docs/quickstart) · [Changelog](./CHANGELOG.md)
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @nulvless/nulvless-js
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ ### Browser
20
+
21
+ Create the client with your project URL and publishable key. The session is stored and renewed for you.
22
+
23
+ ```ts
24
+ import { createClient } from '@nulvless/nulvless-js'
25
+
26
+ const nulvless = createClient('https://<project>.nulvless.co', 'pk-…')
27
+
28
+ const { data, error } = await nulvless.auth.signIn({
29
+ email: 'ada@example.com',
30
+ password: 'correct horse battery staple',
31
+ })
32
+
33
+ if (error) {
34
+ console.error(error.code, error.message)
35
+ } else if (data.challenge) {
36
+ // a second factor is required — see auth.challenges
37
+ }
38
+ ```
39
+
40
+ ### Server
41
+
42
+ Use the secret key on the server only, and forward the user's request headers on calls made on their behalf.
43
+
44
+ ```ts
45
+ import { createServerClient, forwardUserHeaders } from '@nulvless/nulvless-js'
46
+
47
+ const nulvless = createServerClient('https://<project>.nulvless.co', process.env.NULVLESS_SECRET!)
48
+
49
+ export async function GET(request: Request) {
50
+ const { data, error } = await nulvless.auth.verify(
51
+ { resource: 'acme', scopes: ['members:read'] },
52
+ { headers: forwardUserHeaders(request) },
53
+ )
54
+
55
+ return error ? new Response(null, { status: error.status_code }) : Response.json(data)
56
+ }
57
+ ```
58
+
59
+ Every method returns `{ data, error }` instead of throwing — see [Error handling](https://nulvless.com/docs/sdk/errors).
60
+
61
+ ## What's included
62
+
63
+ - **Authentication** — password, one-time codes, social sign-in, ID tokens, MFA and sudo. [Docs](https://nulvless.com/docs/sdk/auth)
64
+ - **Sessions** — storage, automatic renewal coordinated across tabs, multi-account and auth events. [Docs](https://nulvless.com/docs/sdk/session-manager)
65
+ - **Users and security** — profile, identities, credential and password changes. [Docs](https://nulvless.com/docs/sdk/users)
66
+ - **Authorization** — roles, grants and invitations. [Docs](https://nulvless.com/docs/guides/authorization/rbac)
67
+ - **OAuth 2.1 / OpenID Connect provider** — let third-party apps sign in with your project. [Docs](https://nulvless.com/docs/sdk/oauth)
68
+ - **Administration** — users, roles and OAuth apps from your backend. [Docs](https://nulvless.com/docs/sdk/admin)
69
+ - **Communications** — transactional email and SMS from templates. [Docs](https://nulvless.com/docs/sdk/comms)
70
+
71
+ Framework guides: [Next.js](https://nulvless.com/docs/frameworks/nextjs) · [React](https://nulvless.com/docs/frameworks/react) · [Vue](https://nulvless.com/docs/frameworks/vue) · [Angular](https://nulvless.com/docs/frameworks/angular) · [Node.js](https://nulvless.com/docs/frameworks/node) · [Express](https://nulvless.com/docs/frameworks/express) · [Fastify](https://nulvless.com/docs/frameworks/fastify) · [NestJS](https://nulvless.com/docs/nestjs)
72
+
73
+ ## Requirements
74
+
75
+ Any runtime with a global `fetch`:
76
+
77
+ - Node.js 18 or later
78
+ - Modern browsers
79
+ - Deno, Bun, Cloudflare Workers and Vercel Edge
80
+
81
+ TypeScript types are included; no `@types` package is needed. The package ships both ESM and CommonJS builds.
82
+
83
+ ## Versioning
84
+
85
+ The SDK follows [Semantic Versioning](https://semver.org). While it is in `0.x`, a minor release (`0.2.0`) may contain breaking changes and a patch release (`0.1.1`) never does. Every change is listed in the [changelog](./CHANGELOG.md).
86
+
87
+ ## Contributing
88
+
89
+ Issues and pull requests are welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to set up the project and run the checks.
90
+
91
+ ## Security
92
+
93
+ Please do not open public issues for vulnerabilities. See [SECURITY.md](./SECURITY.md) for how to report them.
94
+
95
+ ## License
96
+
97
+ [MIT](./LICENSE)