SimpleAuth
React

React integration

Scaffold SimpleAuth hooks and UI into your React or Next.js project with the @simpleauthjs/react CLI.

@simpleauthjs/react is a command-line tool that copies auth primitives (a provider, client helper, hooks, forms, and modals) into your repository. It is not a runtime UI library: your application code imports the generated files under components/simpleauth/, not the npm package.

Why this pattern

  • You own the source code and can change every line.
  • You can adapt styling and behaviour to your product without waiting on library releases.
  • There is no runtime dependency on a private component implementation.
  • The workflow matches tools like shadcn/ui: copy, then customize.

What the CLI scaffolds

OutputDescription
SimpleAuthProviderReact context wiring for the browser client.
Client helpergetSimpleAuthClient() reading public env vars.
SignInForm / SignUpFormEmail and password forms wired to hooks.
SignInModal / SignUpModalAccessible modal shells around the forms.
HooksuseCurrentUser, useSignIn, useSignUp, and useSimpleAuthClient.

Requirements

  • React 18 or newer.
  • TypeScript is recommended for the generated files.
  • Next.js or Vite is supported out of the box. Other bundlers work as long as environment variables are statically inlined the same way.

On this page