Skip to content

postguard-business

GitHub · SvelteKit · Business Portal

Business portal for organizations using PostGuard for Business. Organizations register, manage API keys, view the email audit log, and verify domains. Admins manage organizations, review audit logs, and can impersonate an organization to see what it sees. Authentication is done with Yivi attributes for both organization users and admins.

The portal runs at business.postguard.eu in production and business.staging.postguard.eu in staging.

Integration

The portal is a standalone SvelteKit application with its own PostgreSQL database. It talks to the PKG server to issue API keys and verify signatures, and it uses Yivi for attribute-based login. It does not depend on @e4a/pg-js directly because encryption happens client-side in the apps that consume the API keys (see postguard-website and the pg-sveltekit example).

Tech stack

ComponentChoice
FrameworkSvelteKit with adapter-node (server-side rendering)
UISvelte 5 with runes ($state, $derived, $props)
ORMDrizzle with the postgres.js driver
DatabasePostgreSQL 18
StylingSCSS with CSS custom properties
i18nsvelte-i18n (en-US, nl-NL)
AuthYivi via the official Yivi frontend SDK

Source: README.md

Development

Prerequisites

  • Docker and Docker Compose
  • Node.js 24+ (for running checks locally)

Running locally

bash
git clone git@github.com:encryption4all/postguard-business.git
cd postguard-business
npm install
cp .env.example .env
docker compose up

The stack starts these services:

ServiceURLPurpose
Apphttp://localhost:8080SvelteKit dev server via nginx
Adminerhttp://localhost:8081Database admin UI
MailCrabhttp://localhost:1080Email capture UI
IRMA serverhttp://localhost:8088Yivi dev server

A db-setup service runs migrations and seeds a demo admin account plus an example organization on first start.

Source: README.md

Demo accounts

The seed script creates accounts that work with irma-demo attributes:

RoleAttributeValue
AdminEmailadmin@postguard.eu
AdminFull nameJan de Admin
AdminPhone0612345678
Org userEmailinfo@acme.example.nl

Admin login is at /auth/login/admin. Org login is at /auth/login. Override the admin credentials by setting ADMIN_EMAIL, ADMIN_FULL_NAME, and ADMIN_PHONE in .env.

Site URL

PUBLIC_SITE_URL is the public origin of the deployment. It is used to build canonical tags, the Open Graph image URL, JSON-LD structured data, and the sitemap. Local default is http://localhost:5173; staging and production set it to the deployed origin via postguard-ops.

Source: .env.example

Feature flags

Every feature is toggleable via an environment variable. In development mode, flags can also be toggled at runtime from the admin settings page.

FlagControls
FF_PRICING_PAGEPricing page visibility
FF_REGISTRATIONOrganization registration form
FF_PORTAL_API_KEYSAPI key management in the portal
FF_PORTAL_ORG_INFOOrganization info page
FF_PORTAL_EMAIL_LOGEmail audit log
FF_PORTAL_DNSDNS verification page
FF_ADMIN_PANELEntire admin panel
FF_ADMIN_ORG_STATUSActivate and suspend org buttons
FF_ADMIN_AUDIT_LOGAdmin audit log page
FF_ADMIN_IMPERSONATIONAdmin impersonation feature

Source: README.md

Database

Schema is defined in src/lib/server/db/schema.ts using Drizzle's pgTable. The main tables are organizations (registered organizations), business_api_keys (API keys, prefixed with business_ to avoid collision with the PKG's own api_keys table), and sessions (server-side sessions with hashed tokens).

Releasing

This repository uses Release Please for automated versioning. The first release tag is v1.0.0.