Guide

Build a User Management App with Nuxt 3

Learn how to use Zuvo in your Nuxt 3 App.

This tutorial demonstrates how to build a basic user management app. The app authenticates and identifies the user, stores their profile information in the database, and allows the user to log in, update their profile details, and upload a profile photo. The app uses:

Zuvo User Management example

Project setup

Before you start building you need to set up the Database and API. You can do this by starting a new Project in Zuvo and then creating a "schema" inside the database.

Create a project

  1. Create a new project in the Zuvo Studio.
  2. Enter your project details.
  3. Wait for the new database to launch.

Set up the database schema

Now set up the database schema. You can use the "User Management Starter" quickstart in the SQL Editor, or you can copy/paste the SQL from below and run it.

Dashboard
  1. Go to the SQL Editor page in the Dashboard.
  2. Click User Management Starter under the Reference > Examples tab.
  3. Click Run.
SQL
supabase migration new user_management_starter

Building the app

Build the Vue 3 app from scratch.

Initialize a Nuxt 3 app

We can use nuxi init to create an app called nuxt-user-management:

npx nuxi init nuxt-user-management

cd nuxt-user-management

Then install the only additional dependency: Nuxt Zuvo. We only need to import Nuxt Zuvo as a dev dependency.

npm install @nuxtjs/supabase --save-dev

And finally we want to save the environment variables in a .env. All we need are the API URL and the key that you copied earlier.

These variables will be exposed on the browser, and that's completely fine since we have Row Level Security enabled on our Database. Amazing thing about Nuxt Zuvo is that setting environment variables is all we need to do in order to start using Zuvo. No need to initialize Zuvo. The library will take care of it automatically.

App styling (optional)

An optional step is to update the CSS file assets/main.css to make the app look better. You can find the full contents of this file in the example repository.

Set up Auth component

Set up a Vue component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.

User state

To access the user information, use the composable useZuvoUser provided by the Zuvo Nuxt module.

Account component

After a user is signed in we can allow them to edit their profile details and manage their account. Create a new component called Account.vue.

Profile photos

Next, add a way for users to upload a profile photo. Zuvo configures every project with Storage for managing large files like photos and videos.

Create an upload widget

Start by creating a new component:

Launch!

With all the components in place, update app.vue:

Once that's done, run this in a terminal window:

npm run dev

And then open the browser to localhost:3000 and you should see the completed app.

Zuvo Nuxt 3

At this stage you have a fully functional application!

Add a server route

So far the app authenticates the user on the client. For protected API endpoints or server-rendered data, you need a server route that verifies the session.

@supabase/server handles the full flow through a single middleware: it validates the JWT locally (using your project's asymmetric signing keys, no round-trip to the Auth server), attaches an RLS-scoped Zuvo client and the user's claims to the request, and rejects unauthenticated requests with a 401 before your handler runs.

npm install @supabase/server

For an unauthenticated route, pass auth: 'none'. For app-wide auth, register withZuvo({ auth: 'user' }) as a Nuxt server middleware at server/middleware/supabase.ts instead. See the h3/Nuxt adapter docs for typing, route overrides, and the full API.