GithubHelp home page GithubHelp logo

hassonor / ts-node-express-redis-bull-template Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 126 KB

TypeScript 73.03% EJS 26.97%
bull bunyan express nodejs queues socket-io ts workers boilerplate template-project

ts-node-express-redis-bull-template's Introduction

TS-Node-Express-Redis-Bull Template

Welcome to the TS-Node-Express-Redis-Bull template! Dive into a world-class development experience with this cutting-edge template, tailored for developers who seek excellence. Harness the power of TypeScript, Node.js, Express, Redis, and Bull to craft scalable, efficient, and robust web applications.

๐Ÿ“‚ Structure

  • src/app.ts: The main application entry point.
  • src/config.ts: Configuration settings for the application.
  • src/routes.ts: Defines the application routes.
  • src/setupDatabase.ts: Set up the database connection.
  • src/setupServer.ts: Configures and sets up the Express server.
  • src/shared/globals/helpers/error-handler.ts: Global error handler.
  • src/shared/globals/helpers/helpers.ts: Utility and helper functions.
  • src/shared/services/db/auth.service.ts: Authentication service.
  • src/shared/services/db/user.service.ts: User service.
  • src/shared/services/emails/mail.transport.ts: Email transport configuration.
  • src/shared/services/queues/auth.queue.ts: Authentication queue.
  • src/shared/services/queues/base.queue.ts: Base queue.
  • src/shared/services/queues/email.queue.ts: Email queue.
  • src/shared/services/queues/user.queue.ts: User queue.
  • src/shared/services/redis/base.cache.ts: Base cache for Redis.
  • src/shared/services/redis/redis.connection.ts: Redis connection setup.
  • src/shared/services/redis/user.cache.ts: User cache in Redis.
  • src/shared/sockets/user.socket.ts: User socket configuration.
  • src/shared/workers/auth.worker.ts: Authentication worker.

๐ŸŒŸ Features

  • TypeScript: Strongly-typed JavaScript for better developer experience.
  • Node.js & Express: Fast and scalable backend framework.
  • Redis: In-memory data structure store used for caching and as a message broker.
  • Bull: A Node.js library that provides robust job and message queue based on Redis.
  • Modular Structure: Organized and modular code structure for scalability and maintainability.
  • Error Handling: Global error handler for handling exceptions and errors.
  • Authentication: Built-in authentication using JWT.
  • Email Service: Integrated email service for sending emails.
  • Web Sockets: Real-time bidirectional event-based communication.
  • Workers: Separate workers for handling background tasks. ... and more!

Getting Started

  1. Redis: Set it up with this Guide
  2. Redis Commander: Get it running with this Guide
  3. Install dependencies: npm i
  4. Start the development server: npm run dev
  5. Run tests: npm run test
  6. Redis Cache URL: http://localhost:8081
  7. Bull Queues: http://localhost:5000/queues/queue/auth

API Request Examples

1. SignUp Request

To set your avatar image, you'll need to provide the image in a Base64 encoded format. Here's an example of the expected JSON structure:

Endpoint:
POST http://localhost:5000/api/v1/signup

Raw Body:

{
    "username": "orh4",
    "password": "zfq23546ydfg",
    "email": "[email protected]",
    "avatarColor": "red",
    "avatarImage": "YOUR_BASE64_ENCODED_IMAGE_HERE"
}

2. SignIn Request

Endpoint:
POST http://localhost:5000/api/v1/signin

Raw Body:

{
   "username": "orh4",
   "password": "zfq23546ydfg"
}

3. Forgot Password Request

Endpoint:
POST http://localhost:5000/api/v1/forgot-password

Raw Body:

{
   "email": "[email protected]"
}

4. Reset Password Request

Note: You need to paste the token from the mail. Endpoint:
POST http://localhost:5000/api/v1/forgot-password/:token

Raw Body:

{
   "password": "someNewPassword",
   "confirmPassword": "someNewPassword"
}

5. SignOut Request

Endpoint:
GET http://localhost:5000/api/v1/signout

6. CurrentUser Request

Endpoint:
GET http://localhost:5000/api/v1/currentUser

ts-node-express-redis-bull-template's People

Contributors

hassonor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.