Andy Li
All work
Shipped

Looseword

An anonymous campus discussion platform, live at looseword.ca. It is built on Next.js, PostgreSQL functions and Supabase Auth, with two OpenAI API moderation layers. Its posts drew 74,900+ Instagram views in 30 days.

Status
Shipped. Live at looseword.ca.
Stack
Next.js, TypeScript, PostgreSQL, Supabase Auth, OpenAI API, Cloudflare Turnstile, Vercel
Release
Oct 14, 2026. Launch day Oct 15.

What it is for

Looseword is where students post anonymously to the people around them: confessions, questions, advice and shoutouts. Anyone can read. Posting needs no account, and a signed-in Google account adds replies, votes and follows.

Communities form a tree. A post to Place Vanier also belongs to UBC's residences and to UBC, and a post to Computer Science also belongs to the Faculty of Science. A reader can open one community, a branch or the whole campus.

Nothing is public until it is approved. Local moderators get review rights for their own community without access to the rest of the network.

Looseword poster. It reads: got something to say? More confessions. More campus conversations.
Looseword's own posters for its campus pages.

In use

74,900+
Instagram views in 30 days
From Instagram Insights.
5,003
page views in 30 days
Oct 25 to Nov 23, 2026, from Vercel Web Analytics.
930
visitors, counted per day
Someone who returns on another day counts again.
536
public posts in the SFU feed
Saved public snapshot, Nov 13, 2026.

Approved posts also go out as cards on Instagram. On the site itself, the SFU feed is where most reading happens: 54% of page views, with single post pages taking another 31%. 76% of views come from a phone, and 95% come from Canada.

Page views per day, in UTC days. Vercel's free plan keeps 31 days of analytics, so this is the whole window that could be read on Nov 24, 2026.

What I worked with

Technology, and what I did with it

Next.js (App Router), TypeScript, Vercel
I built the public campus feeds, the moderation interface and 31 API route files in Next.js App Router and TypeScript, deployed on Vercel.
PostgreSQL: 41 migrations, 52 tables, SECURITY DEFINER functions
No table is readable by a browser role. Every read and write is a SECURITY DEFINER SQL function that takes the caller from the session, and a transaction advisory lock serializes quota checks.
Supabase Auth (Google OAuth, PKCE)
I set up Google sign-in with the server-side PKCE flow for moderators and for members who reply, vote or follow. Guest submissions stay sessionless.
OpenAI Decisions API
I wired the Decisions API in as a moderation classifier. It scores each post as a probability for named risks, against thresholds set in code. The prompt treats the post as untrusted data, not instructions. A refusal, malformed answer, API error or 6-second timeout leaves the post pending for a person.
OpenAI Responses API (structured output)
A second, advisory risk review uses the Responses API with a JSON schema, so moderators see structured review data beside a pending post.
HMAC-SHA256 signing, Cloudflare Turnstile, Zod
Guest submissions and Google Forms payloads are signed with HMAC-SHA256, and SQL verifies the signature before it reads any field. Server routes validate input with Zod and verify the Turnstile token before anything is written.
Next.js ImageResponse
Approved posts are rendered on the server as numbered 1080 by 1350 PNG cards for sharing.
Google Apps Script
I wrote a Google Apps Script bridge, attached to each community's Google Form, that signs every response with its source key and posts it to the ingest route.
Instagram Graph API, Cloudflare Workers, GitHub Actions
I built a checkpointed Instagram Graph API publishing worker that sends one publish call and never retries on its own. It is switched off and has run only against a fake provider. The repo also carries a scheduled Cloudflare Worker for triggering background routes, and GitHub Actions CI.

How a post moves

This is the path of one post submitted on the website without an account, from the browser to the public feed, with the route or SQL function at each step.

  1. BrowserA student posting, or anyone reading. No account needed.
  2. ServerNext.js routes on Vercel. Validates, verifies, signs.
  3. DatabasePostgreSQL on Supabase. SQL functions hold the rules.
  4. ModeratorA signed-in person with review rights for that community.
  1. The browser makes a 256-bit receipt, a random secret that only it knows, and sends it with the post and a CAPTCHA token. The request carries no account cookies.

    POST /api/guest/posts
    { "body", "category", "community", "captchaToken",
      "receiptToken": "<64 hex characters made in the browser>",
      "acceptedGuidelines": true }
  2. The server verifies the token with Cloudflare Turnstile and checks the action, this site's exact hostname and a five-minute age limit. If any check fails, the server signs nothing and the post cannot be stored.

  3. The server signs an envelope that expires in 60 seconds and calls one SQL function. The function verifies the signature before it reads any field, then checks replay, the destination community and the rate limits in one transaction. The post is stored as pending, with a hash of the receipt.

    payload   = { version, requestId, issuedAt, expiresAt, community, category,
                  body, rateKey, receiptHash, replyRequested }
    signature = HMAC-SHA256("murmur.guest.submit.v1" + LF + payload)
    
    rpc guest_create_post(payload, signature)   ->   posts.status = 'pending'
  4. The response returns only the post ID. Combined with the receipt in the URL fragment (which browsers never send to a server), it gives the student a private link to check or withdraw that post. Withdrawal scrubs the body.

    /submission#<post id>.<receipt>
    
    POST   /api/guest/posts/status   { "id", "receiptToken" }
    DELETE /api/guest/posts          { "id", "receiptToken" }
  5. The review queue and the decision are SQL functions too. Each one resolves the moderator's live authority for that exact community, so choosing a residence in the interface does not widen what a moderator can do. A decision names the revision the moderator saw.

    GET  /api/moderation   ->   rpc moderation_queue
    POST /api/moderation   ->   rpc moderate(kind, id, decision, reason, expectedRevision)
  6. Public reads return approved posts from active communities and nothing else: no author IDs, no receipt hashes, no pending or removed content. The same public projection renders each post as numbered card images, 1080 by 1350 pixels, for sharing.

    GET /api/feed              ->   rpc feed
    GET /post/[id]/card?page=N ->   PNG card

Field and function names are from the code. The schema prefix murmur is the project's original name.

The Google Forms route

At launch, each community's Google Form was the primary way in. A small Apps Script attached to the form signs every response with that source's own key and sends it to one ingest route.

The database checks the signature, a five-minute time window, the exact source and form, replays, and that the form's questions and consent notice are the approved ones. A response that passes becomes a pending post in the same review queue as website posts. Each post has exactly one kind of owner: an account, a guest receipt or an imported response.

POST /api/integrations/forms/ingest
signature = HMAC-SHA256("murmur.forms.ingest.v1" + LF + payload)   keyed per source

API and data

The app has 31 API route files. Most validate input with Zod and call a SQL function. 41 migrations define 52 tables in a private schema that no browser role can read, so those functions are the only way in or out.

A post is pending, approved,rejected or removed. Only approved posts appear in feeds, detail pages, reply counts, rankings and card exports.

Main routes

POST /api/guest/posts
Submit without an account: CAPTCHA, signed envelope, pending post.
POST /api/guest/posts/status, DELETE /api/guest/posts
Check or withdraw one post with its receipt.
POST /api/integrations/forms/ingest
Take one signed Google Forms response from a registered source.
POST /api/posts
Create a post from a signed-in account. It also starts pending.
GET /api/feed
Approved posts for a community, a branch or a whole institution, with category filters and paging.
GET, POST /api/moderation
The review queue, and the approve, reject and remove decisions.
/api/posts/[id]/comments, /vote, /follow
Replies, votes and follows. These need a signed-in account.
POST /api/reports
Report a post or reply to the moderators.
/api/account, /api/account/export
Export or delete your own data.
GET /post/[id]/card
An approved post as numbered PNG card pages.

Design decisions

  1. No account to post

    A guest submission never creates a user record, and it does not attach an existing account to the post. The guest route uses its own sessionless database client and the browser sends no account cookies.

    Instead of creating an anonymous user for every guest.

  2. The receipt is the only key

    The browser makes the receipt and the server stores only its hash. Whoever holds it can read the status of that one post and withdraw it. It cannot be recovered by email, because there is no email to send it to.

  3. Keep account IDs out of public reads

    Account IDs exist for ownership, votes, reports and moderation. Public responses leave them out, and there is no anonymous handle that would let a reader link one person's posts together.

  4. The database is the authority

    Anyone can call the data API directly, so the rules cannot live in the interface. Client roles have no access to any table. Every read and write is a SQL function that takes the caller from the verified session.

    Instead of trusting checks in the application alone.

  5. Everything starts pending

    Website posts and replies need a moderator. An enabled Google Forms source can use the OpenAI Decisions API classifier to approve the exact revision it scored. A flag, refusal, malformed answer, API error or 6-second timeout leaves the post pending for a person.

  6. Moderation rights are scoped

    Review, Forms and export are separate rights, granted for one community, one branch or one institution. A local moderator cannot hand out rights or suspend accounts across the network.

  7. No sample data in production

    Missing configuration, database errors and empty feeds render their real states directly. Falling back to sample posts or fake successes would hide a broken deployment.

  8. One publish call, never repeated

    A publish call to Instagram can time out after Instagram has accepted it, so a retry can post the same carousel twice. The worker sends one call and holds an unclear result for a person.

    Instead of an automatic retry.

Publishing to Instagram

Approved posts can go out as Instagram carousels. The Graph API worker saves each step as it goes: the artwork, each slide container ID, then the carousel container ID. It sends one publish request. If the reply is unclear, the job moves to needs_reconciliation and leaves the automatic queue for a person to inspect.

What happens at the publish step
Publish calls sent1The job is held in needs_reconciliation. Even when inspection finds no post, the worker does not retry on its own.
  1. Databasequeued

    Queue approved work

    The queue reserves the post and destination for publishing.

  2. Workerpreparing

    Save artwork progress

    The worker records the renderer version, slide count and uploaded assets as it prepares the carousel.

  3. Databaseready

    Release prepared artwork

    The queue marks the artwork checkpoint ready for a later worker tick.

  4. Workerpreparing

    Save slide container IDs

    The worker checks the Instagram account and saves each slide container ID.

  5. Databaseready

    Release slide checkpoints

    The queue marks the job ready after each saved child container so another tick can continue.

  6. Workerpreparing

    Save carousel container ID

    After the slide containers are ready, the worker creates and records the carousel container.

  7. Databaseready

    Release carousel checkpoint

    The queue marks the job ready for the tick that checks the saved carousel container.

  8. Instagramready

    Check container and quota

    Instagram reports that the carousel container is finished and publishing quota is available.

  9. Databasepublishing

    Recheck publishing permission

    The database rechecks approval, permission and the exact post revision before authorizing the publish.

  10. Workerpublishing1 publish call

    Send publish request

    The worker sends one publish request for the saved carousel container.

  11. Workerpublishing

    Publish response timed out

    The worker did not receive a reply that establishes whether Instagram published the carousel.

  12. Databaseneeds_reconciliation

    Hold for reconciliation

    The job leaves the automatic claim path with its container checkpoint intact.

  13. Personneeds_reconciliation

    Inspect the original attempt

    In this simulation, inspection finds no matching carousel and the held job stays out of the retry queue.

This steps through the worker's logic with its real queue states. The worker is switched off and has only run against a fake provider. The public pilot post went out through a separate browser-based path.

Status

Looseword was released on Oct 14, 2026 and runs live at looseword.ca. The Instagram Graph API publishing worker is built and switched off, and has run only against a fake provider.