Installing Svelte Guardian
This guide will walk you through the process of installing Svelte Guardian and setting up the necessary dependencies for your SvelteKit project.
Package Installation
Install Svelte Guardian using your preferred package manager:
Database Setup
Svelte Guardian requires a database to store user accounts and authentication-related data. While any database system compatible with SvelteKit can work, we recommend using Prisma for the best developer experience.
Setting Up Prisma
- Install Prisma and the Prisma adapter:
- Configure your database connection in the
.env
file:
Note: You can use other databases supported by Prisma such as MySQL, SQLite, MongoDB, etc.
- Add the required schema to your
prisma/schema.prisma
file:
- Run the migration to create the database schema:
Environment Variables
Create or update your .env
file with the necessary environment variables:
Security Note: Never commit your
.env
file to version control. Make sure it’s included in your.gitignore
file.
Next Steps
After completing the installation process, proceed to the basic configuration section to set up Svelte Guardian in your application.