npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@edge-base/ssr

v0.2.6

Published

EdgeBase SSR helpers — cookie-based token management for server-side rendering

Downloads

1,267

Readme


@edge-base/ssr is the package you use when server-side code should run as the current signed-in user via cookies.

It is built for:

  • Server Components
  • Route Handlers
  • loaders and actions
  • SSR middleware and request handlers
  • cookie-based session transfer between server and browser code

If you are writing browser code, use @edge-base/web. If you need privileged admin access from the server, use @edge-base/admin.

EdgeBase is the open-source edge-native BaaS that runs on Edge, Docker, and Node.js.

This package is one part of the wider EdgeBase platform. For the full platform, CLI, Admin Dashboard, server runtime, docs, and all public SDKs, see the main repository: edge-base/edgebase.

Beta: the package is already usable, but some APIs may still evolve before general availability.

Documentation Map

For AI Coding Assistants

This package ships with an llms.txt file for AI-assisted SSR integration.

You can find it:

  • after install: node_modules/@edge-base/ssr/llms.txt
  • in the repository: llms.txt

Use it when you want an agent to:

  • set up a cookie adapter correctly
  • keep browser auth code out of server components
  • avoid mixing ssr, web, and admin
  • use getUser(), getSession(), setSession(), and clearSession() correctly

Installation

npm install @edge-base/ssr

Most SSR apps also use the browser SDK alongside it:

npm install @edge-base/web @edge-base/ssr

Quick Start

import { createServerClient } from '@edge-base/ssr';
import { cookies } from 'next/headers';

export async function createEdgeBaseServer() {
  const cookieStore = await cookies();

  return createServerClient(process.env.EDGEBASE_URL!, {
    cookies: {
      get: (name) => cookieStore.get(name)?.value,
      set: (name, value, options) => {
        try {
          cookieStore.set(name, value, options);
        } catch {
          // read-only contexts such as some Server Components
        }
      },
      delete: (name) => {
        try {
          cookieStore.delete(name);
        } catch {
          // read-only contexts such as some Server Components
        }
      },
    },
  });
}

Then use it inside a server-side request flow:

const client = await createEdgeBaseServer();
const user = client.getUser();

if (user) {
  const posts = await client.db('app').table('posts').getList();
  console.log(posts.items);
}

What This Package Includes

| Surface | Included | | --- | --- | | Cookie-backed session tokens | Yes | | Request-bound user context | Yes | | db(namespace, id?) | Yes | | storage and functions | Yes | | Client-side sign-in UI | No | | Database live subscriptions | No | | Rooms / push / browser auth flows | No | | Service Key admin user management | No |

Cookie Store Contract

createServerClient() expects a cookie adapter with:

  • get(name)
  • set(name, value, options?)
  • delete(name)

That makes it easy to adapt to framework-specific cookie stores while keeping one EdgeBase interface.

OAuth And Session Transfer

On the server, @edge-base/ssr is especially useful for:

  • reading the current session from cookies
  • writing tokens after a server-side OAuth callback
  • clearing session cookies during server-side sign out

Example:

client.setSession({
  accessToken,
  refreshToken,
});

const session = client.getSession();
console.log(session.accessToken);

Choose The Right Package

| Package | Use it for | | --- | --- | | @edge-base/web | Browser components and client-side auth flows | | @edge-base/ssr | Server-side code acting as the current signed-in user via cookies | | @edge-base/admin | Trusted server-side code with Service Key access |

License

MIT