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
.env.example
to .env
βοΈ Rename 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
http://localhost:5173/
π¦ Start the project and openpnpm run dev
Production
π¨ Build and preview
pnpm run build && pnpm run preview