Skip to content

[WIP] High-performance distributed queue and appointment scheduling system using NestJS, Kafka, PostgreSQL, Elasticsearch, and Rust.

Notifications You must be signed in to change notification settings

tsabudh/telequeue

Repository files navigation

TeleQueue

⚡ Status: Currently under active development.

TeleQueue is a high-performance distributed queue and appointment scheduling system being built with NestJS, Kafka, PostgreSQL, Elasticsearch, and Rust. It is being designed to handle large-scale, real-time processing with strict ordering and fault tolerance. For real life scenario where booking request spikes the moment booking is opened.


Features

  • Distributed Sequencer: Powered by Rust (Raft-based) to guarantee globally unique, strictly ordered sequence IDs.
  • Event-driven Architecture: Kafka as the backbone for reliable message streaming.
  • Microservices: Modular services like api-gateway, appointments, and queues.
  • Elasticsearch Integration: Real-time indexing and advanced search queries.
  • PostgreSQL Database: Primary relational storage for transactional data.
  • Dockerized Environment: Ready-to-run with docker-compose.
  • Scalable Design: Horizontal scaling via Kafka partitions and microservices.

Tech Stack

  • Backend: NestJS, TypeScript
  • Messaging: Kafka
  • Database: PostgreSQL
  • Search Engine: Elasticsearch
  • Rust: Raft-based distributed sequencer
  • Containerization: Docker & Docker Compose

Architecture

[ API Gateway ] <---> [ Appointments Service ]
      |                      |
      |                      v
      |                  [ Queues Service ] <---> [ Kafka ]
      |                                              |
      |                                              v
      |                                     [ PostgreSQL / Elasticsearch ]
      |
      v
[ Clients (REST) ]

Getting Started

1. Clone the Repository

git clone https://github.com/tsabudh/telequeue.git
cd telequeue

2. Environment Variables

Create .env files in each service (e.g., apps/api-gateway/.env) with appropriate values: Create .env apps/appointment/.env:

HTTP_PORT=3001

Create .env apps/appointment/.env:

KAFKA_BROKER=kafka:9092
ELASTICSEARCH_URL=http://elasticsearch:9200

Create .env libs/common/src/.env:

DATABASE_URL=postgresql://telequeue_app:telequeue_pass@postgres:5432/telequeue_write_db
KAFKA_BROKER=kafka:9092

3. Start the Services

Use Docker Compose:

docker-compose up --build

The API gateway will be available on:

  • API Gateway: http://localhost:3001

Available Services

  • api-gateway: Entry point for clients (REST/GraphQL).
  • appointments: Manages appointment scheduling.
  • queues: Handles queue management and distributed sequencing. (in development)
  • postgres: Database for transactional data. (in development)
  • kafka: Message streaming backbone.
  • elasticsearch: Full-text search and analytics. (in development)

Development

Watch Mode

Run any service in watch mode:

Syntax

npm run start:dev -- apps/{service-name}

Example

npm run start:dev -- apps/api-gateway

Migrations

To run database migrations (if using TypeORM):

npm run typeorm migration:run

Testing

npm run test
npm run test:e2e
npm run lint

Contributing

We welcome contributions! Please:

  1. Fork the repo.
  2. Create a feature branch.
  3. Submit a pull request.

License

This project is licensed under the MIT License.


Future Roadmap

  • Integrate gRPC communication between microservices.
  • Implement Raft-based leader election for the Rust sequencer with horizontal scaling.
  • Add monitoring and observability (Prometheus + Grafana).
  • Improve horizontal scalability with Kafka partition optimization.
  • Enhance API Gateway with GraphQL Federation and caching.
  • Add authentication & authorization (OAuth2 / JWT).
  • Automate Kafka topic management and monitoring.
  • Set up CI/CD pipeline (GitHub Actions / GitLab CI).

About

[WIP] High-performance distributed queue and appointment scheduling system using NestJS, Kafka, PostgreSQL, Elasticsearch, and Rust.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published