This is a SvelteKit starter project with basic user authentication functionality using Lucia, Prisma, Zod, SuperForms and PostgreSQL:
Additional Feeatures:
I have commented out the email functionality in src/lib/server/email-send.ts
for testing purposes.
Start a docker container with postgreSQL
docker run -d \
--name mypostgresdb \
-e POSTGRES_PASSWORD=mysecretpassword \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-p 5432:5432 \
postgres
Rename sample.env
from the root directory to .env
and edit the POSTGRES_PRISMA_URL:
POSTGRES_PRISMA_URL="postgresql://postgres:mysecretpassword@localhost:5432/postgres"
Install dependencies
pnpm i
Run initial Prisma migration
npx prisma migrate dev --name init
Start the app
pnpm run dev
Create an account
6.1 Go to http://localhost:5173/ and create an account. After clicking the "Sign up" button you will be redirected to the Email Confirmation Page.
6.2 If you haven't configured the nodemailer in the .env file, open Prisma Studio:
npx prisma studio
go to the AuthUser table and set the verified field to true. Save.
6.3 go back to the Email Confirmation Page and refresh. You should be logged in into your account now.
This project is based on 2 wonderful projects shadcn-svelte and sveltekit-auth-starter. Thank you @huntabyte, @delay and @shadcn!
Visit https://shadcn-svelte.com/docs to view the documentation of the UI components.
Visit https://github.com/delay/sveltekit-auth-starter to view more documentation on authentication components.
Licensed under the MIT license.