/authentication-api-type-graphql

A nodejs API authentication system using apollo server, type-graphql, typegoose, typescript, javascript, mongodb, AWS Lambda and Docker.

Primary LanguageTypeScript

Authentication API

The code in this repo is fully functioning authentication API using graphql apollo, type-graphql, typegoose, nodejs, typescript, javascript, jwt tokens, express and mongodb.

🚀 Start

To start this project, first clone the code using git:

git clone https://github.com/efenstakes/authentication-api-type-graphql api

Navigate to the project directory:

cd api

Install dependencies:

yarn install

Create .env in the src/ directory with below keys:

touch src/.env

DB_URL= PORT= ACCESS_TOKEN_SECRET= REFRESH_TOKEN_SECRET=

To start the API run:

yarn dev

To build the API run:

yarn build

To deploy the API to AWS Lambda, ensure you install serverless and run:

yarn build && serverless deploy

Alternatively, you can use docker to run the api.

Build the Docker image:

docker build -t auth-api .

Start the Docker container:

docker run -p 8080:8080 auth-api

Note For SQL users

Typegoose can easily be replaced by an SQL ORM like TypeORM and this API will work perfectly with MySQL, Postgres or any other MYSQL database.

Contact

Contact me through. efenstakes101@gmail.com