Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devhumblechris/nuxt-lucia-auth
This is a Nuxt.js project with authentication implemented using Lucia.
https://github.com/devhumblechris/nuxt-lucia-auth
lucia nuxt shadcn-ui
Last synced: 3 months ago
JSON representation
This is a Nuxt.js project with authentication implemented using Lucia.
- Host: GitHub
- URL: https://github.com/devhumblechris/nuxt-lucia-auth
- Owner: DevHumbleChris
- Created: 2024-07-30T12:51:08.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-09-19T07:42:30.000Z (3 months ago)
- Last Synced: 2024-09-23T17:32:48.169Z (3 months ago)
- Topics: lucia, nuxt, shadcn-ui
- Language: Vue
- Homepage: https://nuxt-lucia-auth.vercel.app
- Size: 788 KB
- Stars: 33
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nuxt.js Lucia Auth Starter Template
## Motivation
Implementing authentication in Nuxt.js, especially Email+Password authentication, can be challenging. NuxtAuth [sidebase.io](https://auth.sidebase.io/) intentionally limits email password functionality to discourage the use of passwords due to security risks and added complexity. However, in certain projects, clients may require user password authentication. Lucia offers a flexible alternative to NuxtAuth and other Nuxt auth utils, providing more customization options without compromising on security. This template serves as a starting point for building a Nuxt.js app with Lucia authentication.
## Lucia vs. NuxtAuth
Lucia is less opinionated than NuxtAuth [sidebase.io](https://auth.sidebase.io/), offering greater flexibility for customization. While Lucia involves more setup, it provides a higher degree of flexibility, making it a suitable choice for projects requiring unique authentication configurations.
## Key Features
- **Authentication:** 💼 Support for Credential and OAuth authentication.
- **Authorization:** 🔒 Easily manage public and protected routes within the project.
- **Email Verification:** 📧 Verify user identities through email.
- **Password Reset:** 🔑 Streamline password resets by sending email password reset links.
- **Lucia + Nuxt Server Routes:** 🔄 Similar to NuxtAuth, granting access to sessions and user information through server routes.
- **Email template:** ✉️ Craft your email templates using and send email them with [nodemailer](https://nodemailer.com/).
- **PostgreSQL Database:** 🛢️ Utilize a PostgreSQL database set up using Drizzle for enhanced performance and type safety.
- **Database Migration:** 🚀 Included migration script to extend the database schema according to your project needs.## Tech Stack
- [Nuxt.js](https://nextjs.org)
- [Lucia](https://lucia-auth.com/)
- [Drizzle ORM](https://orm.drizzle.team/)
- [PostgreSQL](https://www.postgresql.org/)
- [Tailwind CSS](https://tailwindcss.com)
- [Shadcn Vue UI](https://www.shadcn-vue.com/)
- [Validate forms with vee-validate](https://vee-validate.logaretm.com/v4/)## Get Started
1. Clone this repository to your local machine.
2. Copy `.env.example` to `.env` and fill in the required environment variables.
3. Run `npm install` to install dependencies.
4. Run `npm db:genrate` to push your schema to the database.
5. Execute `npm run dev` to start the development server and enjoy!## Deploy to Vercel / anywhere
Add the following **environment variables** :-
```env
DATABASE_URL=**********JWT_SECRET =**********
BASE_URL =**********GMAIL_EMAIL_USER =**********
GMAIL_EMAIL_PASSWORD = **********OAUTH_GITHUB_CLIENT_ID = **********
OAUTH_GITHUB_CLIENT_SECRET = **********OAUTH_GOOGLE_CLIENT_ID = **********
OAUTH_GOOGLE_CLIENT_SECRET = **********
OAUTH_GOOGLE_REDIRECT_URI = **********
```## Roadmap
- [x] Email/password auth with verification.
- [x] Sign in with OAuth providers (GitHub/Google).
- [ ] Sign in using Magic link. (under consideration)
- [ ] Role-Based Access Policy (under consideration)
- [ ] Admin Dashboard (under consideration)## Contributing
To contribute, fork the repository and create a feature branch. Test your changes, and if possible, open an issue for discussion before submitting a pull request. Follow project guidelines, and welcome feedback to ensure a smooth integration of your contributions. Your pull requests are warmly welcome.