Skip to content

luigi-raynel-dev/getpix_pix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🔑 Getpix Pix Microservice

The Getpix Pix microservice is responsible for managing all operations related to user Pix keys, including creating, updating, retrieving, and deleting (CRUD). Built with HyperF and powered by Swoole and leveraging gRPC for high-performance communication, it serves as the core business logic for Pix key management within the Getpix ecosystem.

🧱 Tech Stack

  • HyperF + Swoole — High-performance PHP framework for async operations.
  • gRPC — Efficient binary communication between services.
  • PHP 8 — Strong-typed modern PHP code.
  • Docker + Docker Compose — Containerized infrastructure.
  • MongoDB — NoSQL database for logging and analytics.

🏗️ Architecture

[ Client ]
   |
   v
[ Getpix Gateway API ]
   |        \
   |         \-> (Kafka Topic) --> [ getpix_logs ]
   |
   \-> (gRPC) --> [ getpix_pix ]

📚 Repositories - Getpix ecosystem:

  • getpix_gateway: API Gateway responsible for orchestrating communication between services.

  • getpix_logs: Kafka consumer that stores logs into MongoDB.

🚀 Getting Started

✅ Requirements

📦 Running the Application

git clone https://github.com/luigi-raynel-dev/getpix_pix.git
cd getpix_pix

Start all services with Docker Compose:

docker compose up -d

Install composer packages into container

docker exec -it getpix_app bash -c "composer install --ignore-platform-req=ext-mongodb"

Copy the .env.example file into the html folder and rename it to .env.
Then, fill in the environment variables according to your configuration.

📄 Example .env content:

APP_NAME=skeleton
APP_ENV=dev

MONGODB_URI="mongodb://mongo:27017"
MONGODB_DATABASE="getpix"

REDIS_HOST=localhost
REDIS_AUTH=(null)
REDIS_PORT=6379
REDIS_DB=0

KAFKA_SERVERS="getpix_kafka:9092"
KAFKA_LOGS_TOPIC="getpix.logs"

📦 Database - MongoDB Setup

The Getpix ecosystem uses MongoDB to store and manage data.

You have two options to get it running

  • Option 1: Use MongoDB Atlas (Free)
    • Go to https://www.mongodb.com/cloud/atlas
    • Create a free account and cluster
    • Whitelist your IP and create a database user
    • Replace MONGODB_URI in your .env with your Atlas connection string Example: MONGODB_URI="mongodb+srv://<user>:<password>@cluster0.mongodb.net/?retryWrites=true&w=majority"
  • Option 2: Run MongoDB with Docker
    • If you prefer to run MongoDB locally with Docker:
    docker run -d \
    --name mongo \
    -p 27017:27017 \
    -e MONGO_INITDB_ROOT_USERNAME=root \
    -e MONGO_INITDB_ROOT_PASSWORD=secret \
    mongo
    • Replace MONGODB_URI in your .env with connection string Example: MONGODB_URI="mongodb://root:secret@localhost:27017"

✅ Running Unit Tests

This project includes unit tests using PHPUnit and hyperf/testing to ensure everything is working as expected.

To run the tests, make sure the container getpix_app is running and the necessary services are up and runnig.

▶️ Run the tests with the following command:

docker exec -it getpix_app bash -c "composer run test"

About

Microservice for Pix management using HyperF + Swoole, Docker, gRPC, Kafka and MongoDB.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors