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.
- 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.
- 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!
- Redis: Set it up with this Guide
- Redis Commander: Get it running with this Guide
- Install dependencies:
npm i
- Start the development server:
npm run dev
- Run tests:
npm run test
- Redis Cache URL:
http://localhost:8081
- Bull Queues:
http://localhost:5000/queues/queue/auth
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"
}
Endpoint:
POST
http://localhost:5000/api/v1/signin
Raw Body:
{
"username": "orh4",
"password": "zfq23546ydfg"
}
Endpoint:
POST
http://localhost:5000/api/v1/forgot-password
Raw Body:
{
"email": "[email protected]"
}
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"
}
Endpoint:
GET
http://localhost:5000/api/v1/signout
Endpoint:
GET
http://localhost:5000/api/v1/currentUser