Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/management-api/access-tokens.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/management-api/generate-access-token-dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/nextjs-starter-kit/starter-kit-apps.mp4
Binary file not shown.
Binary file modified assets/nextjs-starter-kit/starter-kit.mp4
Binary file not shown.
25 changes: 17 additions & 8 deletions docs/pages/platform/management-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,28 @@ delete icon next to it.

## Access tokens expiry

All Management API access tokens expire after one year from the date of
generation. The expiration date is displayed when you generate a new token, and
you can view it for existing tokens in the Management API tokens list.
All Management API access tokens have an expiration date. When generating a new
token, you can choose from the following expiration options:

- **7 days**: Token expires 7 days from creation
- **30 days**: Token expires 30 days from creation
- **90 days**: Token expires 90 days from creation
- **1 year**: Token expires 1 year from creation (default)
- **Custom date**: Choose a specific expiration date, up to a maximum of 1 year
from today

The expiration date is displayed when you generate a new token, and you can view
it for existing tokens in the Management API tokens list.

When a token expires, you'll need to generate a new token to continue using the
Management API. Make sure to rotate your tokens before they expire to avoid
interruptions in your API access.

<Banner title="Coming soon">
Custom expiration dates will be available in a future update. If you'd like to
provide feedback or have specific scope requirements, please contact
[sales@liveblocks.io](mailto:sales@liveblocks.io).
</Banner>
### Expiration reminders

Liveblocks sends email reminders to team owners before tokens expire. You'll
receive notifications at 7 days and 1 day before expiration, giving you time to
generate replacement tokens and update your integrations.

## Revoking an access token

Expand Down
36 changes: 26 additions & 10 deletions docs/pages/tools/nextjs-starter-kit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Next.js Starter Kit is an open-source template that showcases all aspects of
Liveblocks in a single, modern application.

