Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⬡ ShieldX — AI Moderation SaaS

Production-grade, multi-tenant AI content moderation platform.

Stack

Layer Technology
Frontend React 18 + Vite + Recharts
Backend Node.js + Express
Database MongoDB + Mongoose
Auth JWT + Role-based access
Deployment Docker + Docker Compose

Quick Start

With Docker (recommended)

# 1. Clone and configure
cp .env.example .env
# Edit .env — set JWT_SECRET at minimum

# 2. Build and start
docker-compose up --build

# App is live at http://localhost

Local Development

# Backend
cd backend
cp .env.example .env   # configure
npm install
npm run dev            # runs on :5000

# Frontend (separate terminal)
cd frontend
npm install
npm run dev            # runs on :5173 with proxy to :5000

Project Structure

shieldx/
├── backend/
│   └── src/
│       ├── config/         # DB connection
│       ├── controllers/    # Route handlers
│       ├── middleware/     # Auth, RBAC, tenant isolation, errors
│       ├── models/         # Mongoose schemas
│       ├── routes/         # Express routers
│       ├── services/
│       │   └── moderation/ # Pluggable AI strategy pattern
│       ├── utils/          # Logger, AppError, response helpers
│       └── validators/     # express-validator chains
├── frontend/
│   └── src/
│       ├── context/        # Auth context
│       ├── pages/          # Dashboard, Comments, Offenders, Settings
│       ├── components/     # Layout, charts, UI
│       └── services/       # Axios API client
└── docker-compose.yml

API Reference

Auth

Method Path Auth Description
POST /api/auth/register Create org + owner
POST /api/auth/login Login
GET /api/auth/me JWT Current user
POST /api/auth/invite owner/admin Add team member

Comment Ingestion (server-to-server)

curl -X POST http://localhost:5000/api/comments/ingest \
  -H "X-API-Key: sx_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Your comment text here",
    "authorExternalId": "user_123",
    "authorUsername": "johndoe",
    "source": { "platform": "web", "contentId": "post_456" }
  }'

Comments

Method Path Auth Description
GET /api/comments JWT List with pagination/filters
GET /api/comments/:id JWT Single comment
PATCH /api/comments/:id/review moderator+ Approve or remove

Offenders

Method Path Auth Description
GET /api/offenders JWT List sorted by risk
PATCH /api/offenders/:id/ban moderator+ Ban offender
PATCH /api/offenders/:id/unban admin+ Unban offender

Analytics

Method Path Auth Description
GET /api/analytics/dashboard JWT Dashboard data
GET /api/analytics/metrics?days=7 JWT Metrics for N days
GET /api/health Health check

AI Moderation Strategies

Set MODERATION_STRATEGY in .env:

Strategy Description
mock Keyword-based heuristic (default, dev/test)
perspective Google Perspective API (requires PERSPECTIVE_API_KEY)

To add a custom strategy:

  1. Create backend/src/services/moderation/YourStrategy.js extending BaseStrategy
  2. Implement async moderate(content) returning { score, flagged, categories, strategy, raw }
  3. Register in ModerationFactory.js

Roles

Role Permissions
owner Full access + plan management
admin Settings + user management
moderator Review comments, ban/unban
viewer Read-only

Subscription Plans

Plan Limit Price
Free 1,000 comments/mo Free
Pro 50,000 comments/mo $49/mo
Enterprise Unlimited $199/mo

Billing is Stripe-ready — see backend/src/services/billing.service.js to wire up Stripe.

Security

  • Helmet HTTP headers
  • Rate limiting (100 req/15min global, 20 req/15min auth)
  • Mongo sanitize (NoSQL injection prevention)
  • XSS clean middleware
  • JWT with password-change invalidation
  • Tenant isolation on every query
  • UUID request tracing
  • Winston structured logging

About

Multi-tenant AI comment moderation tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages