Commencer simplifies the integration of authentication into your projects, offering a quick and hassle-free setup.
Step 1 : For Install the package via npm
npx commencer
Or Clone the repo directly
Step 2 :
Configure your MySQL database URL in the .env
file under COMMENCER_DATABASE_URL
Step 3 : Generate Prisma files:
npx prisma generate
Step 4 : Deploy migrations:
npx prisma migrate deploy
Contributions are welcome!😃 Follow these steps to contribute:
Fork the repository.
Create a new branch for your feature or bug fix.
Stage and commit your changes:
git add <file-path>
git commit -m "Detailed message about changes"
To stage changes:
git add <file-path>
To commit changes:
git commit # opens vim editor
For a simple commit message (not recommended):
git commit -m "<message>"
/src/routes/user/index.ts
file defines several authentication-related endpoints. Some routes listed below are prefixed with /auth/
.POST /auth/register-user
Input:
userID
(string): The user’s ID.idType
(string): The user’s ID Type (Can be mobile
/ email
).name
(string): The user's Name.Controller:
Registers a new user and sends an OTP for email/mobile as mentioned for verification.
POST /auth/login
Input:
userID
(string): The user’s ID.password
(string): The user’s password.Controller:
Authenticates the user and returns a session token on successful login.
PUT /auth/reset-password
otp
(number): The otp required.userID
(string): The user’s ID.password
(string): The user’s password.PUT
method).PUT /auth/set-password
Input:
otp
(string): The otp required.userID
(string): The user’s ID.password
(string): The user’s password.Controller:
Creates a password for user’s account (if they have never set one before) using a valid OTP (via the PUT
method).
To contribute, create a discussion thread to clarify processes and suggest improvements.
Feel free to open issues or discussions if you need assistance or encounter any problems. Contributions and suggestions are highly encouraged to improve the repository.