ModKit is a self-hosted Postgres + TypeScript (modkit-server) + Swift 6 / SwiftUI (ModKit) toolkit that gives iOS apps everything required by App Store Review Guideline 1.2 (User-Generated Content):
- Terms of Use (EULA) Gate —
.modKitTermsGate(store:)requires users to agree to zero-tolerance terms before viewing or contributing UGC. - Automated Content Filtering — Supabase Database Webhook processor (
/v1/webhooks/content) runs multimodal image + text moderation via OpenAI (omni-moderation-latest) or AWS Rekognition (DetectModerationLabels). - Content Reporting & 24-Hour Triage —
ModerationMenulets users report content, hides the item from the reporter immediately, flags it inmodkit.items, and alerts operators via Slack or Email (npx modkit-server reports resolve). - Abusive User Blocking —
ModerationMenuandBlockedUsersViewlet users block/unblock authors, immediately removing their content locally and via Postgres RLS (modkit.is_visible). - Published Contact & Support Links —
ModerationSettingsSectionembeds Terms of Use, Contact & Support, and Blocked Users management directly into your app'sSettingsView.
flowchart LR
iOS["iOS App (ModKit SwiftUI)<br/>• .modKitTermsGate<br/>• ModerationMenu<br/>• ModerationSettingsSection"] <-->|"/v1/state, /v1/terms/accept,<br/>/v1/reports, /v1/blocks"| Server["modkit-server<br/>(Supabase Edge Function / Node 22)"]
Server <--> DB[("Postgres (modkit schema)<br/>• modkit.is_visible(...)<br/>• modkit.is_banned(...)")]
DB -->|"Database Webhook<br/>(INSERT / UPDATE)"| Server
Server -->|"Image + Text"| Classifier["OpenAI omni-moderation-latest<br/>or AWS Rekognition"]
Server -->|"Immediate Alert"| Notifier["Slack Webhook /<br/>Email (Resend)"]
| Component | Directory | Guide |
|---|---|---|
iOS SDK (ModKit Swift 6, iOS 18+, zero dependencies) |
ios/ |
iOS SDK Guide (ios/README.md) |
Server, Adapters & CLI (modkit-server, Node 22 / Supabase Edge Functions) |
server/ |
Server & CLI Guide (server/README.md) |
| Complete Specification & Adoption Guide | MODERATION_SPEC.md |
Full Spec (MODERATION_SPEC.md) |
npx modkit-server migrations copy ./supabase/migrations
Then call modkit.is_visible(auth.uid()::text, user_id::text, 'your_target_type', id::text, 'post') in your table's SELECT RLS policy and NOT modkit.is_banned(auth.uid()::text) in your INSERT RLS policy.
See examples/supabase/functions/modkit/index.ts for a drop-in Supabase Edge Function wired to postgresStore, supabaseJwt, openAIClassifier, slackNotifier, and supabaseStorage.
Add https://github.com/Liampronan/ModKit (1.0.0-beta.3) in Xcode or Package.swift:
import ModKit import SwiftUI // 1. Gate root UGC view on EULA acceptance TrashMapView() .modKitTermsGate(store: moderationStore) // 2. Drop ModerationMenu into any story/post view ModerationMenu( targetType: "trash_pickup", targetId: item.id.uuidString, authorId: item.userId.uuidString, currentUserId: currentUser?.id, store: moderationStore, onHide: { dismiss() } ) // 3. Add Blocked Users, Terms, and Contact links to Settings ModerationSettingsSection(store: moderationStore)
When a user submits a report, ModKit notifies your configured Slack or Email sink immediately. Resolve open reports within the 24-hour App Store SLA via the operator CLI:
npx modkit-server reports list --db "$DATABASE_URL" --status open npx modkit-server reports resolve <report-id> --action remove --note "Removed objectionable photo" --db "$DATABASE_URL"
ModKit keys users by text without a foreign key to auth.users. When deleting a user's account from your own delete-user Edge Function or backend, purge their ModKit records via the SECURITY DEFINER SQL function, the store method, or the CLI:
-- From SQL / Supabase service_role RPC: SELECT modkit.delete_user_data('user-uuid-here');
// From modkit-server store: await store.deleteUserData(userId)
# From the operator CLI: npx modkit-server users delete <user-id> --db "$DATABASE_URL"
This deletes the user's terms_acceptances, blocks (both directions), filed reports, and authored items. By default, modkit.bans rows are preserved (delete_ban = false) so banned users retain their ban record and audit trail; pass modkit.delete_user_data(user_id, true), store.deleteUserData({ userId, deleteBan: true }), or --delete-ban if you also want to remove any ban row.
MODERATION_SPEC.md— Complete Postgres schema,/v1wire spec, Swift API contract, andtrash-appadoption guide.ios/README.md— Swift package integration,ModKitClient,ModerationStore, and SwiftUI views.server/README.md— Server configuration, classifiers, notifiers, andnpx modkit-serverCLI reference.PRIVACY.md&SECURITY.md— Privacy manifest details and security model.