Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Better auth with nuxt and sqlite
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Better Auth with Nuxt and SQLite

Source: Telerik Blogs•November 20, 2026 at 05:19 PM

Better Auth with Nuxt and SQLite

This unofficial Better Auth Nuxt demo should allow you to integrate your preferred database. It uses Tailwind 4, Nuxt 4, latest shadcn-vue, page protection and SQLite for login.

This unofficial Better Auth Nuxt demo should allow you to integrate your preferred database. It uses Tailwind 4, Nuxt 4, latest shadcn-vue, page protection and SQLite for login.

The official Better Auth Nuxt repo does not seem to work correctly for me, and it’s based on older Nuxt, Tailwind and shadcn-vue. I have updated it, added features and fixed security bugs allowing you to use whatever Better Auth database integrations you like.

TL;DR

This demo uses Tailwind 4, Nuxt 4, latest , has page protection, allows you to change your password and does not suffer from client loading problems. You log in using SQLite, the session is automatically saved, and you can change your password and generate a password reset link.

Setup

Nuxt 4

First, generate a new Nuxt 4 repo.

Tailwind

Follow official instructions to install .

⚠️ DO NOT USE Nuxt Tailwind Module directly.

But, install it manually:

Vue ShadCN

Configure ShadCN Vue for Nuxt. You will need to install all components manually that you need.

📝 There is an error with the all flag, as it will try to install old modules. Unfortunately, the only work around is to install the components manually.

Better Auth

Follow the installation guide. Here is a quick version.

Install the package. We will use better-auth/vue.

Generate config.

We will generate library files in a following section.

Install Temp Database

Fastest SQLite in Node.js.

.env

Setup your config.

Nuxt Config

Create the catch all server route.

This will handle all authentication server requests.

lib/auth-client.ts

Let’s import the reusable client functions.

lib/auth.ts

Generate a better auth instance.

📝 You must config an email server later to send emails, for now you can just print the URL.

📝 Our database will the the file db.sqlite. It will NOT persist when deployed, so you must you a different hosted database. This is for testing on

Repo: GitHub

Protect Your Pages

📝 We don’t want login pages to be seen when logged-in, and we don’t want login-protected pages to be seen without a session. Our server auth handles these cookies and paths for us!

Change Password

📝 We import our auth-client functions to perform the client function for us. We MUST use a form to prevent warnings in Chrome, which is good practice anyway.

Dashboard

We want to load the session on the server, NOT on the client with a delay, like the original demo.

📝 useAuth has many functions we can configure to work in any scenario. useAsyncData loads on the sever and hydrates to the client.

Forget Password

📝 We must configure an email server to work in production. This setup is similar to previous pages.

Home

📝 Nothing special here, except for checking for a session.

Reset Password

📝 Same setup as before, import our resetPassword function from our auth library.

Sign In

📝 Manually forward router to /dashboard upon success.

📝 We use alert for errors, but this is easily configurable.

Bonus

We can easily use any database integration we like.

Postgres

Now, go build the rest of your app!

Repo:

← All articles

What this article says

More in Software Development

All →
Upgrades You Can Add to Your Site in 5 Minutes
Squarespace Commerce

Upgrades You Can Add to Your Site in 5 Minutes

Reimagining automotive verification and validation for software-defined vehicles
HCLTech

Reimagining automotive verification and validation for software-defined vehicles

Vulkan Rendering Is Now The Default on Linux Wayland
JetBrains

Vulkan Rendering Is Now The Default on Linux Wayland

JetBrains Air in GoLand: Build, Review, and Profile Go Code With Agents
JetBrains

JetBrains Air in GoLand: Build, Review, and Profile Go Code With Agents

How to build an ecommerce shipping strategy
Shippo

How to build an ecommerce shipping strategy

Open edX as the Operating Layer for AI Tools
Open edX

Open edX as the Operating Layer for AI Tools

More from Telerik

Generic Components for Vue 3
Telerik

Generic Components for Vue 3

Blazor Basics: Introduction to Generic Type Support in Blazor
Telerik

Blazor Basics: Introduction to Generic Type Support in Blazor

Build and Deploy a Dockerized NestJS Application on Google Cloud Run
Telerik

Build and Deploy a Dockerized NestJS Application on Google Cloud Run

5 Agent Skills for Production Web Apps: Teach Your AI Coding Agent to Slow Down
Telerik

5 Agent Skills for Production Web Apps: Teach Your AI Coding Agent to Slow Down

Create a Cute Animal UI in .NET MAUI with Telerik UI Controls
Telerik

Create a Cute Animal UI in .NET MAUI with Telerik UI Controls

Is Convex Better Than Firebase?
Telerik

Is Convex Better Than Firebase?