Giter Site home page Giter Site logo

svelte5-blog's Introduction

SvelteKit Auth Example with Lucia and Drizzle

This is an example project showcasing authentication processes using Lucia for state management and Drizzle for ORM (Object-Relational Mapping) in a SvelteKit application.

Overview

This project demonstrates how to implement authentication features such as user signup, login, logout, and protected routes using Lucia for state management and Drizzle for ORM.

Features

  • User signup: Allow users to create a new account.
  • User login: Allow existing users to authenticate themselves.
  • User logout: Allow authenticated users to log out of their accounts.
  • Protected routes: Restrict access to certain routes to authenticated users only.

Installation

  1. Clone the repository:

    git clone https://github.com/hrasekj/sveltekit-with-lucia-auth.git
  2. Navigate into the project directory:

    cd sveltekit-auth-example
  3. Install dependencies:

    pnpm install
  4. Use .env.example to create a new .env file:

    cp .env.example .env
  5. Initialize database:

    docker-compose up -d
  6. Push migrations to the database:

    npx drizzle-kit push:mysql

Usage

  1. Start the development server:

    pnpm dev
    
    # or start the server and open the app in a new browser tab
    pnpm dev --open
  2. In browser navigate to http://localhost:5173.

  3. Explore the authentication features implemented in the application.

Development

To create new migration files, run:

npx drizzle-kit generate:mysql

Then push the new migration to the database.

Dependencies

  • SvelteKit: A framework for building web applications.
  • Lucia: Authentication library.
  • Drizzle ORM: An ORM (Object-Relational Mapping) library.

Sources

Here are some resources that helped me create this project:

License

This project is licensed under the MIT License - see the LICENSE file for details.

svelte5-blog's People

Contributors

hrasekj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.