All projects
Full Stack case study

DeltaHi Points & Rewards

An employee engagement platform where staff join activities, earn points and redeem rewards. I designed the points and rewards service.

TL;DRCore contributorJun 2025 – 2026

Points and rewards that stay correct when many employees redeem at once.

Role
Designed the points service; built admin features
Ownership
Owner of the points and rewards service
Core stack
TypeScript · Nuxt.js · Vue.js · NestJS · PostgreSQL
The problem

Employees earn points from activities and content and redeem them for limited stock. Two people redeeming the last item at once must not both succeed.

Delta original Reward Order Management UI
DeltaHi reward order admin running locally with demo data.

What I built

I designed and built the Points Management service and built features in the shared admin and API.

  • Designed redemption as one database transaction: lock the reward and balance rows, check eligibility, burn points, write history and adjust stock, then commit or roll back everything
  • Made point earning extensible with a Strategy + Factory pattern covering earning channels such as activities, content, refunds and app shares
  • Added a daily expiry job that clears expired balances and writes an EXPIRE history entry
  • Built admin features in Nuxt 3: reward orders, stock management, per-action permissions (create, edit, delete, export), debounced search and Excel exports
  • Added Thai word segmentation to search in the main API

How it fits together

Employees use a Flutter app. An AdonisJS API handles the wider employee platform and syncs staff from the company's SQL Server. The NestJS points service owns balances, rewards and redemption history in its own PostgreSQL database, and pushes updates to the admin over Socket.IO.

Outcome

Points and stock stay consistent when many employees redeem at once, and every earn, burn and expiry is recorded.

Deep diveCore feature walkthroughAn interactive flow of the hardest workflow, step by step.
Core feature walkthrough

How the main product workflows operate

Core feature 01 · Point and reward transaction

A redemption coordinates balance, order history and inventory inside one transaction

The point-management service treats redemption as a multi-record operation. It locks the selected reward, validates eligibility, burns points, creates a waiting fulfilment record and commits only when every database step succeeds.

Member redemption

NestJS · TypeORM · PostgreSQL · Decimal arithmetic

Select a node for implementation detail
Points use Decimal

Balance and point cost avoid floating-point arithmetic, and every earn or burn writes a separate history record.

The reward row is locked

A pessimistic write lock is the concurrency boundary around validation and redemption.

All-or-nothing by design

I built redemption as one transaction: lock the reward, check eligibility, burn points, write history, adjust stock. Any failure rolls every write back, so a member never loses points without getting an order.