NestJS Authentication with Bcrypt, JWT, Redis, GraphQL and PostgreSQL
Developed with the software and tools below.
Nest-auth is a cutting-edge authentication solution designed for modern web applications. Built on top of the powerful NestJS framework, it leverages the best practices in security and software design patterns to provide a comprehensive, out-of-the-box authentication system. This project aims to simplify the integration of authentication mechanisms into your applications, allowing developers to focus more on core features rather than the complexities of secure user authentication.
At its core, nest-auth incorporates a variety of security features such as JWT-based stateless authentication, social login strategies, and role-based access control, making it a versatile choice for any project. Whether you're building a small hobby project or a large-scale enterprise application, nest-auth offers the scalability and flexibility needed to meet your requirements.
Designed with developer experience in mind, nest-auth is fully documented and comes with a suite of examples to get you started quickly. Its modular architecture and the use of TypeScript make it easy to extend and maintain, ensuring that your authentication layer remains robust and up-to-date with the latest security standards.
Join the growing community of developers who trust nest-auth for their authentication needs and take the first step towards securing your application today.
- Comprehensive Authentication System: Utilizes a robust authentication system designed to secure your application, including guards and decorators for fine-grained access control.
- GraphQL Integration: Offers full support for GraphQL, enabling you to build flexible and efficient APIs for your applications.
- Docker Support: Includes a
docker-compose.yml
file for easy containerization and deployment, ensuring your application is ready for production environments.
- TypeScript Support: Fully written in TypeScript, providing strong typing and modern JavaScript features for a more maintainable codebase.
- Configurable Environment: Comes with a customizable configuration setup (
app.config.ts
and auth.config.ts
), allowing for easy adjustments to meet your project's needs.
- Unit Testing Ready: Equipped with Jest configurations for both unit and integration tests (
auth.service.spec.ts
and auth.resolver.spec.ts
), ensuring your code is reliable and bug-free.
- ESLint and Prettier Integration: Pre-configured with ESLint and Prettier for consistent code formatting and linting, helping maintain code quality.
- Modular Structure: Features a modular repository structure, making it easy to navigate and scale your application as it grows.
- PNPM Package Management: Utilizes PNPM for efficient and fast package management, reducing node_modules size and installation time.
└── nest-auth/
├── docker-compose.yml
├── nest-cli.json
├── package.json
├── pnpm-lock.yaml
├── src
│ ├── app.config.ts
│ ├── app.module.ts
│ ├── auth
│ │ ├── auth.config.ts
│ │ ├── auth.guard.ts
│ │ ├── auth.module.ts
│ │ ├── auth.resolver.spec.ts
│ │ ├── auth.resolver.ts
│ │ ├── auth.service.spec.ts
│ │ ├── auth.service.ts
│ │ ├── decorators
│ │ │ ├── active-auth.decorator.ts
│ │ │ └── public.decorator.ts
│ │ ├── dto
│ │ │ ├── refresh-token.input.ts
│ │ │ ├── signin.input.ts
│ │ │ └── signup.input.ts
│ │ ├── entities
│ │ │ └── auth.entity.ts
│ │ └── interfaces
│ │ ├── payload.interface.ts
│ │ └── token.interface.ts
│ ├── core
│ │ ├── config
│ │ │ ├── config.enum.ts
│ │ │ ├── config.interface.ts
│ │ │ ├── config.module.ts
│ │ │ └── config.validation.ts
│ │ ├── database
│ │ │ ├── database.config.ts
│ │ │ └── database.module.ts
│ │ ├── graphql
│ │ │ ├── graphql.config.ts
│ │ │ └── graphql.module.ts
│ │ └── redis
│ │ ├── redis.config.ts
│ │ ├── redis.constants.ts
│ │ ├── redis.module.ts
│ │ ├── redis.service.spec.ts
│ │ └── redis.service.ts
│ ├── main.ts
│ ├── schema.gql
│ └── users
│ ├── dto
│ │ └── update-user.input.ts
│ ├── entities
│ │ └── user.entity.ts
│ ├── password
│ │ ├── password.service.spec.ts
│ │ └── password.service.ts
│ ├── users.module.ts
│ ├── users.resolver.spec.ts
│ ├── users.resolver.ts
│ ├── users.service.spec.ts
│ └── users.service.ts
├── test
│ ├── app.e2e-spec.ts
│ └── jest-e2e.json
├── tsconfig.build.json
└── tsconfig.json
.
test
src
src.users
src.users.password
src.users.entities
src.users.dto
src.core.graphql
src.core.redis
src.core.database
src.core.config
src.auth
src.auth.entities
src.auth.interfaces
src.auth.dto
src.auth.decorators
File |
Summary |
[pu## 🛠 Project Roadmap |
|
- Comprehensive Authentication System: Utilizes a robust authentication system designed to secure your application, including guards and decorators for fine-grained access control.
- GraphQL Integration: Offers full support for GraphQL, enabling you to build flexible and efficient APIs for your applications.
- Docker Support: Includes a
docker-compose.yml
file for easy containerization and deployment, ensuring your application is ready for production environments.
- TypeScript Support: Fully written in TypeScript, providing strong typing and modern JavaScript features for a more maintainable codebase.
- Configurable Environment: Comes with a customizable configuration setup (
app.config.ts
and auth.config.ts
), allowing for easy adjustments to meet your project's needs.
- Unit Testing Ready: Equipped with Jest configurations for both unit and integration tests (
auth.service.spec.ts
and auth.resolver.spec.ts
), ensuring your code is reliable and bug-free.
- ESLint and Prettier Integration: Pre-configured with ESLint and Prettier for consistent code formatting and linting, helping maintain code quality.
- Modular Structure: Features a modular repository structure, making it easy to navigate and scale your application as it grows.
- PNPM Package Management: Utilizes PNPM for efficient and fast package management, reducing node_modules size and installation time.orators/public.decorator.ts) |
► INSERT-TEXT-HERE
|
| active-auth.decorator.ts | ► INSERT-TEXT-HERE
|
- Clone the nest-auth repository:
git clone https://github.com/yusufulusoy/nest-auth
- Change to the project directory:
- Install the dependencies:
Use the following command to run nest-auth:
pnpm run build && node dist/main.js
To execute tests, run:
Contributions are welcome! Here are several ways you can contribute:
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your GitHub account.
- Clone Locally: Clone the forked repository to your local machine using a Git client.
git clone https://github.com/yusufulusoy/nest-auth
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.'
- Push to GitHub: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
Once your PR is reviewed and approved, it will be merged into the main branch.
This project is protected under the MIT License.
- List any resources, contributors, inspiration, etc. here.
Return