Skip to content

Content moderation tool for filtering profanity built with Node.js

License

Notifications You must be signed in to change notification settings

apiverve/content-moderator-node-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Content Moderator | APIVerve API Tutorial

License: MIT Build Node.js Express APIVerve | Profanity Filter

A Node.js web app for filtering profanity from user-generated content. Perfect for moderating comments, chat messages, and user submissions.

Screenshot


Get Your Free API Key

This tutorial requires an APIVerve API key. Sign up free - no credit card required.


Features

  • Filter profanity from any text input
  • Customizable mask character (*, #, etc.)
  • Shows filtered result and flagged words
  • Clean/Flagged status indicator
  • Count of profane words found
  • Modern, responsive UI
  • Built with Express.js

Quick Start

  1. Clone this repository

    git clone https://github.com/apiverve/content-moderator-node-tutorial.git
    cd content-moderator-node-tutorial
  2. Install dependencies

    npm install
  3. Add your API key

    Set environment variable or edit server.js:

    export API_KEY=your-api-key-here
  4. Start the server

    npm start
  5. Open in browser

    Visit http://localhost:3000 and test the moderator!

Project Structure

content-moderator-node-tutorial/
├── server.js           # Express server & API endpoint
├── public/
│   └── index.html      # Frontend UI
├── package.json        # Dependencies
├── screenshot.jpg      # Preview image
├── LICENSE             # MIT license
├── .gitignore          # Git ignore rules
└── README.md           # This file

How It Works

  1. User enters text in the web interface
  2. Frontend sends POST request to /api/moderate
  3. Server calls the Profanity Filter API
  4. API returns filtered text and flagged words
  5. Frontend displays results with status

The API Call

const response = await fetch('https://api.apiverve.com/v1/profanityfilter', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': API_KEY
  },
  body: JSON.stringify({
    text: 'Text to moderate',
    mask: '*'
  })
});

API Reference

Endpoint: POST https://api.apiverve.com/v1/profanityfilter

Request Body:

Parameter Type Required Description
text string Yes Text to filter
mask string No Character to replace profanity (default: *)

Example Response:

{
  "status": "ok",
  "error": null,
  "data": {
    "isProfane": true,
    "filteredText": "Today is so **** hot! Why the **** would anyone go outside?",
    "mask": "*",
    "trimmed": false,
    "profaneWords": 2
  }
}

Use Cases

  • Comment moderation - Filter user comments before posting
  • Chat applications - Real-time message filtering
  • User profiles - Validate usernames and bios
  • Reviews - Clean up product/service reviews
  • Forums - Moderate discussion posts
  • Gaming - Filter in-game chat

Customization Ideas

  • Add batch processing for multiple texts
  • Save moderation history to database
  • Add different severity levels
  • Implement allow/block lists
  • Add real-time filtering as you type
  • Build a moderation dashboard with statistics

Related APIs

Explore more APIs at APIVerve:

Free Plan Note

This tutorial works with the free APIVerve plan. Some APIs may have:

  • Locked fields: Premium response fields return null on free plans
  • Ignored parameters: Some optional parameters require a paid plan

The API response includes a premium object when limitations apply. Upgrade anytime to unlock all features.

License

MIT - see LICENSE

Links

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors