Community Technology

Riwaq | Masjid CRM Platform

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

3 AI touchpoints · staff approve every send

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

  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.

02The approach

What was built & where AI assists

Each failure gets one mechanism, and each mechanism has proof further down this page.

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

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.

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 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
  1. 0:00–0:06 Event

    Staff open an event in one location.

  2. 0:06–0:14 Draft

    AI drafts copy and subject lines from fenced data.

  3. 0:14–0:22 Flag

    The scan flags an unsupported donation claim.

  4. 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.

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

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

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.

Project demo