Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Better Auth · Const

signUp

signUp exposes the client’s email-registration method as authClient.signUp.email. It creates a user from the supplied name, email, password, and optional image, then signs the user in automatically by default.

How it works

The client’s signUp.email method sends the user’s registration details to Better Auth’s email sign-up endpoint. A successful registration signs the user in automatically unless autoSignIn is set to false; the call returns either data or an error.

Syntax

const { data, error } = await authClient.signUp.email({ email, password, name, image, autoSignIn });

Parameters

NameTypeDescription
emailstringThe user's email address.
passwordstringThe user's password; at least 8 characters and at most 128 by default.
namestringThe user's display name.
imagestringOptional URL for the user's image.
autoSignInbooleanOptional flag controlling automatic sign-in after successful registration.

Returns

An object containing data and error; successful registration returns sign-up data, while failures are represented by error.

Key points

  • Call authClient.signUp.email to create an account through the client API.
  • The email identifies the account being created.
  • The password is required and has a default minimum length of eight characters.
  • The name becomes the user’s display name.
  • An image URL may be included to set the user’s profile image.
  • Set autoSignIn: false when registration should not establish a signed-in session.

Common mistakes

  • Registration normally creates a session immediately; disable that behavior explicitly when needed.
  • Use a password between 8 and 128 characters unless your configuration changes those limits.

Example: Register with email and password

import { createAuthClient } from "better-auth/client";

const authClient = createAuthClient();

const { data, error } = await authClient.signUp.email({
  name: "Ada Lovelace",
  email: "ada@example.com",
  password: "correct-horse-battery-staple",
});

if (error) console.error(error);
else console.log(data);

Creates a client and submits the required name, email, and password to register a user.

When to use it

Standard email registration

A new user submits an email, password, and display name through a registration form.

Registration with a profile image

An application needs to collect a profile picture during account creation.

Registration without automatic sign-in

A flow requires a separate login step after account creation.

Interview questions

QHow do you register a user with Better Auth?

Use the client method authClient.signUp.email with the user’s name, email, and password. It corresponds to the POST /sign-up/email endpoint.

Follow-up: What happens after success? The user is automatically signed in by default, but setting autoSignIn to false disables that behavior.

QWhich fields does email sign-up accept?

The email, password, and name fields are required in the documented example. An image can also be supplied as an optional profile image.

Follow-up: What password constraint should be considered? The default minimum is 8 characters and the maximum is 128.

QHow should a caller handle the result?

The method returns an object that can be destructured into data and error. Application code should check error before using the returned data.

Follow-up: Which server endpoint handles the operation? Better Auth documents POST /sign-up/email for this client method.

  • signIn.email
  • signOut
  • emailAndPassword.enabled
  • authClient

Source: Basic Usage | Better Auth. Checked 2026-10-15.