@squadbase/nextjs 0.0.1-beta.5 → 0.0.1

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 (2) hide show
  1. package/README.md +75 -0
  2. package/package.json +4 -5
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # @squadbase/nextjs
2
+
3
+ Next.js SDK for Squadbase - A package for handling server-side operations in Squadbase applications with Next.js.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @squadbase/nextjs
9
+ # or
10
+ yarn add @squadbase/nextjs
11
+ # or
12
+ pnpm add @squadbase/nextjs
13
+ ```
14
+
15
+ ## Features
16
+
17
+ ### User Session
18
+
19
+ ```typescript
20
+ import { createNextjsServerClient } from "@squadbase/nextjs";
21
+
22
+ // In your Next.js server component or API route
23
+ const client = createNextjsServerClient({
24
+ projectId: "your-project-id",
25
+ });
26
+
27
+ // Get the current authenticated user
28
+ const user = await client.getUser();
29
+ console.log(user);
30
+ // {
31
+ // username: string,
32
+ // email: string,
33
+ // firstName: string,
34
+ // lastName: string,
35
+ // iconUrl: string | null,
36
+ // roles: string[]
37
+ // }
38
+ ```
39
+
40
+ ### Local Development
41
+
42
+ For local development, you can provide a mock user:
43
+
44
+ ```typescript
45
+ const client = createNextjsServerClient({
46
+ projectId: "your-project-id",
47
+ mockUser: {
48
+ username: "test-user",
49
+ email: "test@example.com",
50
+ firstName: "Test",
51
+ lastName: "User",
52
+ iconUrl: null,
53
+ roles: ["user"],
54
+ },
55
+ });
56
+ ```
57
+
58
+ ## API Reference
59
+
60
+ ### `createNextjsServerClient(options: NextjsServerClientOptions)`
61
+
62
+ Creates a new Next.js server client instance. This is a wrapper around `createServerClient` that automatically handles cookie management using Next.js's `cookies()` API.
63
+
64
+ #### Options
65
+
66
+ - `projectId` (string): Your Squadbase project ID
67
+ - `mockUser` (optional): Mock user object for local development
68
+
69
+ ### `ServerClient`
70
+
71
+ This package re-exports all types and interfaces from `@squadbase/server`. See the [@squadbase/server documentation](../server/README.md) for more details.
72
+
73
+ ## License
74
+
75
+ MIT
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@squadbase/nextjs",
3
- "version": "0.0.1-beta.5",
4
- "description": "Next.js SDK for Squadbase",
3
+ "version": "0.0.1",
5
4
  "type": "module",
6
5
  "main": "index.js",
7
6
  "files": [
@@ -23,10 +22,10 @@
23
22
  "access": "public"
24
23
  },
25
24
  "keywords": [],
26
- "author": "Atsuki Hasegawa",
27
- "license": "ISC",
25
+ "author": "Squadbase",
26
+ "license": "MIT",
28
27
  "dependencies": {
29
- "@squadbase/server": "^0.0.1-beta.5"
28
+ "@squadbase/server": "^0.0.1"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@types/node": "^22.14.1",