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
ownermembership;ownerandmemberhave 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



Technical decisions
Approach How the work was done.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.



