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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@supertokens-plugins/profile-base-react

v0.1.0

Published

Profile Base Plugin for SuperTokens

Readme

SuperTokens Plugin Profile Base

Create a comprehensive user profile interface for your SuperTokens React application. This plugin provides a foundational profile page with a sectioned layout that other profile-related plugins can extend and customize.

Installation

npm install @supertokens-plugins/profile-base-react

Quick Start

Frontend Configuration

Initialize the plugin in your SuperTokens frontend configuration:

import SuperTokens from "supertokens-auth-react";
import ProfileBasePlugin from "@supertokens-plugins/profile-base-react";

SuperTokens.init({
  appInfo: {
    // your app info
  },
  recipeList: [
    // your recipes
  ],
  experimental: {
    plugins: [
      ProfileBasePlugin.init({
        profilePagePath: "/user/profile", // Optional: defaults to "/user/profile"
        sections: [
          // Optional: initial sections
          {
            id: "basic-info",
            title: "Basic Information",
            component: () => <div>Basic user information goes here</div>,
          },
        ],
      }),
    ],
  },
});

Profile Interface

The plugin provides a complete user profile interface accessible at /user/profile (configurable). This page includes:

  • Session Protection: Automatically protected with SessionAuth
  • Sectioned Layout: Clean sidebar navigation with content area
  • Hash-Based Navigation: URL hash navigation for direct section linking
  • Extensible Architecture: Other plugins can register additional sections

Configuration Options

| Option | Type | Default | Description | | ----------------- | ----------------------------------- | ----------------- | ------------------------------------- | | profilePagePath | string | "/user/profile" | Path where the profile page is served | | sections | SuperTokensPluginProfileSection[] | [] | Initial profile sections to display |

Section Structure

Each profile section follows this structure:

type SuperTokensPluginProfileSection = {
  id: string; // Unique identifier
  title: string; // Display name in sidebar
  order: number; // Display order (auto-assigned if not provided)
  icon?: () => React.JSX.Element; // Optional sidebar icon
  component: () => React.JSX.Element; // Section content component
};

Hooks and Utilities

usePluginContext Hook

Access plugin functionality and register new sections:

import { usePluginContext } from "@supertokens-plugins/profile-base-react";

function MyProfileComponent() {
  const { getSections, registerSection, pluginConfig, t } = usePluginContext();

  const currentSections = getSections();

  // Register a new section dynamically
  const addCustomSection = async () => {
    await registerSection(async () => ({
      id: "custom-section",
      title: "Custom Settings",
      icon: () => <SettingsIcon />,
      component: () => <CustomSettingsComponent />,
    }));
  };

  return (
    <div>
      <h2>Profile Management</h2>
      <p>Current sections: {currentSections.length}</p>
      <button onClick={addCustomSection}>Add Custom Section</button>
    </div>
  );
}

Profile Components

UserProfileWrapper

Use the profile wrapper in your own components:

import { UserProfileWrapper } from "@supertokens-plugins/profile-base-react";
import { ThemeProvider } from "@shared/ui";

function CustomProfilePage() {
  return (
    <ThemeProvider>
      <div className="my-custom-layout">
        <header>My App Header</header>
        <main>
          <UserProfileWrapper />
        </main>
      </div>
    </ThemeProvider>
  );
}