Bitsmiths Studio · HR technology
Onboarding, leave, medical claims, overtime and payroll for Bitsmiths Studio, calculated by database rules instead of by hand.
Category
SaaS
Year
2026
Industry
HR technology
Optimization
Right tool for the task


How it is optimized
Right tool for the task
Payroll is arithmetic, so it runs on rules, with no model in the loop.
Leave and medical balances, payroll calculation and locking are Postgres functions. The calculation is idempotent, so it can be re-run safely at any point before a period locks, and every approved item feeds exactly one payroll. The result is zero manual payroll calculations.
What keeps it lean
- 01Deterministic logic in the database
- 02Idempotent recalculation
- 03Each item counted exactly once
Rules and ordinary software before AI. A model only where it earns its place.
The challenge
People operations at Bitsmiths Studio were scattered across email, chat and paper: onboarding by email, leave and overtime in messages, medical claims on paper, and payroll assembled by hand each month from all of it. Nothing reconciled and nothing was auditable. The studio needed one place where every request had a status and payroll could not be wrong.
The work
We built one system where every request is a row with a status. Employees are invited, onboarded and activated; they file leave, medical claims and overtime; admins approve each one; and approved items sweep into a monthly payroll run that computes payslips, locks them and exports to Payoneer. Balances, payroll calculation and locking live in Postgres functions, because payroll is arithmetic and should run on rules.
Inside the product
More than one screen.
3 more screens from Bitsmiths HRM, captured at device size.

Leave requests
Requests routed to the lead and admin, with balances that update on approval.

Payroll cycle
The monthly register with overtime and deductions, approved in two steps.

Payslip
Earnings, deductions and the audit trail of who generated, reviewed and paid it.
On the phone

Home

Leave requests

Payroll cycle

Payslip
How it is built
Architecture
Next.js 15 App Router with next-safe-action server actions over Supabase, using Postgres, Auth, Storage and pg_cron. Business logic lives in the database: leave and medical balances, payroll calculation and locking are Postgres functions, guarded by row-level security. Roles mirror into the JWT via trigger so middleware can route on them. Resend sends 12 React Email templates, and a monthly cron job opens each payroll period.
Key features
Challenges & solutions
Challenge
Employees could not see their own locked payslips. The visibility policy subqueried an admin-only table, and that subquery runs with the caller’s privileges, so it silently returned nothing.
Solution
Moved the check into a SECURITY DEFINER helper that answers only "is this run locked?", so the policy resolves without exposing the company-wide payroll totals on that table.
Challenge
Approved medical and overtime could be double-counted, paid once in the run that swept them and again in the next.
Solution
Locking a run stamps each approved item with that run id in the same transaction, so every item feeds exactly one payroll and late approvals roll forward instead of duplicating.
Challenge
Admin overrides on a payslip, such as days worked, overtime multiplier and custom adjustments, were wiped whenever payroll was recalculated.
Solution
Made calculation idempotent: it upserts derived figures while preserving admin-entered overrides, so a recalc can be run safely at any point before the period locks.
The impact
What became easier, better or more effective.
The studio now runs its people operations from one system instead of email, chat and paper. Every request is traceable, people are told where their request stands without asking, and payroll is a locked run that computes itself. When a subtlety surfaced, such as late approvals risking double payment, it was explained, fixed and documented in the same week.
The learning
Because the payroll rules live in the database and are written down, the people running payroll understand what each number is made of. The pitfalls found during the build, double counting and lost overrides, are documented so the next person does not rediscover them.
“Clear scope, clear timeline, and risks flagged early instead of hidden until the end. When payroll turned out to be subtler than we thought, they explained it, fixed it and documented it in the same week.”
0
manual payroll calculations
Approved leave, medical claims and overtime sweep into the monthly run automatically, then lock so nothing is paid twice.
5
workflows in one system
Onboarding, leave, medical claims, overtime and payroll replaced five separate channels, so nobody has to remember where a request went.
12
automated emails
Status changes notify people on their own, so nobody chases an approval over chat.
Stack
Frontend
- Next.js
- React
- TypeScript
Styling
- TailwindCSS
Backend
- Supabase
- PostgreSQL
- Zod
Data Fetching
- TanStack
Email
- Resend
Scheduling
- pg_cron
Optimization
Right tool for the task
Rules and ordinary software before AI. A model only where it earns its place.
Conscious AILet's talk
Tell us where you are. We'll say plainly what we would do next, and whether we're the right team for it.