Customer reviews are essential for e-commerce platforms. However, moderating them is often tedious, especially when the majority are positive or benign. Manual moderation of every review is inefficient, so the main challenge is how to concentrate human effort where it truly matters: on potentially harmful, inappropriate content or feedback that may be valuable to fix products issues and create a better customer experience.
Demos
User submitting a positive review
Positive review metaobject

User submitting a negative review
Negative review metaobject

From constraints to solution
Thinking about this customer review moderation feature, several requirements and constraints stood out:
- Automated filtering should quickly identify content that can be published immediately versus those requiring human review.
- The system needs to identify toxic language, spam, advertisements, and negative sentiment.
- It must integrate with the Shopify platform’s data model, especially Metaobjects.
- AI inference should be scalable, maintainable, and cost-effective.
- Transparency in the AI decisions is useful to assign flags and trigger moderation actions.
My solution puts AI in a supporting role as a filter rather than a final judge of content. I centralized the AI moderation into a dedicated FastAPI service that runs multiple Hugging Face pipelines, each specializing in a different classification task related to review quality and safety.
Why use Hugging Face Pipelines for moderation?
Hugging Face Pipelines provide a straightforward interface for deploying various pretrained models to handle tasks like sentiment analysis, toxicity detection, and spam classification. They abstract away model loading, tokenization, and output parsing, simplifying integration.
The advantages in this context include:
- Ready-to-use models accelerate development without training custom models.
- Pipelines support multiple classification tasks that matter for moderation.
- They produce structured, interpretable outputs (e.g., sentiment scores, toxicity flags).
- They can be updated easily as new models and policies evolve.
- Cost efficiency: no need for large data labeling or retraining, reducing both initial and ongoing expenses.
Given the wide availability of relevant pretrained models from Hugging Face’s model hub, pipelines are a good fit for the requirements of review moderation.
High-level process overview
The system’s flow follows this sequence:
- The user enters a review in a form on the Shopify product detail page.
- The review data is sent to a backend middleware service (here powered by Brush) via Shopify’s front-end and App Proxy mechanisms.
- Brush acts as a centralized API gateway and integration platform, forwarding the review content to the AI FastAPI moderation service.
- The FastAPI service runs Hugging Face Pipelines with models specialized in toxicity, sentiment, and spam classification. The output includes flags like
toxicity,negative_review,spam, oradvertisement. - Based on these flags, FastAPI determines an
actionfield: whether the reviewmust_review(require human approval) orcan_publishimmediately. - The FastAPI service responds to Brush with this enriched moderation result.
- Brush uses the moderation outcome to create review metaobjects in Shopify Admin via its APIs, setting review states like “Draft” for reviews requiring human moderation or “Active” for approved content.
- The product detail page reviews section and listing show only reviews with status “Active”, thus preventing problematic reviews from displaying prematurely.
This process ensures that human moderators focus attention only where needed, reducing workload and improving trust in the review system.
The role of Brush as middleware
Brush is the bridge between Shopify’s front-end and the AI service. I used it to:
- Manage API endpoints exposed to the front-end.
- Compose logic to call the external moderation service.
- Translate moderation results into Shopify metaobjects.
- Keep the Shopify side decoupled from AI service specifics.
Brush receives POST requests at /customer-reviews (the user-submitted reviews) and triggers the call to /customer-review/moderate on the FastAPI service.
FastAPI moderation API
The dedicated FastAPI service:
- Loads and manages multiple Hugging Face Pipelines:
- A
toxicityclassifier based on unitary/toxic-bert. - A
sentimentanalysis using distilbert-based models. - A spam detector via zero-shot-classification with a facebook/bart-large-mnli model.
- A
- Integrates results by adding explicit flags and assigns an action.
- Returns this moderation data back to Brush.
This separation keeps AI model concerns isolated, enabling easier scalability or model swapping.
Shopify integration with metaobjects
Shopify’s Admin API supports dealing with metaobjects, which I used to represent reviews as entries with fields for rating, review text, and moderation flags.
- Reviews requiring human intervention are created as “Draft”.
- Approved reviews receive the “Active” status.
The system filters to display only “Active” reviews publicly, preventing premature or unsafe content exposure.
This integration provides a native way to store enriched metadata alongside reviews.
Designing for change
By separating concerns with Brush acting as middleware and FastAPI as the AI inference layer, the system offers flexibility:
- Models can be updated or swapped inside FastAPI without impacting Shopify integration.
- Brush can incorporate new API calls or business logic for moderation workflows independently.
- Shopify metaobjects allow easy expansion of the review schema.
In this project, I tried to enforce the principle that AI should assist human moderation, not replace it, focusing effort on problematic content while automating the straightforward majority.
Automated moderation with Hugging Face Pipelines strikes a practical balance between operational complexity, accuracy and cost efficiency, serving the real-world constraints of e-commerce businesses.
The architecture described is therefore not a black-box but a pragmatic tool to lighten the human workload and uphold review quality at scale.