Back to Blog
Projects & Builds

Building 1HPC: From Concept to a Production Identity Platform

Every organization eventually discovers its people are one community and its data is scattered everywhere. Here is how we built one secure identity, one source of truth, and one sign-in for every app.

12 min read
Oct 20, 2026

Every organization eventually discovers the same uncomfortable truth.

The people are one community. The data is scattered across a dozen places.

Spreadsheets. WhatsApp groups. Disconnected forms. Each new application invented its own login, its own profile, its own idea of who someone was.

So we built 1HPC — a production identity provider and master profile system for the devotee community of YDS Canada. One secure account. One source of truth. One sign-in for every connected application.

Here is how it went from a concept to a platform people actually rely on — and the hard problems we had to solve along the way.

1HPC at a Glance

OpenID Connect SSO Provider

Passwordless by Design

38 Data Models

43 Database Migrations

AES-256-GCM Per-User Encryption

Role + Gender + Centre Access Control

Admin-Governed App Approvals

Built with Cursor AI

1

The Problem: Identity Was Everyone's Job, So It Was Nobody's

Before 1HPC, a devotee's information lived wherever the last team needed it. When someone moved between centres, their history did not move with them. When a new application launched, it asked everyone to register again.

That is not just inconvenient. It is a quality problem, a security problem, and a trust problem.

What the community actually needed:

  • One verified identity — a real person behind every account, confirmed through a real phone number
  • No passwords — nothing to forget, reset, or leak
  • Privacy that respects our norms — contact details between genders protected by default
  • Governance — administrators approve profiles and decide which apps may use the identity
  • SSO for everything else — internal tools should sign in with 1HPC, not rebuild authentication

No off-the-shelf identity product matched that combination. Not because they are bad products — because the rules here are specific to this community.

2

From Concept to Architecture

The first decision was the most important one: build the identity provider on a standard, not on a custom protocol.

If 1HPC speaks OpenID Connect, every future application can integrate the way it would with any enterprise identity provider. No special SDK is required to understand it.

API — Fastify + Prisma + PostgreSQL + Redis

Fastify for a fast, schema-friendly API. Prisma over PostgreSQL for data integrity. Redis for sessions and rate limiting. The OIDC server runs on the well-tested oidc-provider library — we configure it, we do not reinvent it.

Web — Next.js App Router + Tailwind + TanStack Query

One portal serves two audiences: devotees managing their own profile and family links, and administrators running approvals, reports, and governance.

Monorepo — Shared Types, One Truth

A pnpm workspace with a shared package for types and Zod validators means the API and the web portal can never disagree about what a profile looks like. A design-system package keeps every 1HPC-powered screen consistent.

3

Challenge #1: Passwordless Without Being Fragile

Passwords were never going to work for this audience. So sign-in is built on two things people already have: a phone number and an authenticator app.

1

Phone check

The system recognises whether this is a new devotee or a returning one and offers the right login method.

2

WhatsApp one-time code

OTPs are delivered through approved WhatsApp templates using the Meta Cloud API. Codes are stored only as hashes, and the endpoint that costs money per message has the tightest rate limit in the system.

3

Authenticator enrollment

After the first verified sign-in, devotees enrol a TOTP authenticator. Later logins can skip WhatsApp entirely, and TOTP secrets are encrypted at rest.

4

Rotating refresh tokens

Access tokens are short-lived RS256 JWTs. Refresh tokens are stored only as SHA-256 hashes and rotated on every use, so a stolen token has a very short useful life.

The challenge was not making login work. It was making it work without a single password to protect — and without turning WhatsApp costs into an attack surface.

4

Challenge #2: Protecting Personal Data You Still Need to Search

Identity systems hold the most sensitive data an organization has. The rule we set on day one: no plaintext personal data in the database.

How personal data is protected:

  • Profile data is stored as one AES-256-GCM encrypted blob, with a unique data key per user
  • Data keys are wrapped by AWS KMS in production
  • Phone numbers are never stored — only an HMAC hash used for lookups
  • OTP codes and refresh tokens are stored only as hashes
  • Runtime secrets such as API credentials are encrypted in the database and are write-only after saving

