Nuxt Auth Jwt Prisma screenshot

Nuxt Auth Jwt Prisma

Author Avatar Theme by Jeky1950
Updated: 31 Dec 2022
9 Stars

This is a starter project for a Nuxt 3 application with JWT Auth and Prisma configured to use an SQLite Database but Prisma can also be configured to work with other databases like SQL, SQLite, MSSQL, PostgreSQL, MySQL, MongoDB and CockroachDB

Categories

Overview

This article provides instructions for setting up and installing a project. It covers creating an environmental file, installing node dependencies, running a Prisma migration, starting the Nuxt server, and registering and logging in to an account. It also explains the use of different database sources and how to change the expiry time for the JWT Token.

Features

  • Create Environmental File: Create a .env file and place it in the root folder of the project.
  • Install Node Dependencies: Open the terminal and install the node dependencies using the command npm i.
  • Run Prisma Migration: Use the command npx prisma migrate dev --name init to run the Prisma migration.
  • Start Nuxt Server: Switch on the Nuxt server by running the command npm run dev.
  • Register and Login: Register an account and then log in.
  • Multiple Database Source Support: The example project uses SQLite as the DB source for Prisma, but other options like MySQL, MSSQL, PostgreSQL, MongoDB, and CockroachDB are also supported.

Installation

To install and set up the project, follow the steps below:

  1. Create an environmental file with the name .env and place it in the root folder of your project.
  2. Open your terminal and install the node dependencies by running the command:
    npm i
    
  3. Run the Prisma migration using the following command:
    npx prisma migrate dev --name init
    
  4. Start the Nuxt server by running the command:
    npm run dev
    
  5. Register an account and then log in to the application.

Summary

This article provides a step-by-step guide to install and set up a project. It covers creating an environmental file, installing node dependencies, running a Prisma migration, starting the Nuxt server, and registering and logging in to an account. The article also mentions the support for different database sources and how to change the expiry time for the JWT Token.