Live2025Designer and engineer

PeopleCore HR

A live HR system where the database, not the code, keeps tenants apart and leave from overlapping.

  • Next.js 16
  • Supabase
  • Postgres
  • Realtime
  • TypeScript
  • Livepublic demo
  • 0overlapping leave, by constraint
  • RLSon every tenant table

01

At a glance

Problem
HR data is the most sensitive a company holds. Tenants must never mix.
My role
Design and engineering
Timeline
2025, live
Team
Solo

02

Architecture

Next.js 16 apptenant and owner UISupabase APIauth, realtimeRLS policiestenant boundaryLeave rulesGiST exclusionSigned URLsdocumentsPostgresappend-only audit

Next.js 16 app → Supabase API. Supabase API → RLS policies. Supabase API → Leave rules. Supabase API → Signed URLs. RLS policies → Postgres. Leave rules → Postgres

03

Hard parts

  1. 01

    Tenant boundary

    Problem
    A forgotten filter would leak one company to another.
    Decision
    Row-level security on every table.
    Why it holds
    The policy still applies when the code forgets.
  2. 02

    Leave never overlaps

    Problem
    Two requests can arrive at once and pass a code check.
    Decision
    A GiST exclusion constraint on leave.
    Why it holds
    The database refuses the overlap, whatever the app does.
  3. 03

    Documents

    Problem
    HR files must not sit at open addresses.
    Decision
    Serve them through signed URLs.
    Why it holds
    A link is a temporary grant, not an address.
  4. 04

    History

    Problem
    Sensitive changes need a record nobody can rewrite.
    Decision
    An append-only audit log.
    Why it holds
    History is added to, never edited.

04

Results

  • Livepublic demo
  • 0overlapping leave, by constraint
  • RLSon every tenant table

05

Tech stack

  • Next.js 16
  • Supabase
  • Postgres
  • Realtime
  • TypeScript

06

The product

PeopleCore HR home page

07

What I'd do next

  • Run a cross-tenant test on every migration.
  • Write the leave-conflict message for managers.
  • Document the Realtime and owner console decisions.
Read the full write-up

The problem

HR data is the most sensitive data a company holds. Tenants must never see each other, and leave requests must never overlap.

I built PeopleCore HR as a multi-tenant HR system. It is live, with a public demo linked in the summary above.

The constraint

Many companies share one deployment, so the boundary between them cannot rest on every query remembering a filter. Leave has a second rule that has to hold even when two requests arrive at once.

I chose Supabase on top of Postgres, with Next.js 16. That gave me row-level security and realtime in one platform, and it means I work inside Supabase's rules.

Decisions

Row-level security as the tenant boundary

Tenant isolation is enforced by row-level security in the database. If application code forgets a filter, the policy still applies. In general terms, the cost is that policies are code. Each one needs a test, and each new table needs one.

A GiST exclusion constraint on leave

The overlap rule is a GiST exclusion constraint on leave, so the database refuses an overlapping request whatever the application does. A check in application code can lose a race between two requests. The general trade-off is that a violation arrives as a database error, which has to be turned into a message a person can use.

Realtime

The stack includes Supabase Realtime for live updates. I am keeping this entry short because I will not describe behaviour I have not written down.

Documents behind signed URLs

Documents are served by signed URL, not as open files. A signed link is a temporary grant instead of a permanent address.

An append-only audit log

The audit log is append-only, so history is added to and not edited. The general trade-off is storage, and deciding which events deserve a row.

An owner console

The platform has an owner console for running it. I include it here because it is part of what I built.

Result

PeopleCore HR is live. Leave overlap is blocked by an exclusion constraint. Documents use signed URLs. The audit log is append-only. Tenants are separated by row-level security, and an owner console exists for the platform side.

I have no load figures, user counts or customer numbers to show, so I give none. What I can show is the set of guarantees the database enforces, and each of them is one I can point to in the schema instead of in a promise. That is the standard I held this project to: a rule that matters should be enforced by the database, not by a careful developer.

What I would change

This section is opinion. If I rebuilt it, I would run an automated cross-tenant test on every migration, asserting that one tenant sees zero rows from another. Policies are the control, so the proof should not depend on me remembering.

I would also write the leave-conflict message before the constraint. A database error is written for engineers, and the person reading it is a manager.

I would write down the Realtime and owner console decisions as I made them. Their reasoning is the part a reader cannot recover from the code.

Need a system like this?

I build systems like this for founders and teams.

Tell me what you're building