Overview
Open Loyalty is a loyalty infrastructure platform that any business can plug into their existing systems via API. Tenants create programs, define earning rules, set up rewards, and their external applications trigger point events and redemptions through a simple REST interface.
The Problem
Small and medium businesses — workshops, cafes, retail stores — want to run loyalty programs but get locked into expensive SaaS platforms or cobble together manual punch cards. Existing solutions are either overpriced, overly complex, or force data into someone else's cloud. There was no lightweight, self-hosted option that a developer could integrate in an afternoon.
What Was Built
A multi-tenant loyalty engine with:
- — Program management — create isolated loyalty programs per business unit, each with its own points currency and expiry rules
- — Event-based earning — trigger points from any event type (purchase, service visit, referral). Rules are fully configurable: points per unit, minimum amount, max cap per event
- — Flexible rewards — discounts, free items, or custom rewards with stock limits and expiry dates
- — Tier system — automatic tier progression based on lifetime points, with configurable multipliers that bonus higher-tier members
- — REST API — Bearer token auth, enroll members, send events, redeem rewards. Designed for integration, not as a standalone app
- — Platform console — admin dashboard for managing tenants, API keys, and monitoring usage
Integration with BukuBengkel
The first real integration is with BukuBengkel, a workshop management platform. Workshops configure service-to-program mappings (e.g., "Ganti Oli" maps to the Oil Change Loyalty program). When a customer comes in for a service, BukuBengkel checks for available rewards via the API and sends earn events after each visit. The whole cycle — earn stamps, hit the threshold, redeem on the next visit — runs automatically.
Technical Notes
- — Stack — Next.js (App Router), Drizzle ORM, SQLite (better-sqlite3), better-auth
- — Multi-tenancy — API key scoped to tenant, all data isolated at the query level
- — Point ledger — immutable, append-only. Every earn, redeem, expire, and adjustment is recorded with running balance
- — Self-hosted — single server deployment via PM2 + Caddy. No Docker, no external dependencies