Skip to content
All work

Personal project · Multi-tenant SaaS · Analytics

PulseBoard

A multi-tenant SaaS for sales management and analytics, from database to deploy

Catalog, customers and sales per organization, with a dashboard and metrics computed in the backend, in each organization's time zone. It is live with a public demo, technical documentation, automated tests and CI-gated API deploys.

  • Multi-tenancy
  • Sanctum SPA authentication
  • SQL analytics
  • Per-organization time zone
  • Testing
  • CI/CD
Role
Author — product, frontend, backend and deploy
Period
2026
Type
Personal project
Stack
  • Nuxt
  • Vue.js
  • TypeScript
  • Pinia
  • Tailwind CSS
  • Laravel
  • PHP
  • PostgreSQL
  • Vitest
  • Playwright
  • GitHub Actions
  • Docker
  • Cloudflare
PulseBoard dashboard with KPIs compared to the previous period, daily revenue, status distribution and rankings

What PulseBoard is

An application to follow a business's sales operation: how much did I sell this period compared to the previous one, which products drive revenue, how many customers came back.

  • Organizations and roles — sign-up creates the user, the organization and the owner membership; owner and member have different permissions, enforced by the API.
  • Products and customers — CRUD with search, detail pages with sales metrics and deletion that preserves history.
  • Transactions — read-only sales history, with items and the price at the time of sale.
  • Dashboard and analytics — revenue, orders, average ticket and customers, revenue by day, week or month, rankings and status distribution, always next to the previous period.
  • State in the URL — period, filters, sorting and pagination live in the query string.

Screens

Customer analytics with total, active, new and returning customers and a ranking
Customer analytics — active, new and returning, always next to the previous period.
Transaction list with filters by status, customer and period
Transactions with filters in the URL — shareable links, back and forward work.
PulseBoard dashboard on a phone screen
The same dashboard on a phone. The product interface is in Portuguese.

Technical decisions

Approach How the work was done.

  1. Step 01

    Layered isolation

    Multi-tenancy

    A shared database with organization_id on every domain table. The X-Organization-Id header selects the context but does not authorize on its own — middleware validates membership on every request.

    • Session (401), membership (403), route model binding (404, without revealing existence), Form Requests (422), models and policies.
    • The tenant never comes from the client — organization_id in the payload or query is rejected.
    • Dedicated tests check that another organization's data shows up neither in lists nor in aggregated numbers.
  2. Step 02

    Sanctum SPA

    Authentication

    Session in an httpOnly, Secure, SameSite=Lax cookie, with CSRF via XSRF-TOKEN and automatic retry on 419. No credentials in localStorage; Pinia only holds UI state.

    • Accepted consequence — frontend and API must be on the same site (app. and api. under henriqueverri.dev).
    • CORS restricted to the frontend's exact origin, and rate limiting on login and sign-up.
  3. Step 03

    One metric definition

    Analytics

    Everything is aggregated in SQL in the backend, one service per endpoint; the frontend recalculates nothing. Each screen's summary is the same number as the dashboard by construction.

    • A previous period of the same length for every metric.
    • Money as a decimal string in the API, never a float.
    • A fixed number of queries per endpoint, locked by a test.
    • Cross-endpoint consistency is tested — dashboard revenue equals the time series and ranking totals.
  4. Step 04

    The business calendar

    Time zone

    The database stores UTC; the business calendar is the organization's IANA time zone. Day, ISO week and month buckets are grouped in local time by PostgreSQL, with correct daylight saving time — tested in CI.

    • The client never picks the time zone; the frontend computes "today" and the presets in the same zone.
  5. Step 05

    CI before deploy

    Delivery

    GitHub Actions runs Pint and PHPUnit on PostgreSQL, ESLint, typecheck, Vitest, the static build and an E2E smoke test with Playwright against the production build.

    • Frontend on Cloudflare Pages; API in Docker on Render, published only after the checks pass.
    • If the container fails to start, it takes no traffic and the previous version stays live.

Decisions And their trade-offs.

  1. 01

    Sanctum SPA with an httpOnly cookie

    Why: Credentials out of JavaScript's reach, native CSRF and no extra BFF.

    Trade-off: Frontend and API must share the registrable domain; Pages previews cannot authenticate.

  2. 02

    Nuxt as a static SPA

    Why: The session is an API cookie; SSR would add nothing and would require a Node server.

    Trade-off: No server rendering — irrelevant for an authenticated area.

  3. 03

    Multi-tenancy by organization_id

    Why: Simple to operate, with isolation enforced in layers and covered by tests.

    Trade-off: Isolation depends on the application, not the database — no schema per tenant, no RLS.

  4. 04

    Analytics aggregated in the backend

    Why: One metric definition for every screen; the frontend only presents it.

    Trade-off: Every request hits the database, with no cache.

  5. 05

    Playwright against the production build

    Why: It validates the artifact shipped to Pages, with a real API and PostgreSQL.

    Trade-off: A smoke test of the main flow, not an extensive E2E suite.

Architecture

Browser
   │
   ▼
Static Nuxt 4 SPA ─────────── Cloudflare Pages · app.henriqueverri.dev
   page → composable → repository → useApiClient
   │
   │  REST + session cookie (Sanctum SPA, CSRF) + X-Organization-Id
   ▼
Laravel 12 API ────────────── Render · Docker · api.henriqueverri.dev
   tenant middleware → Form Request → Controller
     → Policy → Service (SQL aggregations) → API Resource
   │
   ▼
PostgreSQL ────────────────── Supabase

On the frontend, no component makes HTTP calls directly: access goes through repositories and useApiClient, which centralizes credentials, the organization header, CSRF and error normalization. Pinia only for the session; screen data via useAsyncData keyed by organization.

Outcome What changed.

  • A public demo at app.henriqueverri.dev, with owner and member accounts to explore the permission differences.
  • Isolation between organizations enforced in six layers and verified by dedicated tests.
  • Numbers consistent across screens by construction, and checked by cross-consistency tests.
  • Technical documentation for architecture, API, testing and deploy in the repository.

Documented numbers

  • ~2–45 ms

    Analytics queries over 30 days

    Per query, via EXPLAIN ANALYZE on PostgreSQL 16, on a disposable database with 200k transactions and 500k items.

    Source: docs/architecture.md, Performance section

  • 1 to 4

    Queries per analytics endpoint

    A fixed number, regardless of volume, period or granularity.

    Source: README, locked by AnalyticsQueryBudgetTest

  • 376

    API tests

    PHPUnit — auth, isolation between organizations, CRUD, analytics, time zone and operations.

    Source: Repository README, Testing section · September 2026

  • 168

    Frontend tests

    Vitest and @nuxt/test-utils — utilities, API client, session, composables and pages.

    Source: Repository README, Testing section · September 2026

Scope and next steps

PulseBoard is a personal project built as a product: there is no company or real customers behind it. Transactions come from a demo data generator, the infrastructure runs on free plans (the API can take up to about a minute on the first request after being idle) and the interface is in Portuguese only.

What the current architecture would ask for first to run with real traffic — not implemented yet:

  • Observability: error tracking, per-endpoint latency and alerts, beyond today's logs and health check.
  • Rate limiting beyond authentication, starting with the analytics endpoints.
  • Staging and managed backups, to validate migrations before production.
  • Analytics caching or pre-aggregation for large organizations — the path the measurements point to, rather than new indexes.

More work

Henrique VerriFrontend Engineer

Is your product growing? Let's talk.

I'm looking for teams that treat the frontend as engineering — components with clear rules, API contracts discussed early, testing and code review as part of the flow.