Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sidhyaashu/e-commerce-using-microservices
Microservice using kafka, prisma, elasticsearch etc etc
https://github.com/sidhyaashu/e-commerce-using-microservices
drizzle elasticsearch graphql kafka prisma
Last synced: about 1 month ago
JSON representation
Microservice using kafka, prisma, elasticsearch etc etc
- Host: GitHub
- URL: https://github.com/sidhyaashu/e-commerce-using-microservices
- Owner: sidhyaashu
- Created: 2024-11-05T14:15:41.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-27T10:24:48.000Z (about 1 month ago)
- Last Synced: 2024-11-27T11:26:11.620Z (about 1 month ago)
- Topics: drizzle, elasticsearch, graphql, kafka, prisma
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Here's a sample `README.md` file for a microservices project that leverages technologies such as Kafka, Prisma, Elasticsearch, GraphQL, and Drizzle. The structure includes an overview, prerequisites, installation instructions, usage details, and any additional considerations you might want to include.
---
# Microservice Project with Kafka, Prisma, Elasticsearch, GraphQL, and Drizzle
This project demonstrates a microservices architecture using several modern technologies:
- **Kafka** for messaging and asynchronous communication between services
- **Prisma** as an ORM for managing database interactions
- **Elasticsearch** for fast, scalable search functionality
- **GraphQL** for flexible and efficient API querying
- **Drizzle** as a SQL query builder for more robust and flexible database queries## Table of Contents
- [Overview](#overview)
- [Technologies Used](#technologies-used)
- [Architecture](#architecture)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [Usage](#usage)
- [Running the Services](#running-the-services)
- [Development Guidelines](#development-guidelines)
- [Contributing](#contributing)
- [License](#license)## Overview
This project showcases how to set up a microservices ecosystem with Kafka for communication, Prisma for ORM, and Elasticsearch for search. It supports GraphQL APIs for data retrieval, allowing for efficient, customizable queries. Drizzle is also used to extend SQL capabilities.
Each microservice is designed to be independently deployable and scalable, with Kafka facilitating decoupled communication.
## Technologies Used
- **Kafka** - Asynchronous messaging and event streaming.
- **Prisma** - ORM for database interactions, supporting TypeScript.
- **Elasticsearch** - Full-text search and analytics engine.
- **GraphQL** - Query language for APIs.
- **Drizzle** - SQL query builder to complement Prisma.
- **Docker** - Containerization for easy deployment.## Architecture
This project is built around an event-driven, microservices-based architecture where services communicate via Kafka topics. Each service manages its own data store and uses Prisma as its ORM. Elasticsearch is used to enable fast searches across data, while GraphQL provides flexible querying options.
![architecture-diagram](path/to/architecture-diagram.png) _(Provide an architecture diagram if available)_
## Prerequisites
- **Node.js** (version 16 or higher)
- **Docker** and **Docker Compose** (for containerization)
- **Kafka** (can also be run as a Docker container)
- **Elasticsearch** (version 7.17 or higher)
- **Prisma** CLI (for managing the Prisma schema)
- **Drizzle** (optional for SQL enhancements)> _Note: Using Docker is recommended to simplify service management._
## Installation
1. **Clone the repository**:
```bash
git clone https://github.com/yourusername/microservice-project
cd microservice-project
```2. **Install Dependencies**:
```bash
npm install
```3. **Start Services**:
Ensure all services (Kafka, Elasticsearch) are running. You can use Docker Compose for this:
```bash
docker-compose up -d
```## Environment Variables
Create a `.env` file at the root of your project and add the following:
```plaintext
DATABASE_URL=postgresql://username:password@localhost:5432/yourdb
KAFKA_BROKER=localhost:9092
ELASTICSEARCH_URL=http://localhost:9200
GRAPHQL_PORT=4000
PRISMA_SECRET=your-prisma-secret
```> _Refer to `.env.example` for the full list of environment variables._
## Usage
1. **Database Migration (Prisma)**:
```bash
npx prisma migrate dev
```2. **Run GraphQL API**:
Start the GraphQL server to expose endpoints for querying:
```bash
npm run start:graphql
```3. **Access Elasticsearch**:
Use the Elasticsearch service to query and manage search data:
```bash
curl -X GET "localhost:9200/_search" -H 'Content-Type: application/json'
```4. **Kafka Messaging**:
Set up Kafka consumers and producers for microservice communication. Configure topic names and messaging patterns in the Kafka configurations.## Running the Services
Each microservice can be started independently. For example:
```bash
npm run start:service1
npm run start:service2
```## Development Guidelines
- **Kafka Topics**: Define clear topic naming conventions. Avoid using the same topic for unrelated events.
- **Database Migrations**: Use Prisma migrations to manage schema changes across services.
- **Testing**: Ensure unit and integration tests are available. Mock Kafka and Elasticsearch dependencies where possible.
- **Code Linting**: Use ESLint and Prettier to maintain code quality.## Contributing
Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on our code of conduct, and the process for submitting pull requests.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
Feel free to customize this `README.md` to better match your specific project setup and any additional configurations you may require.