Build gamification with Bricqs
The complete developer guide for shipping points, tiers, badges, challenges, contests, streaks, leaderboards, rewards, and referrals. Pick an integration path, copy a working pattern, push to production. Headless React SDK, REST API, embed widgets — same engine behind all three.
Key takeaways
Quick read- Three integration paths: headless React SDK (11 typed hooks), REST API (45 endpoints across /gamify and /ingest), and iframe embed.
- Server-side scoring is non-negotiable. Client state is gamed within hours of release. Points, contests, and rewards always reconcile against the Postgres ledger.
- Idempotency keys on every write. Retries must never double-credit — points, contest entries, and reward claims all enforce uniqueness at the database level.
- API keys are tenant-scoped, with separate participant and admin scopes. Mint short-lived participant tokens server-side; never ship admin keys to the browser.
- Webhooks deliver outbound events with HMAC-SHA256 signing and exponential-backoff retry. Verify the signature header before acting on any webhook body.
Integration paths
Three ways to ship gamification
Pick the path that matches the surface you are integrating into. Most production builds use two of the three over time — SDK for member-facing UI, API for server-side scoring and admin tooling.
Headless React SDK
11 typed React hooks for points, tier, badges, streaks, challenges, leaderboards, rewards, referrals, engagement components. Zero JSX, you own the UI. Best when your design team controls the surface.
REST API
45 endpoints across /gamify (participant + admin) and /ingest (events). Idempotent writes, append-only ledger, anti-fraud built in. Best for native mobile, server-to-server, and partner platforms.
Iframe and embed
Drop-in widgets for quizzes, spins, scratches, challenge surfaces, and contest leaderboards. Pre-built UI. Best when shipping speed matters more than pixel-perfect control.
End-to-end example
See every primitive compose into one product
Reading a single SDK or API page tells you how one hook works. The example below shows how nine mechanics compose — onboarding coins, daily activity, streaks, follower milestones, weekly leaderboards, badges, season rewards, webhooks, and referrals — wired end-to-end on a real product surface. If your stack maps to this page, the engine will handle it.
Esports social network on Bricqs
A complete walkthrough for “Qlan.gg” — a hypothetical gamer social network. Onboarding coins, daily activity loop, login streak with freezes, follower milestones, weekly Valorant/Apex/BGMI leaderboards, badge catalog, season-tier rewards driven by webhook fulfilment, weekly challenges, and squad referrals. Every API call, every SDK hook, every UI component shown.
Read the walkthrough →Coins
Streaks
Badges
Leaderboards
Challenges
Milestones
Rewards
Webhooks
Referrals
Compare the paths
SDK vs REST API vs Embed
A side-by-side comparison so you can pick the right path the first time.
| Capability | Headless SDK | REST API | Embed |
|---|---|---|---|
| Stack | React 18+, Next.js, Vite, Remix | Any HTTP-capable backend or mobile | Any page that can host an iframe |
| UI control | Full — you render everything | Full — you render everything | Pre-built, theme-able |
| Server-side scoring | Via REST under the hood | Direct | Direct |
| Best for | Member-facing UI inside an app | Mobile, server-to-server, partner APIs | Marketing campaigns, microsites |
| Auth model | Short-lived participant tokens | API key + optional participant token | Public widget key + URL params |
| TypeScript types | Shipped in the SDK | OpenAPI spec at /docs | N/A |
By stack
Choose the SDK path that matches your stack
Stack-specific starting points so you skip the setup decisions and go straight to the first hook or endpoint.
React + Next.js (App Router)
Install @bricqs/headless-react. Mint participant tokens in a Route Handler. Wrap the app in BricqsProvider once. usePoints, useTier, useChallenge render in any Client Component. SSR-safe via passed-in token prop.
Vite, Remix, Astro
Same package. The Provider lives at the root of the client island. Use the same hook surface; the SDK does not depend on Next.js APIs.
Node, Python, Go (server)
Call /api/v1/gamify directly. Bricqs ships an OpenAPI spec at /docs, so generated clients are one command away. Use Idempotency-Key on every write.
iOS / Android
REST API via a thin native client. Sample Swift (URLSession) and Kotlin (Retrofit) wrappers in /guides/build/api/auth-and-keys. Mint participant tokens server-side, refresh before TTL.
Server-to-server / partner
Webhooks for outbound; REST API for inbound. HMAC-SHA256 signing on every webhook. Exponential backoff with up to 12 retries over 24 hours.
No-code / marketing-led
Iframe embed with URL-param theming, or the canvas builder for full visual control. No engineering required; analytics and rewards still hit the same ledger.
The library
Every developer guide, in one place
The cluster below mirrors the marketing IA. Every marketing guide has at least one paired developer guide — pick by goal, by primitive, or by surface.
Guide cluster
Start here
Guide cluster
End-to-end examples
Guide cluster
Headless SDK
Setup
Install @bricqs/headless-react, BricqsProvider, participant tokens, environments, SSR.
Read the guidePoints and tiers
usePoints, useTier, useBadges. Award flows, multipliers, expiry.
Read the guideChallenges
useChallenge, objective progress, completion handoff, multi-step flows.
Read the guideStreaks
useStreak with grace periods and freeze tokens.
Read the guideLeaderboards
Global, bracketed, and segmented leaderboards in your UI.
Read the guideEngagement
Quizzes, spin wheels, scratch cards, predictions — engagement components.
Read the guideRewards
useRewards, claim flow, redemption codes, expiry windows.
Read the guideReferrals
useReferral, share links, attribution, double-sided rewards.
Read the guideState and cache
Loading, polling, optimistic updates, SSR hydration.
Read the guideGuide cluster
REST API
Auth and keys
Key models, scopes, rate limits, rotation, native mobile sample clients.
Read the guideEvents ingestion
POST /events, batch, custom event types, idempotency, Redis Streams.
Read the guidePoints economy
Direct grants, deducts, expiry policies, multiplier rules, ledger model.
Read the guideChallenges
Create, score, complete. Evaluator types: activity_count, streak, score_threshold.
Read the guideContests
Lifecycle states, scoring engine, prize allocation, fraud detection.
Read the guideWebhooks
HMAC-SHA256 signing, retry policy, full event-type catalog, signature verification.
Read the guideGuide cluster
Patterns
Onboarding flow
End-to-end activation challenge using SDK + API. Working code, no hand-waving.
Read the guideStreak with freeze
Daily streak with grace periods and forgiveness tokens. Production-ready.
Read the guideSpin campaign
10-day spin sale with email gate, daily fairness, anti-fraud, spend ceiling.
Read the guideSports prediction
Pre-match prediction across a tournament. Scoring, tie-breakers, sponsorship hooks.
Read the guideLoyalty tier engine
Points + tiers + perks wired end to end. Earn rules, tier qualification, perk evaluation.
Read the guideReferral loop
Double-sided referral with attribution tracking and milestone bonuses.
Read the guideGuide cluster
Operations
Anti-fraud
Server-side validation, velocity caps, suspicious-rank-jump detection, review queues.
Read the guideObservability
Structured logs, Prometheus metrics, OpenTelemetry tracing, alerting rules.
Read the guideData fabric
PII masking, GDPR erasure, outbound webhooks, standard-field mapping.
Read the guideScaling
Throughput targets, batching, caching, tentpole readiness, load-test results.
Read the guideWhat you get from the engine
Production guarantees, not just an API
What Bricqs handles so you do not have to.
Idempotency on every write
Idempotency-Key header on points, contests, rewards, events. (participant_id, source_fact_id) is a database-level unique constraint. Retries never double-credit.
Append-only ledger
Points and contest scoring use an append-only event log. Reconcile, rebuild, and audit without ever mutating history. Snapshot tables for fast reads.
Server-side anti-fraud
Velocity checks per-minute, per-hour, per-day. Suspicious rank-jump detection. Auto-disqualification before prize allocation. Built into the contest scoring path.
Observability built in
Structured logs, OpenTelemetry tracing, Prometheus metrics. Every fact, every score event, every webhook delivery is traceable end-to-end.
Rate limits and back-pressure
1,000 req/min per key, 5,000/min per tenant, 100/sec burst. Redis sorted-set sliding window. Event ingestion buffers via Redis Streams under load.
Tenant isolation
Every row, every key, every ledger entry is tenant-scoped. Postgres row-level security enforced. Multi-tenant safe by default.
Developer FAQ
Common questions when integrating gamification with Bricqs.
Ready to ship?
Build with Bricqs
Headless SDK for React UIs. REST API for any backend. Embed widgets when speed beats UI control. Same engine, three surfaces.
