DEV Community

Cover image for Remix Drizzle Auth Template
mmvergara
mmvergara

Posted on

Remix Drizzle Auth Template

Remix Drizzle Auth Template

Just a simple template to get you started, i did all of the boilerplates for the authentication, so you can focus on implementing the app itself, the drizzle i setup for sqlite db by default, but you can easily change it.

Installation

# Clone the repository
npm install
Enter fullscreen mode Exit fullscreen mode

Database Setup

Currently we are using sqlite and using ./local.db as the database file. If you are using sqlite you can skip step 1.

1. Setup and pick your own database

  • Remove sqlite
  npm uninstall libsql
  rm ./local.db
Enter fullscreen mode Exit fullscreen mode
  • Go to ./app/.server/db/drizzle.ts
  • Configure your database using drizzle-docs
  • Go to ./app/.server/db/schema.ts and modify the users table to your corresponding database

2. Push database

npx drizzle-kit push
Enter fullscreen mode Exit fullscreen mode

Run the app

npm run dev
Enter fullscreen mode Exit fullscreen mode

What you need to know

  • All of db operations are done in `./app/.server/db, you can organize them in you liking

  • To protect routes you should always call requireUser function in the loader

  • Routes

    • ./
    • ./singin
    • ./signup
    • ./protected

Authentication logic heavily inspired by AlemTuzlak

Top comments (0)