A Node.js web app for filtering profanity from user-generated content. Perfect for moderating comments, chat messages, and user submissions.
This tutorial requires an APIVerve API key. Sign up free - no credit card required.
- 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
-
Clone this repository
git clone https://github.com/apiverve/content-moderator-node-tutorial.git cd content-moderator-node-tutorial -
Install dependencies
npm install
-
Add your API key
Set environment variable or edit
server.js:export API_KEY=your-api-key-here -
Start the server
npm start
-
Open in browser
Visit http://localhost:3000 and test the moderator!
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
- User enters text in the web interface
- Frontend sends POST request to
/api/moderate - Server calls the Profanity Filter API
- API returns filtered text and flagged words
- Frontend displays results with status
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: '*'
})
});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
}
}- 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
- 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
Explore more APIs at APIVerve:
- Spam Detector - Detect spam content
- Sentiment Analysis - Analyze text sentiment
- Content Filter - Advanced content filtering
This tutorial works with the free APIVerve plan. Some APIs may have:
- Locked fields: Premium response fields return
nullon 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.
MIT - see LICENSE
- Get API Key - Sign up free
- APIVerve Marketplace - Browse 300+ APIs
- Profanity Filter API - API details
