Skip to content

joysofcode/sveltekit-auth-cookies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

39 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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 pnpm.

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