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
andauth.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
andauth.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
.
File | Summary |
---|---|
docker-compose.yml | βΊ INSERT-TEXT-HERE |
tsconfig.build.json | βΊ INSERT-TEXT-HERE |
tsconfig.json | βΊ INSERT-TEXT-HERE |
package.json | βΊ INSERT-TEXT-HERE |
nest-cli.json | βΊ INSERT-TEXT-HERE |
pnpm-lock.yaml | βΊ INSERT-TEXT-HERE |
test
File | Summary |
---|---|
app.e2e-spec.ts | βΊ INSERT-TEXT-HERE |
jest-e2e.json | βΊ INSERT-TEXT-HERE |
src
File | Summary |
---|---|
app.config.ts | βΊ INSERT-TEXT-HERE |
schema.gql | βΊ INSERT-TEXT-HERE |
app.module.ts | βΊ INSERT-TEXT-HERE |
main.ts | βΊ INSERT-TEXT-HERE |
src.users
File | Summary |
---|---|
users.service.ts | βΊ INSERT-TEXT-HERE |
users.module.ts | βΊ INSERT-TEXT-HERE |
users.resolver.spec.ts | βΊ INSERT-TEXT-HERE |
users.service.spec.ts | βΊ INSERT-TEXT-HERE |
users.resolver.ts | βΊ INSERT-TEXT-HERE |
src.users.password
File | Summary |
---|---|
password.service.ts | βΊ INSERT-TEXT-HERE |
password.service.spec.ts | βΊ INSERT-TEXT-HERE |
src.users.entities
File | Summary |
---|---|
user.entity.ts | βΊ INSERT-TEXT-HERE |
src.users.dto
File | Summary |
---|---|
update-user.input.ts | βΊ INSERT-TEXT-HERE |
src.core.graphql
File | Summary |
---|---|
graphql.module.ts | βΊ INSERT-TEXT-HERE |
graphql.config.ts | βΊ INSERT-TEXT-HERE |
src.core.redis
File | Summary |
---|---|
redis.constants.ts | βΊ INSERT-TEXT-HERE |
redis.service.spec.ts | βΊ INSERT-TEXT-HERE |
redis.service.ts | βΊ INSERT-TEXT-HERE |
redis.config.ts | βΊ INSERT-TEXT-HERE |
redis.module.ts | βΊ INSERT-TEXT-HERE |
src.core.database
File | Summary |
---|---|
database.module.ts | βΊ INSERT-TEXT-HERE |
database.config.ts | βΊ INSERT-TEXT-HERE |
src.core.config
File | Summary |
---|---|
config.validation.ts | βΊ INSERT-TEXT-HERE |
config.interface.ts | βΊ INSERT-TEXT-HERE |
config.enum.ts | βΊ INSERT-TEXT-HERE |
config.module.ts | βΊ INSERT-TEXT-HERE |
src.auth
File | Summary |
---|---|
auth.module.ts | βΊ INSERT-TEXT-HERE |
auth.resolver.spec.ts | βΊ INSERT-TEXT-HERE |
auth.config.ts | βΊ INSERT-TEXT-HERE |
auth.guard.ts | βΊ INSERT-TEXT-HERE |
auth.service.spec.ts | βΊ INSERT-TEXT-HERE |
auth.resolver.ts | βΊ INSERT-TEXT-HERE |
auth.service.ts | βΊ INSERT-TEXT-HERE |
src.auth.entities
File | Summary |
---|---|
auth.entity.ts | βΊ INSERT-TEXT-HERE |
src.auth.interfaces
File | Summary |
---|---|
payload.interface.ts | βΊ INSERT-TEXT-HERE |
token.interface.ts | βΊ INSERT-TEXT-HERE |
src.auth.dto
File | Summary |
---|---|
signin.input.ts | βΊ INSERT-TEXT-HERE |
signup.input.ts | βΊ INSERT-TEXT-HERE |
refresh-token.input.ts | βΊ INSERT-TEXT-HERE |
src.auth.decorators
File | Summary |
---|---|
[pu## π Project Roadmap |
-
βΊ INSERT-TASK-1
-
βΊ INSERT-TASK-2
-
βΊ ...
- 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
andauth.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
andauth.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:
cd nest-auth
- Install the dependencies:
pnpm install
Use the following command to run nest-auth:
pnpm run build && node dist/main.js
To execute tests, run:
pnpm test
Contributions are welcome! Here are several ways you can contribute:
- Submit Pull Requests: Review open PRs, and submit your own PRs.
- Join the Discussions: Share your insights, provide feedback, or ask questions.
- Report Issues: Submit bugs found or log feature requests for Nest-auth.
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.