How alen-kuriakose/content-moderation-service works
Project type and purpose
• This is a backend microservice built with FastAPI. Its sole purpose is to expose two moderation endpoints—one for text (using Google Cloud Natural Language API) and one for images (using Google Cloud Vision API). It has no database of its own; it acts as a stateless API gateway to two external Google Cloud services.
File structure
• Top level: Dockerfile, requirements.txt, README.md, .env expectations.
• src/main.py: Instantiates the FastAPI app, loads config, logging, and includes routes.
• src/routes/api.py: Registers the /moderate_text/ and /moderate_image/ routes, mapping them to controller functions.
• src/api/v1/*: Controller layer (or “handlers”) for version 1 of the API: text_moderation.py and image_moderation.py.
• src/schemas/moderation.py: Pydantic models for request/response payloads.
• src/services: Two service classes, LanguageService and VisionService, which encapsulate all calls to Google Cloud APIs.
• src/core/config.py & src/core/logger.py: Configuration loading (via .env) and logging setup with logging.conf.
README for technical stack and patterns
• FastAPI for web framework, Uvicorn for ASGI server.
• Google Cloud credentials provided via environment variable.
• Docker for containerization.
• No mention of in-process caching or persistence; it is stateless and simply forwards requests.