# Trim implementation and launch checklist Trim helps small Filipino creators earn when their audience takes a qualifying action. A vendor can be a local store promoting a visit or purchase, or an app business promoting a signup or trial. Customers should be able to scan or keep an offer and understand exactly how to use it. ## Run the local preview From the project directory, run `npm ci` and `npm start` with Node.js 22.14 or later. Open `http://127.0.0.1:8765/`. The start command reads `.trim-data/supabase.env` when it exists. Use [`.env.example`](.env.example) as the list of settings. Keep the restricted Postgres connection and both 32-byte keys on the server. The design reference is at `/design-system.html`. ## Hosted database Trim’s Supabase project is in Xipoi’s organization in Singapore. The server connects through the Singapore shared pooler with certificate verification and a restricted `trim_app` role. Application tables use row-level security in the private `trim` schema. [Supabase project](https://supabase.com/dashboard/project/jlxqmaixcilvzypvrraq) 1. The initial schema pins the `preview-1` collaboration terms. The runtime migration ties each profile to Supabase Auth and grants server permissions. [Initial schema](supabase/migrations/20261118150738_trim_initial_schema.sql), [Supabase runtime](supabase/migrations/20261118151840_trim_supabase_runtime.sql) 2. The homepage gallery shows four sample campaigns. [Demo migration](supabase/migrations/20261118154045_trim_demo_campaigns.sql) 3. Store campaigns record offers, affiliate links, claim codes and confirmed rewards. [Store campaigns migration](supabase/migrations/20261118155906_trim_store_campaigns.sql) 4. Payouts record a wallet provider and transfer reference against one confirmed reward. [Payouts migration](supabase/migrations/20261118160233_trim_reward_payouts.sql) 5. App campaigns can close to new referrals while honoring eligible earlier handoffs. [App closure migration](supabase/migrations/20261118160435_trim_app_campaign_closure.sql) 6. Trim keeps the exact Terms of Use and Privacy Notice shown at acceptance, plus timestamped collaboration acceptance by version. Historical agreements preserve previously earned rewards and access to partner contact. [Acceptance migration](supabase/migrations/20261118170509_trim_legal_acceptances.sql), [Document snapshots](supabase/migrations/20261118171220_trim_legal_documents.sql) 7. Partner conversations are private to the vendor and affiliate on the connection. Messages use row-level security and a signed-in account ID scoped to the request transaction. [Contact migration](supabase/migrations/20261118170401_trim_partner_contact.sql), [Historical contact access](supabase/migrations/20261118171037_trim_partner_contact_history.sql) ## Signup and connections - On `/`, signup starts in the hero. On `/home-v2`, it starts in the following section. Vendors choose their business type and a public handle at signup. Their profile opens at `/v/` and can be shared by link. - Supabase Auth confirms email ownership and handles sign-in and password recovery. Trim provisions the profile after confirmation. To test both roles, use separate browser profiles and open each confirmation link in the browser that requested it. - The account agreement page links to the Terms of Use and Privacy Notice. Account holders explicitly agree to the Terms of Use and separately acknowledge the Privacy Notice. Current review is required before requesting a connection or publishing an offer. - Affiliates can request a connection from a vendor’s public page. Vendors can use an affiliate’s connection code. New referrals require both partners to accept the same current collaboration agreement and complete their own account review. Trim keeps each version and acceptance timestamp. - Connected partners can open **Contact partner** to discuss an offer, credit or wallet transfer through private messages. Trim support handles technical issues at `support@joph.app`. The Privacy Notice directs privacy requests to the same address. ## Campaigns and affiliate QR codes - After both parties accept the terms, an affiliate can generate a referral link and download its QR from **App verification** or **Shop campaigns**. The QR opens the same public offer link that the affiliate can copy. Customers can open the link or scan the QR without a Trim account. - App offers define a destination and a qualifying signup or trial. Once the customer continues from the public offer to the app, Trim passes an opaque referral ID. The app vendor sends a signed callback when the customer qualifies. Trim deduplicates credits by referral and by the app account and action. [App integration guide](APP-VERIFICATION.md) - Shop offers define the customer benefit, action, branch, terms and affiliate reward. The customer requests a 30-minute code and shows it at the store. Staff look up the code in **Shop campaigns**, check the conditions, then confirm the claim. Confirmation creates one credit at the recorded reward. Repeat requests from the same browser for the same campaign retain the original attribution. - Closing a campaign stops new handoffs or claims. Shared links still show the offer status. An eligible previously opened app referral or unexpired shop code can still be confirmed. ## Credits and payouts - An affiliate can save or remove their Philippine mobile wallet. Trim encrypts the details. A vendor can see them with the affiliate’s consent after crediting a referral for that affiliate. - The vendor sends the exact credited amount in their own wallet app, then records the transfer reference in Trim. The affiliate can see the recorded transfer and reference in their payout history. Each credit can have one transfer record, and a vendor cannot reuse the same provider and reference for another credit. ## Before opening the pilot 1. Deploy the app on a public HTTPS origin and set `TRIM_PUBLIC_ORIGIN` to that exact origin. The local preview generates loopback links for testing on the same computer. Public HTTPS is necessary for customer QR scans and external vendor webhooks. 2. Verify `trim.joph.app` in Resend by adding the sending records to the `joph.app` DNS zone at Namecheap. Use the native Resend integration to set custom SMTP on the Trim Supabase project for signup confirmation and password recovery. Keep click tracking disabled for these emails. Set Supabase Auth’s Site URL and allow `/auth/complete?flow=signup` and `/auth/complete?flow=recovery` on each intended origin. Verify delivery and link completion for both flows before inviting pilot users. [Resend integration](https://resend.com/docs/knowledge-base/getting-started-with-resend-and-supabase#send-with-the-resend-integration), [Supabase email setup](https://supabase.com/docs/guides/auth/auth-smtp), [Auth URL configuration](https://supabase.com/dashboard/project/jlxqmaixcilvzypvrraq/auth/url-configuration) 3. Review `use-1`, `privacy-1` and `collaboration-1` before launch. Confirm the privacy contact’s receiving inbox, retention schedule, processors and effective date, and have Philippine counsel review the agreement and the handling of consumer reports and redress. Publish approved text as new immutable versions. Update the server’s versions to match the saved snapshots and preserve the earlier acceptance and credit records. 4. Test one printed QR and one shared QR on physical phones. Have a real shop test the counter workflow and an app vendor test a signed callback. Reconcile the resulting credit and recorded payment with the terms both parties accepted.