This project is a backend user management system designed for the Adamur educational platform, which helps African developers master tech skills. The system handles:
- User registration and validation
- Secure login with JWT tokens
- Email-based account verification (using OTP)
- Password reset functionality
The system is built using modern tools, including GraphQL, Prisma, and PostgreSQL, ensuring scalability and security.
- Users can register with an email and password.
- Passwords are hashed using
bcryptjs
. - Email validation and strong password enforcement are applied.
- OTP is sent via email for account verification.
- Users can log in using email and password.
- JWT token is returned for successful logins.
- Non-verified users are notified.
- An OTP is sent to the user’s email for verification after registration.
- Users can verify their account using the OTP.
- Users can request a password reset via email.
- A reset link with a secure token is sent via email.
- Users can reset their password using the token.
- Backend: Node.js, Express, GraphQL
- Database: Prisma (PostgreSQL)
- Authentication: JWT
- Email Service: Nodemailer (Gmail or other SMTP)
git clone https://github.com/Adamur-Tribe/adamur-Test-1.git
cd adamur-Test-1
npm install
Create a .env
file in the root directory and add the following:
DATABASE_URL=postgresql://postgres:Pure@localhost:5432/mydb?schema=public
JWT_SECRET=your_jwt_secret
[email protected]
EMAIL_PASS=your_email_password
npx prisma migrate dev --name init
npm run dev
The application will be running at http://localhost:4000/
.
mutation {
registerUser(email: "[email protected]", password: "Password123") {
message
}
}
mutation {
login(email: "[email protected]", password: "Password123") {
token
}
}
mutation {
verifyAccount(otp: "123456") {
message
}
}
mutation {
requestPasswordReset(email: "[email protected]") {
message
}
}
mutation {
resetPassword(token: "reset_token", newPassword: "NewPassword123") {
message
}
}
To run unit and integration tests:
npm test
This project is licensed under the MIT License.