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

@light-auth/tanstack-react-start

v0.3.5

Published

light auth framework for tanstack start, using arctic

Downloads

11

Readme

Light Auth

Light Auth is a lightweight authentication solution designed for simplicity and ease of integration.

It provides essential authentication features with minimal configuration, making it ideal for small projects, prototypes, or applications that require straightforward user sign-in functionality.

Features

  • Simple setup and configuration
  • Supports basic authentication flows
  • Minimal dependencies
  • Easily extensible for custom requirements
  • Server side an Client side components

Framework Compatibility

Light Auth shines across your favorite frameworks! Whether you’re building with

| Framework | NPM Package | GitHub Sample | |-----------------------------------------------|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | NextJS Next.js | light-auth-nextjs | Next.js Sample | | Astro Astro | light-auth-astro | Astro Sample | | Nuxt Nuxt | light-auth-nuxt | Nuxt Sample | | SvelteKit SvelteKit | light-auth-sveltekit | SvelteKit Sample | | Express Express | light-auth-express | Express Sample | | Tanstack Start Tanstack Start | light-auth-tanstack-react-start | Tanstack Start Sample |

Light Auth integrates seamlessly, letting you add authentication with a sparkle ✨ to any stack!

Getting Started

This getting started is based on the @light-auth/tanstack-react-start package.

You will find examples for all others frameworks in each relevant repository

The Light Auth documentation has also a lot of code examples for various scenario.

1) Install Light Auth

npm -i @light-auth/tanstack-react-start

2) Configure vite

// file: "./vite.config.ts"

export default defineConfig({
  ...,
  ...,
  ssr: {
    noExternal: ['@light-auth/tanstack-react-start'],
  },
})

3) Configure Light Auth

// file: "./lib/auth.ts"

import { Google, Github } from "arctic";
import { CreateLightAuth } from "@light-auth/nextjs";

const googleProvider = {
  providerName: "google",
  arctic: new Google(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, REDIRECT),
};

const githubProvider = {
  providerName: "github",
  arctic: new GitHub(GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, REDIRECT)
};

export const { providers, handlers, signIn, signOut, getAuthSession, getUser } = CreateLightAuth({
  providers: [googleProvider, githubProvider]

4) Add Light Auth Handlers

// file: "./routes/api/auth/$.tsx"

import { createServerFileRoute } from '@tanstack/react-start/server';
import { handlers } from "@/lib/auth";
export const ServerRoute = createServerFileRoute('/api/auth/$').methods(handlers)

5) Add login page

// file: "./routes/login.tsx"

import { createFileRoute } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/react-start';
import { signIn } from '@/lib/auth';

export const Route = createFileRoute('/login')({
  component: RouteComponent,
})

export const actionSignIn = createServerFn().handler(() => signIn("google", "/profile"));


function RouteComponent() {
  return (
    <div>
      <form action={actionSignIn.url} method="POST">
        <button type="submit">login using a form action</button>
      </form>
    </div>
  );
}

6) Use Light Auth

// file: "./routes/profile.tsx"

import { createFileRoute, Link } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/react-start';
import { getAuthSession as laGetAuthSession } from "@/lib/auth";

const getAuthSession = createServerFn({
  method: 'GET',
}).handler(() => {
  return laGetAuthSession()
})

export const Route = createFileRoute('/profile')({
  component: RouteComponent,
  loader: async () => {
    const session = await getAuthSession();
    return { session };
  },
})

function RouteComponent() {
  const state = Route.useLoaderData()
  const session = state.session;
  
  return (
    <div>
      {session != null ? (
        <div>
          <p>✅ You are logged in!</p>
          <div>Session Email: {session.email}</div>
          <div>Session Provider: {session.providerName}</div>
        </div>
      ) : (
        <div>
          <p>⚠️ You are not logged in</p>
          <a href="/login"> Go to Login Page </a>
        </div>
      )}
    </div>
  );
}

Contributing

Contributions are welcome! Please open issues or submit pull requests to help improve Light Auth.

License

This project is licensed under the MIT License.