Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
JWT authentication boilerplate for Nuxt 3 with MongoDB, Prisma, Tailwind, and VeeValidate.
Nuxt 3 Authentication Boilerplate is a starter project for building JWT-based user authentication into Nuxt 3 apps, combining MongoDB, TypeScript, Prisma, Tailwind CSS, and VeeValidate in one template. The boilerplate exposes four ready-to-use API endpoints for registration, login, fetching the current user, and refreshing access tokens, so you can wire up a complete auth flow without starting from scratch.
This is an open-source boilerplate, maintained by GitHub user gabrielcaiana and released under the MIT license, that scaffolds a full authentication backend on Nuxt 3. It takes a MongoDB connection string plus separate access and refresh JWT secrets via a .env file, and outputs a set of Nitro server routes under the api/ directory. The template includes TypeScript throughout, Prisma as the data layer for MongoDB, Tailwind CSS for styling, and VeeValidate for client-side form validation.
After cloning the repository, you run npm install (or yarn install), create a .env file with DATABASE_URL, JWT_ACCESS_TOKEN_SECRET, and JWT_REFRESH_TOKEN_SECRET, then start the dev server with npm run dev. The API routes live in the api/auth/ folder, and routes are defined using Nuxt 3's file naming convention. All API calls must include an Authorization header carrying a Bearer token for authenticated endpoints, and the /api/auth/refresh route exchanges a valid refresh token for a new access token.
Yes. The template defines a separate JWT_REFRESH_TOKEN_SECRET and provides a GET /api/auth/refresh endpoint specifically for renewing access tokens after they expire, so you can keep users signed in without forcing a re-login.
You need three values in a .env file: DATABASE_URL pointing to your MongoDB connection string, JWT_ACCESS_TOKEN_SECRET for access tokens, and JWT_REFRESH_TOKEN_SECRET for refresh tokens. No other configuration is mentioned for the core auth flow.
According to the README, MongoDB is the database used, and Prisma is the ORM layer for it. The project prerequisites include MongoDB, so you should have a MongoDB instance running locally or remotely before starting the dev server.
Yes, the repository is public on GitHub under the MIT license, and it is maintained by gabrielcaiana. You can clone it, fork it, and submit pull requests; all contributions are welcomed per the contributing note.
Clone the repository at https://github.com/gabrielcaiana/boilerplate-nuxt3-authentication, install dependencies with npm install or yarn install, create the .env file with the required secrets, then run npm run dev or yarn dev. The server will be available at http://localhost:3000.
