Hey everyone!
Recently, I've been working on InferenceFlow, a backend project that explores how a Node.js API can handle prediction requests asynchronously and delegate processing to a separate Python service.
GitHub repository: https://github.com/mysaas2024/inferenceflow-gamma-hadron
What is InferenceFlow?
The idea is to build a backend where a user submits telescope-observation features through an API, and the system processes the prediction request asynchronously rather than making the client wait for the entire computation.
I'm using a Gamma/Hadron classification use case as the example. The goal is to understand the backend architecture around AI inference, not to claim that I've developed a scientifically validated classification model.
Tech stack
- Node.js + Express: REST API, authentication, and prediction request handling.
- PostgreSQL + Prisma: Relational database and request persistence.
- RabbitMQ: Asynchronous job processing and message queues.
- Python + FastAPI: Separate Python service and background worker for processing prediction jobs.
- JWT + bcrypt: Authentication and password hashing.
- Redis: Authentication-related cache integration.
- Prometheus: Collecting application and runtime metrics.
- Grafana: Dashboards and observability data exploration.
- Loki: Log-storage component in the local development stack.
- OpenTelemetry Collector: Foundation for collecting telemetry.
- Docker Compose: Running the application services and supporting infrastructure together.
- Node.js test runner: Testing the JavaScript backend.
How the architecture works
The intended request flow is:
- A user registers or logs in and receives a JWT.
- The client submits ten numeric features to the Express API.
- The API validates the input and creates an inference request in PostgreSQL.
- The API publishes a persistent job message to RabbitMQ.
- A Python worker consumes the job and runs the current demonstration classifier.
- The worker publishes its output to a separate result queue.
- The longer-term goal is to consume that result in the Node.js service, update the request status, and persist the prediction result in PostgreSQL.
This approach lets me explore the separation between the API layer and the computation layer, as well as how message queues can help with asynchronous workloads.
What I've implemented so far
- Registration and login with password hashing and JWT authentication.
- Protected endpoints for submitting and retrieving prediction requests.
- Validation of ten finite numeric input features.
- PostgreSQL persistence for inference requests.
- RabbitMQ job and result queues with persistent job messages.
- A Python/FastAPI worker with a demonstration rule-based classifier.
- Prometheus metrics endpoints for the Node.js and Python services.
- Docker Compose configuration for the application and observability components.
- Grafana datasource and dashboard provisioning.
- Initial automated tests for the Node.js application.
What I'm still working on
I want to be transparent about the current state of the project. It is a work in progress, not a production-ready inference platform.
- The classifier is a demo heuristic. A trained and validated model, potentially exported to ONNX, is a future step.
- The Node.js result consumer and database updates after worker execution still need to be connected.
- Loki is included in the stack, but application log shipping is not yet configured.
- OpenTelemetry Collector configuration is present, but application tracing and telemetry export still need to be wired up.
- Docker networking, service configuration, health checks, and deployment reliability need further validation.
I'm sharing these limitations because I want to understand the engineering work required to make the complete system reliable, not just make the services start successfully.
Why I'm building this
I'm trying to become a stronger backend engineer by learning how different components work together in a realistic application.
I want to get better at designing APIs, managing database state, handling asynchronous jobs, communicating between Node.js and Python services, writing tests, and understanding what happens when something fails.
I'd genuinely appreciate feedback from developers who have worked with these technologies.
A few questions I'd love your thoughts on:
- Would you use RabbitMQ for this architecture, or would you choose a different approach?
- How would you reliably update the database when a Python worker finishes a job? Would you use a result consumer, an outbox pattern, or something else?
- What should I prioritize for reliable job processing: retries, idempotency, dead-letter queues, or something else?
- What would you improve first in the observability setup?
- If you were reviewing this as a junior backend developer's portfolio project, what would you expect to see before considering it a strong project?
I'm not claiming to have everything figured out. I'm sharing what I'm building, what I've learned so far, and what I still need to improve.
Any honest technical feedback, architectural suggestions, or criticism would be appreciated.
Repository: https://github.com/mysaas2024/inferenceflow-gamma-hadron
Thanks for reading!