m-2k / sveltekit-auth-cookies

πŸͺ SvelteKit authentication using cookies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SvelteKit Auth

✍️ https://joyofcode.xyz/sveltekit-authentication-using-cookies

Learn SvelteKit authentication using cookies.

Project Setup

πŸ§‘β€πŸ€β€πŸ§‘ Clone the project

git clone https://github.com/joysofcode/sveltekit-auth-cookies.git

πŸ“¦οΈ Install dependencies

You can use npm or yarn.

pnpm i

Database

✏️ Rename .env.example to .env

DATABASE_URL="file:./dev.db"

πŸ”¨ Create the database from the Prisma schema

pnpx prisma db push

πŸ”Ž Inspect your database with Prisma Studio

pnpx prisma studio

πŸ§‘ Add user roles

Open Prisma Studio at http://localhost:5555/ and inside the Roles table press Add record to add the ADMIN and USER roles by entering the role name and pressing Save for each one.

Development

πŸ¦„ Start the project and open http://localhost:5173/

pnpm run dev

Production

πŸ”¨ Build and preview

pnpm run build && pnpm run preview

About

πŸͺ SvelteKit authentication using cookies


Languages

Language:TypeScript 47.5%Language:Svelte 26.0%Language:CSS 9.7%Language:JavaScript 9.6%Language:Shell 4.5%Language:HTML 2.6%