An experimental API for detecting hate speech and profanity, incorporating rate limiting and request validation functionality, and deploying it on Cloudflare Workers.
- Check Profanity
- Request Validation
- Rate Limiting Api
- Tech Stack
- Installation
- Important
- Environment Variables
- Starting the Development Server
- Contributing
- Live Preview
- TypeScript
- Hono
- Zod
- Upstash Redis
- Upstash Rate Limit
- Upstash Vector
Make sure you have Node.js installed on your machine.
Clone the repository:
git clone https://github.com/nyintosh/profanity-api
Navigate to the project directory:
cd profanity-api
Install dependencies: Run one of the following commands based on your preferred package manager:
- Using npm:
npm install
- Using yarn:
yarn install
- Using pnpm:
pnpm install
To run this locally, make sure you've set up Redis and Vector on Upstash and obtained API keys. Alternatively, you can utilize similar technologies and update the configuration accordingly.
This project requires the following environment variables:
VECTOR_URL
VECTOR_TOKEN
Ensure environment variables are set and wrangler.toml
is configured according to the provided example file for seamless development.
To start the development server: Run one of the following commands based on your preferred package manager:
- Using npm:
npm run dev
- Using yarn:
yarn dev
- Using pnpm:
pnpm dev
If you want to add additional features and improvements, we welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
You can test the API of the project at https://profanity-api.nyintosh.workers.dev. Below are the documentation details for the API endpoint:
- Endpoint: /
- Method: POST
- Content Type: application/json
- Request Body:
{ "text": "string" }