This is a simple user management application built with Fastify, Prisma, and Node.js. It includes user registration, login, and password reset functionalities. The application is designed for personal use, but anyone is welcome to contribute and improve it!
- User registration with email and password
- User login
- Forgot password functionality with email reset link
- Email sending functionality using SMTP
- Fastify: Web framework for Node.js
- Prisma: ORM for database access
- Bcrypt: Password hashing
- Crypto: Secure random tokens for user authentication for password resets
- Nodemailer: Email sending
- SMTP Server: For testing email functionality (which you need to provide)
Before you begin, ensure you have the following installed:
- Node.js (v14 or higher)
- bun (optional)
- A relational database (e.g., PostgreSQL, MySQL, SQLite)
-
Clone the repository:
git clone https://github.com/ShinniUwU/QuickShield.git cd QuickShield
-
Install dependencies:
bun install
-
Set up your database:
Ensure you have a relational database set up and create a
.env
file in the root directory with the following variables:DATABASE_URL="your_database_connection_string" SMTP_HOST="your_smtp_host" SMTP_PORT=465 SMTP_USER="your_email" SMTP_PASS="your_email_password"
-
Run Prisma migrations:
If you have defined your Prisma schema, run the migrations:
npx prisma migrate dev --name init
-
Start the server:
bun run start
The server will start on
http://localhost:3000
.
-
POST
/register
- Register a new user.- Request Body:
{ "username": "exampleUser", "email": "example@example.com", "password": "yourPassword" }
- Request Body:
-
POST
/login
- Login an existing user.- Request Body:
{ "email": "example@example.com", "password": "yourPassword" }
- Request Body:
-
POST
/forgot-password
- Request a password reset link.- Request Body:
{ "email": "example@example.com" }
- Request Body:
This project is licensed under the MIT License. You are free to use, modify, and distribute it. Contributions are welcome!
If you'd like to contribute to this project, please fork the repository and submit a pull request with your changes.