Community Technology
Riwaq | Masjid CRM Platform
Multi-tenant mosque operations—with AI that drafts, humans that approve.
01The situation
In 60 seconds
Business problem
Mosques run members, giving, education, volunteers and events on five to seven disconnected tools. Communications are manual, and unreviewed AI copy can invent donation claims.
Unacceptable failure
A community message that states a donation figure, guarantee or endorsement nobody supplied.
Design move
One multi-tenant platform with tenant isolation in the database. AI drafts only from fenced data, and staff approve before anything is sent.
What it shows
AI kept narrow on purpose: it helps the writer and never acts for the mosque.
The problem
Fragmented tools mean fragmented records: weak donor and member continuity, and staff writing every message by hand.
Who feels it
- Mosque staff and admins
- Multi-location organizations
- Members using widgets and portals
What’s at stake
- Member and donor records split across tools.
- Manual communications that eat staff time.
- A fabricated donation claim in a community email.
Constraints
- Every row is scoped to a location with Postgres row-level security.
- Keycloak sign-in and role-based access on API procedures.
- AI sees only one tenant’s fenced DATA.
Failures this system must never produce
-
F1
A fabricated claim in a community message
No invented donation totals, guarantees or political endorsements.
-
F2
Data crossing tenants
One mosque’s members or giving must never reach another.
-
F3
Instructions smuggled in through data
Tenant content is reference material. It must never steer the model.
02The approach
What was built & where AI assists
Each failure gets one mechanism, and each mechanism has proof further down this page.
AI tasks draft only from supplied DATA and omit missing details. A post-generation scan flags risky patterns, and staff approve before send.
Drafts copy and subject lines. It can’t send.
Postgres row-level security on location_id plus platform RBAC. AI tasks receive one tenant’s fenced data.
None. Isolation lives in the database.
The DATA fence marks tenant content as reference material, never instructions.
Reads fenced data; instructions come only from the task.
Where the model works, and where it doesn’t
Model-assisted
- Email copy taskDrafts community email copy from fenced DATA.
- Subject-lines taskSuggests subject lines.
- Poster assistEvent poster prompt path in the worker (Gemini).
Rule-bound or human
- Row-level securityEvery row scoped to a location.
- Role checksKeycloak sign-in and role-based access on API procedures.
- Risky-pattern scanFlags fabricated claims for review after generation.
- WorkersBullMQ jobs for email, PDF and notifications.
- Staff reviewApprove before anything is sent.
AI touchpoints and who decides
AI drafts. Staff decide. The database keeps every mosque’s data to itself.
Click any card for its contract: inputs, outputs, decision authority, and guardrails.
Drafting
Assistive tasks only. None can send.
Checks
Runs after generation, before a person sees the draft.
Authority
Staff own the send button.
Platform
Tenancy enforced below the application.
Guardrails & trust
- No fabricated donation totals, guarantees, or political endorsements.
- DATA fence is reference material—never instructions (injection hardening).
- Omit missing details rather than invent them.
- Platform RBAC + Postgres RLS on tenant data.
03See it work
See it run
A 30-second walkthrough of one community email, and a live demo with a sample mosque.
Live demo · cloud
Coming soonDraft a community email safely
- Draft a community email from sample event data
- See a risky claim flagged before review
- Approve and preview the send
- Switch locations and watch the data change
-
0:00–0:06
Event
Staff open an event in one location.
-
0:06–0:14
Draft
AI drafts copy and subject lines from fenced data.
-
0:14–0:22
Flag
The scan flags an unsupported donation claim.
-
0:22–0:30
Approve
Staff edit, approve and schedule the send.
Interactive architecture
Walk a real request through agents, services, stores, and human gates. Click any node for its contract.
04The result
What changes for the mosque
One system instead of five to seven
People, giving, programs and communications in one place.
Safer communications drafts
Staff still own the send button (F1).
Each location’s data stays its own
Isolation is enforced in the database (F2).
How I check it behaves
Each check has a definition and a target. Results appear only from real runs, with the set size and date.
05Looking back
Architecture decisions
-
Modular monolith with strict module boundaries F2
Instead of a premature microservice split.
Cost acceptedOne deployable to scale and release.
-
Keep AI narrow: draft assist only F1
Instead of an “autonomous mosque agent”.
Cost acceptedLess automation than a fully agentic product would promise.
Known limits and next step
Riwaq is a large modular monolith in active development, and module maturity varies.
AI stays assistive for communications. It isn’t a decision-making agent fleet.
Next step
- Label each module Built, In progress or Designed.
- Give every new AI task its own guardrails and review step before it ships.