GithubHelp home page GithubHelp logo

leosuncin / nest-auth-example Goto Github PK

View Code? Open in Web Editor NEW
348.0 6.0 56.0 7.05 MB

Nest.js authentication with Passport. Realworld example

License: MIT License

JavaScript 11.92% TypeScript 87.47% Procfile 0.05% Dockerfile 0.56%
nestjs typescript passport rest-api backend postgresql

nest-auth-example's Introduction

🛂 Nest.js Authentication Example

MegaLinter Unit test E2E test Prettier GPL v3 License HitCount

Nest.js authentication with Passport. RealWorld example

Nest Logo

Features

Run Locally

Clone the project

  git clone https://github.com/leosuncin/nest-auth-example.git

Go to the project directory

  cd nest-auth-example

Install dependencies

  npm install

Create a .env from the example one and customize it with your environment variables

  cp .env.example .env

Start the services using Docker Compose

  docker-compose up -d

Run migrations to create the DB schema

  npm run typeorm migration:run

Start the server

  npm run start:dev

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

POSTGRES_DB the name of the database to connect in the PostgreSQL instance (required)

POSTGRES_USER The name of the user to connect to the PostgreSQL instance (required)

POSTGRES_PASSWORD The password of the user to connect to the PostgreSQL instance (required)

DATABASE_URL a connection string to the PostgreSQL instance, example postgres://postgres|@localhost/example-db (required)

PORT the port that Nest.js will listen at (required)

APP_SECRET the secret used to encrypt the session (required)

ALLOWED_ORIGINS a comma separated list of origins from which accept request (required)

You can copy the example .env and edit the values

  cp .env.example .env

Running Tests

To run unit tests, run the following command:

  npm test

To run e2e tests (the PostgreSQL instance must be available), run the following command:

  npm run test:e2e

To see the code coverage

  npm run test:cov

Try it online

Gitpod Try-it

Tech Stack

Server: Typescript, PostgreSQL, Nest.js, TypeORM, Passport

Test: Jest, SuperTest, TS auto mock

DevOps: Docker Compose

Author

👤 Jaime Leonardo Suncin Cruz

Show your support

Give a ⭐️ if this project helped you!

🌟 Stargazers

Stargazers repo roster for @leosuncin/nest-auth-example

🍴 Forkers

Forkers repo roster for @leosuncin/nest-auth-example

Related

Here are some more example projects with Nest.js

GraphQL example

API example

TypeORM custom repository

License

Release under the terms of MIT

nest-auth-example's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar greenkeeper[bot] avatar leosuncin avatar sboli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nest-auth-example's Issues

DB (PostgreSQL) User Credential

I just cloned this repo and I'm having some errors while running yarn run typeorm migration:run
image

And here's my .env file (am wondering if these values are right for the dockerized image)
image

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet.
We recommend using:

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

Request on Collaboration

@leosuncin your template truly helps me save my time that I can build my applications on top of this.
I just added Google-Auth feature using Google OAuth2 & Passport.
I'm wondering if you're interested in merging this into your template...

Question on Demo API : TODO

@leosuncin Thanks for you updates.
I just pulled the latest commits and it works pretty fine.
I'm not sure if I made a mistake or not, but when I make a GET request /todo:id, it returns the list of TO-DOs, not only the one with that ID.
image

Can you please take a look into this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.