<Figure>
<video autoPlay loop muted playsInline>
<video height={1080} width={1592} autoPlay loop muted playsInline>
<source src="/assets/nextjs-starter-kit/starter-kit.mp4" type="video/mp4" />
</video>
</Figure>
Expand All @@ -28,10 +28,21 @@ YouTube, or [try the project online](https://nextjs-starter-kit.liveblocks.app).

The Next.js Starter Kit includes the following

- Documents dashboard with pagination, drafts, groups, auto-revalidation
- Collaborative whiteboard app with a fully-featured share menu
- Authentication compatible with GitHub, Google, Auth0, and more
- Document permissions can be scoped to users, groups, and the public
- Documents dashboard with pagination, organizations, auto-revalidation.
- Collaborative apps including a whiteboard, text documents, note editor,
drawing canvas.
- Realtime presence with avatars, cursors, carets.
- Fully-featured share menu with users, organizations, public permissions.
- Authentication compatible with GitHub, Google, Auth0, and more.

<Figure>
<video height={1080} width={1592} autoPlay loop muted playsInline>
<source
src="/assets/nextjs-starter-kit/starter-kit-apps.mp4"
type="video/mp4"
/>
</video>
</Figure>

## Set up the Next.js Starter Kit

Expand Down Expand Up @@ -86,7 +97,7 @@ Vercel.
#### Connect to Liveblocks and retrieve your secret key

If you prefer to work locally, you can tell the installer you would not like to
"deploy to Vercel." After declining the deployment option, the installer will
"deploy to Vercel". After declining the deployment option, the installer will
prompt adding your Liveblocks Key to the application automatically. If you
forwent deployment or indicated that you would like to get your Liveblocks
secret key automatically, the Liveblocks integration page will open in a new
Expand Down Expand Up @@ -149,7 +160,7 @@ up your GitHub secret key and client id.

Almost there! `.env.local` should now contain lines similar to this:

```dotenv file=".env.local"
```env file=".env.local"
GITHUB_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
GITHUB_CLIENT_ID=XXXXXXXXXXXXXXXXXXXX
```
Expand Down Expand Up @@ -191,7 +202,7 @@ up your Auth0 secret key and client information.
`.env.local` should now contain these three lines, along with anything
previously there:

```dotenv file=".env.local"
```env file=".env.local"
AUTH0_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AUTH0_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
AUTH0_ISSUER_BASE_URL=https://XXXXXXXXXXXXXXXXXX.com
Expand Down Expand Up @@ -224,10 +235,10 @@ Navigate there and add your details, for example, if you’re signing in with

```ts file="data/users.ts"
{
id: "yourname@example.com",
id: "your.name@example.com",
name: "Your Name",
avatar: "https://liveblocks.io/avatars/avatar-0.png",
groupIds: ["product", "engineering", "design"],
organizationIds: ["liveblocks", "your.name@example.com"],
},
```

Expand Down Expand Up @@ -266,8 +277,10 @@ lib
primitives
styles
types
utils
auth.ts
auth.config.ts
constants.ts
liveblocks.config.ts
liveblocks.server.config.ts
package.json
Expand Down Expand Up @@ -314,6 +327,8 @@ logic to create and modify documents.
<dd>File that links NextAuth to your database.</dd>
<dt>`/auth.config.ts`</dt>
<dt>File where NextAuth providers are set up.</dt>
<dt>`/constants.ts`</dt>
<dd>Constant strings used in the app, such as URLs and global IDs.</dd>
<dt>`/liveblocks.config.ts`</dt>
<dd>Liveblocks config file.</dd>
<dt>`/liveblocks.server.config.ts`</dt>
Expand Down Expand Up @@ -632,6 +647,7 @@ correct properties:

- [`/lib/database/getGroup.ts`](https://github.com/liveblocks/liveblocks/blob/main/starter-kits/nextjs-starter-kit/lib/database/getGroup.ts)
- [`/lib/database/getGroups.ts`](https://github.com/liveblocks/liveblocks/blob/main/starter-kits/nextjs-starter-kit/lib/database/getGroups.ts)
- [`/lib/database/getOrganization.ts`](https://github.com/liveblocks/liveblocks/blob/main/starter-kits/nextjs-starter-kit/lib/database/getOrganization.ts)
- [`/lib/database/getUser.ts`](https://github.com/liveblocks/liveblocks/blob/main/starter-kits/nextjs-starter-kit/lib/database/getUser.ts)

You can then remove the `/data` folder. Everything else should work as expected.
60 changes: 13 additions & 47 deletions packages/liveblocks-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,56 +16,22 @@
<a href="https://bundlephobia.com/package/@liveblocks/server">
<img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/server?style=flat&label=size&color=09f" alt="Size" />
</a>
<a href="https://github.com/liveblocks/liveblocks/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/liveblocks/liveblocks?style=flat&label=license&color=f80" alt="License" />
<a href="./LICENSE">
<img src="https://img.shields.io/badge/license-AGPL--3.0-f80?style=flat" alt="License" />
</a>
</p>

`@liveblocks/server` provides the APIs to run a Liveblocks server yourself.

## Installation

```
bun install @liveblocks/server
```

## Architecture

```mermaid
classDiagram
Room --> Store : store
Room --> "0+" Session : sessions
Session --> WebSocket

class Room {
+roomId
+load()
+createTicket(version) Ticket
+startBrowserSession(Ticket ticket, WebSocket socket)
+handleRaw(Ticket ticket, data)
+endBrowserSession(Ticket ticket, code, reason)
}

class Store {
+getString(key)
+getNumber(key)
+put(key, value)
}

class Session{
+version
+actor
+nonce
+createdAt
+lastPong
+sendPong()
+sendServerMsg()
}

class WebSocket {
+...
}
```
`@liveblocks/server` provides the core Liveblocks server functionality. It
powers both the Liveblocks production environment, and
[our dev server](https://liveblocks.io/docs/tools/dev-server), so the behavior
is identical. You typically don't need to install or use this package directly.

While `@liveblocks/server` contains the same core technology that powers
Liveblocks, we do not yet offer or recommend self-hosting or on-premises
deployment. The purpose of open sourcing the server package is to provide
transparency, and offer a great local development and testing experience. A
production-ready self-hosted deployment requires additional infrastructure and
expertise that are not yet easy to package.

## License

Expand Down
4 changes: 2 additions & 2 deletions packages/liveblocks-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liveblocks/server",
"version": "1.0.11",
"version": "1.0.12",
"description": "Liveblocks backend server foundation.",
"type": "module",
"main": "./dist/index.js",
Expand Down Expand Up @@ -57,7 +57,7 @@
"dependencies": {
"@liveblocks/core": "3.14.0",
"async-mutex": "^0.4.0",
"decoders": "^2.8.0-1",
"decoders": "^2.8.0",
"itertools": "^2.3.2",
"js-base64": "^3.7.5",
"nanoid": "^3",
Expand Down
36 changes: 32 additions & 4 deletions packages/liveblocks-zenrouter/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
<img src="./assets/zen-router.webp" alt="Zen Router" />

Zen Router is an opinionated router, with batteries included and encouraging
patterns that remain maintable over time as your application grows.
<p align="center">
<a href="https://liveblocks.io#gh-light-mode-only">
<img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-light.svg" alt="Liveblocks" />
</a>
<a href="https://liveblocks.io#gh-dark-mode-only">
<img src="https://raw.githubusercontent.com/liveblocks/liveblocks/main/.github/assets/header-dark.svg" alt="Liveblocks" />
</a>
</p>

# `@liveblocks/zenrouter`

<p>
<a href="https://npmjs.org/package/@liveblocks/zenrouter">
<img src="https://img.shields.io/npm/v/@liveblocks/zenrouter?style=flat&label=npm&color=c33" alt="NPM" />
</a>
<a href="https://bundlephobia.com/package/@liveblocks/zenrouter">
<img src="https://img.shields.io/bundlephobia/minzip/@liveblocks/zenrouter?style=flat&label=size&color=09f" alt="Size" />
</a>
<a href="https://github.com/liveblocks/liveblocks/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/liveblocks/liveblocks?style=flat&label=license&color=f80" alt="License" />
</a>
</p>

Zen Router is an opinionated API router with batteries included, encouraging
patterns that remain maintainable as your application grows.

## Installation

Expand Down Expand Up @@ -102,3 +123,10 @@ Maintainability:
- Default error handling can be configured on a per-status code basis (used when
handlers throw a (custom) HttpError), individual requests can always bypass
this by throwing a custom Response.

## License

Licensed under the Apache License 2.0, Copyright © 2021-present
[Liveblocks](https://liveblocks.io).

See [LICENSE](../../licenses/LICENSE-APACHE-2.0) for more information.
Binary file not shown.
10 changes: 4 additions & 6 deletions packages/liveblocks-zenrouter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@liveblocks/zenrouter",
"version": "1.0.11",
"version": "1.0.12",
"description": "An opinionated router library for building APIs following best practices.",
"type": "module",
"main": "./dist/index.js",
Expand Down Expand Up @@ -38,12 +38,10 @@
"license": "Apache-2.0",
"devDependencies": {
"@liveblocks/eslint-config": "*",
"decoders": "^2.8.0",
"hotscript": "^1.0.13",
"nanoid": "^3"
},
"peerDependencies": {
"@opentelemetry/api": "^1.9.0",
"decoders": "^2.8.0-1"
"nanoid": "^3",
"zod": "^4.1.8"
},
"repository": {
"type": "git",
Expand Down
Loading
Loading