Skip to content

Redemption198/nuxt-url-shortener

Repository files navigation

Nuxt Url Shortener

A Nuxt 3 and Prisma url shortener.

Setup

Make sure to install the dependencies:

# yarn
yarn install

# npm
npm install

# pnpm
pnpm install --shamefully-hoist

Environment variables

Create an .env file and setup the following variables:

DATABASE_URL="file:./db/dev.db"
JWT_SECRET=<your_secret_key>

Setting up Prisma

Prisma config is available inside prisma/schema.prisma. Prisma docs available here.

Initialize the database with Prisma by running npx prisma migrate dev --name init.

Changing the domain

The domain can be changed inside nuxt.config.ts by editing:

// nuxt.config.ts
export default defineNuxtConfig({
    runtimeConfig: {
        public: {
            domain: "http://localhost:3000/",
        },
    },
});

Securing the app

This app uses the Nuxt Security module with its default values. Module documentation is available here.

Development Server

Start the development server on http://localhost:3000

npm run dev

Production

Build the application for production:

npm run build

Locally preview production build:

npm run preview

Checkout the deployment documentation for more information.