Community Technology

Riwaq | Masjid CRM Platform

Multi-tenant mosque operations—with AI that drafts, humans that approve.

3 AI touchpoints · staff approve every send

See it run

A narrated three-minute tour of the platform on a seeded demo mosque: members, giving and Zakat, the member portal and programs, grants, AI Studio, the building, and the multi-tenant core.

6 chapters in this video
  1. 0:00–0:28 One roof

    Donations in a box, requests on paper, a member list nobody fully trusts. RIWAQ brings members and their families, events with check-in at the door, announcements and the khutbah library under one roof.

  2. 0:28–1:04 Giving and Zakat

    Members give on the website by card or wallet, in the portal, or at the kiosk with a tap; every gift lands in the right fund and in the organization’s own account. Zakat requests arrive privately, the committee decides, and every dollar is recorded against the eight categories. Janazah, Nikah, Qurbani and Fitrah, each handled with care.

  3. 1:04–1:38 Portal and programs

    A portal for members: giving history, event RSVPs, classes for their children, confidential service requests, membership and youth programs. Sunday School from registration to report cards and kiosk pickup, Hifz and education, volunteers hour by hour.

  4. 1:38–2:06 Grants and AI Studio

    RIWAQ finds funders that match the masjid’s profile, says why each one fits, and tracks every application from discovery to award. AI Studio drafts campaigns from the masjid’s own facts for email or text, bulletin announcements, and posters in minutes.

  5. 2:06–2:30 The building and the books

    Spaces and bookings, maintenance schedules, inspections and cleaning rounds. Expenses and budgets, documents, board meetings, and reports that show the whole picture, donor by donor.

  6. 2:30–3:00 Built for scale

    One masjid or a national network, each seeing only its own data. Zapier, webhooks, an API, and fifty-eight modules isolated in the database itself. RIWAQ Go for volunteers appears as a coming-soon concept. Close: rooted in faith, built for scale.

Live demo · cloud

Coming soon

Draft 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
Open live demo · soon Book a walkthrough

01See it work

Campaign lifecycle

Campaign lifecycle

Three AI Studio campaigns at a demo mosque with two locations. AI tasks draft email copy, subject lines and poster art from one location's fenced DATA, a risky-pattern scan flags invented claims, and staff approve, edit or discard every draft before anything is sent. Postgres row-level security keeps each location's rows to itself.

AI ASSIST · DRAFTS ONLY

AI touchpoints and platform pieces in Riwaq from packages/ai, apps/worker and the FDD, via the site's inventory
NameRolePurpose
Legend and data notes
HTTPS · tRPC Postgres · RLS BullMQ job Guardrail LLM call Staff decision Audit log
From the Riwaq sources: the three AI touchpoints and their files (email-copy and subject-lines tasks, run-task.ts, guardrails.ts, the worker poster processor), the guardrail rules, the post-generation risky-pattern scan, Postgres RLS on location_id, Keycloak with RBAC, BullMQ workers, the audit log, and the rule that staff approve before anything is sent. The provider is named only as OpenAI-compatible and the poster path as Gemini, with no model version or price, so there is no cost meter. Illustrative: the demo mosque, locations, users, ids, payloads, prompt and fence wording, procedure, job, table, status, flag and event names, recipient counts and timings. Storing poster files in S3 is inferred from the platform data flow. Riwaq logs actions but does not compute A·T·E scores; the trail's three numbers are illustrative ratings, kept for comparison with the other case studies. Elapsed time excludes staff reading and editing.

02The 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, what’s at stake, constraints

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

  1. F1

    A fabricated claim in a community message

    No invented donation totals, guarantees or political endorsements.

  2. F2

    Data crossing tenants

    One mosque’s members or giving must never reach another.

  3. F3

    Instructions smuggled in through data

    Tenant content is reference material. It must never steer the model.

What was built & where AI assists

Each failure gets one mechanism, and each mechanism links to its proof in See it work.

Failure Mechanism The model’s role Proof
F1
Mechanism

AI tasks draft only from supplied DATA and omit missing details. A post-generation scan flags risky patterns, and staff approve before send.

The model’s role

Drafts copy and subject lines. It can’t send.

F2
Mechanism

Postgres row-level security on location_id plus platform RBAC. AI tasks receive one tenant’s fenced data.

The model’s role

None. Isolation lives in the database.

F3
Mechanism

The DATA fence marks tenant content as reference material, never instructions.

The model’s role

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 3 AI touchpoints · staff approve every send

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.

LLM model-assisted Code deterministic Human person in the loop
Drafts

Drafting

Assistive tasks only. None can send.

Flags

Checks

Runs after generation, before a person sees the draft.

Decides

Authority

Staff own the send button.

Isolates

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.

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 4 checks against F1 · F2 · F3 · run pending

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.

Check What it counts Target Last run
Invented claims F1 Drafts that state a figure or promise not in DATA 0 Run pending
Flagged before review F1 Seeded risky drafts the scan flagged All Run pending
Cross-tenant reads F2 Rows returned outside the caller’s location 0 Run pending
Injection through DATA F3 Planted instructions in DATA that changed the output 0 Run pending

Trade-offs & limits

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

Scope · disclosed

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

  1. Label each module Built, In progress or Designed.
  2. Give every new AI task its own guardrails and review step before it ships.