Skip to content

Initial commit: setup FastAPI microservice order_service#1

Merged
loguntsovae merged 20 commits into
mainfrom
develop
Nov 3, 2025
Merged

Initial commit: setup FastAPI microservice order_service#1
loguntsovae merged 20 commits into
mainfrom
develop

Conversation

@loguntsovae

Copy link
Copy Markdown
Owner

No description provided.

@loguntsovae loguntsovae self-assigned this Nov 3, 2025
@loguntsovae loguntsovae requested a review from Copilot November 3, 2025 08:23
@loguntsovae loguntsovae merged commit 6410bb0 into main Nov 3, 2025
9 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive event-driven microservices platform called AsyncFlow, built with FastAPI, RabbitMQ, and PostgreSQL. The system implements an asynchronous order processing workflow with multiple backend services coordinated through message queuing.

Key Changes

  • Implements four core services: Order Service, Billing Service, Auth Service, and API Gateway
  • Establishes RabbitMQ-based event-driven communication between services
  • Sets up containerized deployment with Docker Compose and multi-stage builds
  • Adds comprehensive test suite with async fixtures and mocked dependencies

Reviewed Changes

Copilot reviewed 76 out of 82 changed files in this pull request and generated 19 comments.

Show a summary per file
File Description
order_service/* FastAPI service for order management with SQLAlchemy models, event publishing, and async tests
billing_service/* Consumer service that processes order events and handles payment logic
auth_service/* JWT-based authentication service with user management and Alembic migrations
api_gateway/* Unified API gateway with request forwarding, rate limiting, and metrics collection
frontend/* React/Vite frontend with Nginx serving and API proxying
docker-compose.yml Multi-container orchestration with service health checks and networking
pyproject.toml files Dependency management using uv with strict linting and type checking
.github/workflows/tests.yml CI/CD pipeline for automated testing
Comments suppressed due to low confidence (1)

api_gateway/src/middleware/init.py:10

  • The name 'LoggingMiddleware' is exported by all but is not defined.
    "LoggingMiddleware",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +134 to +140
module = "tests.*"
strict = false
minversion = "8.0"
addopts = "-ra -q --strict-markers --disable-warnings --cov=src --cov-report=term-missing"
testpaths = ["tests"]
pythonpath = ["src"]
asyncio_mode = "auto"

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate pytest configuration detected. Lines 136-140 appear to be pytest settings placed inside the [[tool.mypy.overrides]] section, but they should be under [tool.pytest.ini_options] (which already exists at lines 62-68). Remove these duplicate pytest settings from the mypy overrides section.

Copilot uses AI. Check for mistakes.
db_user: str = Field("postgres", description="Database username")
db_pass: SecretStr = Field("postgres", description="Database password")
db_host: str = Field("db", description="Database hostname")
db_port: int = Field(5434, ge=1, le=65535, description="Database port")

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect default database port. The billing service is configured with port 5434, but PostgreSQL's standard port is 5432. This mismatch with the actual database port (as seen in docker-compose.yml line 21 where PostgreSQL runs on 5432) will cause connection failures. Change the default to 5432.

Copilot uses AI. Check for mistakes.
POSTGRES_USER: str = "postgres"
POSTGRES_PASSWORD: str = "postgres"
POSTGRES_HOST: str = "postgres"
POSTGRES_PORT: int = 5434 # Using a different port to avoid conflicts

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect database port configuration. The auth service is set to use port 5434, but according to docker-compose.yml (line 21), PostgreSQL runs on the standard port 5432. This will cause database connection failures. Change to 5432 and remove the misleading comment about avoiding conflicts.

Copilot uses AI. Check for mistakes.
"MetricsMiddleware",
"get_metrics",
"rate_limit_middleware",
"LoggingMiddleware",

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoggingMiddleware is exported in __all__ but is never imported or defined in this module. This will cause an AttributeError when attempting to import it. Either remove LoggingMiddleware from __all__ or add the corresponding import statement.

Suggested change
"LoggingMiddleware",

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +34
# 🚫 ОТКЛЮЧАЕМ LIFESPAN/СТАРТОВЫЕ КОННЕКТЫ
# ==============================
# Вариант 1: полностью выключим lifespan у httpx-транспорта (см. fixture client)
# Вариант 2 (доп): перестраховка — заменим lifespan контекст на пустой

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are written in Russian (Cyrillic characters) while the rest of the codebase uses English. For consistency and broader team accessibility, translate these comments to English.

Copilot uses AI. Check for mistakes.

import aio_pika
from aio_pika import IncomingMessage
from sqlalchemy.ext.asyncio import AsyncSession

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'AsyncSession' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,14 @@
from sqlalchemy import Column, Integer, Float, DateTime, func, String, ForeignKey

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'ForeignKey' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,71 @@
from pydantic import Field, validator, SecretStr

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'validator' is not used.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,71 @@
from pydantic import Field, validator, SecretStr
from pydantic_settings import BaseSettings
from typing import List, Optional

Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'List' is not used.
Import of 'Optional' is not used.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +28
from fastapi.responses import JSONResponse

return JSONResponse(
status_code=201,
content={"message": "User registered successfully"}
)
# return await ServiceClient.forward_request("auth", "register", "POST", user_data.dict())


Copilot AI Nov 3, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This statement is unreachable.

Suggested change
from fastapi.responses import JSONResponse
return JSONResponse(
status_code=201,
content={"message": "User registered successfully"}
)
# return await ServiceClient.forward_request("auth", "register", "POST", user_data.dict())

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants