Skip to content

felipemattosv/auth-api

Repository files navigation

auth-api

Author: @felipemattosv

Description

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.

Technologies

Requirements

  • Node.js 18.x

In the future, will be developed a Dockerfile to run the project in a container.

Run guide

  1. Clone the repository
git clone www.github.com/felipemattosv/auth-api
  1. Install dependencies
yarn install
  1. Create a .env file in the root of the project with the content specified in the .env.example file.

  2. Run the project

yarn dev

Routes available

Open Routes

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)

Only-Admin Routes

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)

Folder structure explanation

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.

Node.js TypeScript AWS Lambda Serverless Google Cloud Console Firebase

About

Authentication API w/ AWS Serverless & Google Firebase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published