Here is the tension: encryption makes data safe and makes it hard to query. Administrators still need filters, dashboards, and reports.

The answer was to keep the full profile encrypted while exposing a small, deliberate set of non-sensitive summary fields — centre, city, blood group, status, immigration summary — that power search and reporting. Sensitive detail stays sealed. Operational detail stays fast.

5

Challenge #3: Access Rules That Match Real Community Norms

Standard role-based access was not enough. In this community, who may see what depends on role, centre, and gender.

Layered request pipeline

Every request passes through authentication, status checks, role checks, and then an attribute-based filter. Super admins are scoped by gender. Centre admins are scoped by centre. A final privacy layer strips opposite-gender phone numbers and emails before the response leaves the server.

The point of building it as a pipeline is that the rules live in one place. Handlers do not each re-implement privacy — they simply never receive data they should not see.

6

Challenge #4: Becoming the Identity Others Depend On

An identity provider is only valuable once other applications trust it. That meant building the app management lifecycle, not just the login screen.

How an application joins 1HPC:

  • A developer registers the app with redirect URIs and the profile fields it needs
  • The app is submitted for review and an approver accepts or rejects it
  • Approved apps receive client secrets and can request only the permissions they were granted
  • Individual users can be revoked or reactivated per app
  • Pending or revoked users are blocked at token issuance

That is how internal tools like the YDSC URL Shortener now offer a single button: Sign in with 1HPC. Access is managed in one place, and an account has to be approved there before any connected app will accept it.

7

Challenge #5: Migrating an Existing System Without Breaking Trust

1HPC was not a greenfield for everyone. Existing applications already had users. The Harmony platform, for example, had its own database and its own authentication.

1

Data migration

Existing user data is transformed and imported into 1HPC.

2

Admin review

Imported users land in a pending queue. Admins review them, and users fill in any missing fields — so migrated data is verified rather than blindly trusted.

3

OIDC cutover

The application replaces its own login with 1HPC and reads profile data from the 1HPC API. From then on, 1HPC is the single source of truth.

Splitting it into three phases meant no big-bang switch. Every step could be validated before the next one began.

8

Operating It Without Redeploying

A production identity system cannot require a deployment every time a policy changes. So the important knobs are live-configurable by administrators:

Configurable at runtime:

  • Branding, token lifetimes, and login methods
  • Which profile sections are enabled and required
  • Storage provider (S3, Azure Blob, or local) with migration tooling
  • WhatsApp OTP settings and rate limits
  • Notification schedules and immigration-expiry thresholds
  • Email templates, edited in the admin portal

Background jobs handle the quiet work: reminding devotees with incomplete profiles, and warning administrators when work or study permits are approaching expiry — with de-duplication so nobody is reminded twice.

9

Building It with Cursor AI

The first commit landed in April 2026. Since then the codebase has grown through more than 200 commits — SSO and app management, notifications and inbox, audit logging, reporting, email templates, and immigration reminders.

AI pair programming made that pace possible, but it did not make the decisions. The decisions were the ones above: build on a standard, encrypt everything, keep the rules in one pipeline, migrate in phases.

The model is fast at producing code. The engineer is still responsible for knowing which code should exist.

10

Outcome

What 1HPC delivers:

  • ✔ One verified identity per devotee, with no passwords to manage
  • ✔ Standards-based OIDC SSO that internal apps can adopt in a standard way
  • ✔ Encrypted personal data with privacy rules enforced by the platform, not by each application
  • ✔ Admin governance over profiles, photos, family links, and app access
  • ✔ A full audit trail across more than fifty event types
  • ✔ A migration path for existing systems such as Harmony

Why This Matters

Identity is the one system every other system depends on. If it is weak, everything built on top of it inherits the weakness. If it is strong, every new application gets security, privacy, and governance for free.

That is the real return on 1HPC. Not a login page — a foundation.

Build the hard, boring, trusted thing once. Then let everything else stand on it.

Enjoyed This Article?

I write about building reliable systems, leading teams, and shipping products that matter.