Author: @felipemattosv
This project is a authentication API that allows users to sign up, sign in, delete their account and update their account information. It also separates the users in two roles: admin and default.
- Node.js: JS runtime
- TypeScript: Adds syntax for types
- Serverless: Simplifies development/deploy of AWS Lambda apps
- Firebase: Firebase Firestore is a NoSQL database
- Nodemailer: Send emails using Gmail API v1
- Node.js 18.x
In the future, will be developed a Dockerfile to run the project in a container.
- Clone the repository
git clone www.github.com/felipemattosv/auth-api
- Install dependencies
yarn install
-
Create a
.env
file in the root of the project with the content specified in the.env.example
file. -
Run the project
yarn dev
POST - auth/Login
: Returns a JWT token if login information is correct
POST - auth/VerifyEmail
: Verify Email to create an account
POST - auth/CreateAccountByUser
: Create an account by user, using the verfification code sent by email
POST - auth/SendRecoveryCode
: Send a recovery code to the user's email
PUT - auth/ChangePassword
: Change the user's password, using the recovery code sent by email
PUT - auth/UpdateUserInfo
: Change user's info (NEED TOKEN)
POST - auth/CreateAccountByAdmin
: Create an account by admin (NEED TOKEN)
GET - auth/ListUsers
: List all users (NEED TOKEN)
DELETE - auth/DeleteUser
: Delete user's account (NEED TOKEN)
GET - auth/GetUserInfo
: Return user's info (NEED TOKEN)
src
├───controllers # Contains the controllers of the routes. A controller is responsible for handling the request and returning a response.
├───entities # Contains the entities of the project. An entity is a type that represents a table in the database.
├───enums # Contains the enumerations of the project.
├───errors # Contains the definition of the HTTP errors.
├───firebase # Contains the Firebase configuration.
├───interfaces # Contains the interfaces of the project. An interface represents a contract of a service return.
├───libs # Contains additional libraries and modules used in the project.
├───nodemailer # Contains the Nodemailer configuration.
├───routes # Contains the definition of the routes of the project. A route is responsible for receiving the request and calling the controller.
├───schemas # Contains the schemas of the project. A Schema is used to validate the request body/params.
├───services # Contains the services of the project. A service is responsible for accessing the database and making external API calls.
└───utils # Contains the utility functions of the project.