• Stars
    star
    378
  • Rank 113,272 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nest.js authentication with Passport. Realworld example

πŸ›‚ 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

More Repositories

1

nest-api-example

Example of an Restful API with Nest.js and TypeORM
TypeScript
87
star
2

nest-typeorm-custom-repository

TypeORM with a Custom Repository
TypeScript
53
star
3

mui-next-ts

Example project for how to use Material UI with Next.js
TypeScript
23
star
4

nest-graphql-example

Example of GraphQL with Nest.js and TypeORM
TypeScript
8
star
5

expense-tracker

Expense tracker made with Redux
TypeScript
5
star
6

contact-list

Prueba tΓ©cnica utilizando Vue.js para crear una lista de contactos
Vue
3
star
7

goal-app

Example of how-to use next-auth, mongodb and rtk-query
TypeScript
2
star
8

next-vanilla-extract-example

TypeScript
2
star
9

react-auth-example

TypeScript
2
star
10

nest-e2e-integresql

TypeScript
1
star
11

fakeshop-api

Minimal API RESTful with MongoDB and tested with Jest
TypeScript
1
star
12

spotify-remote-control

Try to use Spotify API with React Native
TypeScript
1
star
13

nest-microservice-example

nest-microservice-example
TypeScript
1
star
14

redux-offline-example

Redux application with offline support
TypeScript
1
star
15

ShoppingList

JavaScript
1
star
16

micro-ts-dev

Adds TypeScript support to `micro-dev`
JavaScript
1
star
17

voting

A basic voting application with Sails.js
JavaScript
1
star
18

spotify-backend

The backend of https://github.com/leosuncin/spotify-remote-control
TypeScript
1
star
19

redux-clean-example

Experiments to test redux-clean-architecture library
Shell
1
star
20

koa-api-example

A simple REST API built with Koa
TypeScript
1
star
21

zombodb-postgres

Docker image for PostgreSQL with ZomboDB extension
1
star
22

todomvc-ngrx-app

TodoMVC implemented in Angular and NgRx
TypeScript
1
star
23

express-sequelize-ts

API REST with Express, Sequelize & TypeScript
TypeScript
1
star