Skip to main content

Dashboards for FastMVC: embed signing, revocation, theme params, Metabase/Grafana/Looker/PowerBI stubs, routers.

Project description

fast_dashboards

HTML dashboards for FastMVC: FastAPI routers and shared layout/CSS for operational UIs—health, API activity, queues, tenants, secrets, workflows—and a reusable render_dashboard_page layout helper. Also signed embed URLs (time-limited HMAC) and Metabase / Grafana embed helpers behind one protocol.

Python: 3.10+ · Dependencies: fastapi, httpx, loguru, pydantic>=2, sqlalchemy>=2 · Optional: PyJWT for Metabase (pip install 'fast_dashboards[metabase]').

What you get

  • sign_embed_url, verify_signed_embed_url — append exp + sig (HMAC-SHA256) for iframe-safe dashboard URLs; optional signed tid (revocation id), theme, locale query params.
  • EmbedRevocationChecker, InMemoryEmbedRevocationList — block leaked embeds by revoking tid before expiry.
  • EmbedThemeParams, theme_to_extra_params — bundle dark/light + locale for sign_embed_url / Grafana.
  • DashboardEmbedProvider, MetabaseEmbedProvider, GrafanaEmbedProvider — unified build_embed_url(resource_id=..., ttl_seconds=...); Grafana supports theme / locale / token_id; Metabase supports theme (URL fragment) and locale (JWT params).
  • LookerEmbedProvider, PowerBIEmbedProvider — stubs; use Looker Signed Embed / Power BI GenerateToken (see below).
  • Composite DashboardRouter — nested routers (health, API, queues, tenants, secrets, workflows); lazy-imported from the package root so fast_dashboards.layout works without the full host app on PYTHONPATH.
  • layout.render_dashboard_page, BASE_CSS — shared HTML shell for dashboards with production SEO (Open Graph, Twitter Card, canonical URL when FASTMVC_PUBLIC_BASE_URL is set, JSON-LD WebPage + SoftwareApplication, theme-color, safe noindex, nofollow defaults for internal ops UIs).
  • core.seoPageSEO, render_seo_head, render_dashboard_inline_head, and robots_txt_* helpers for public sites vs private dashboards.
  • Per-area routers — e.g. HealthDashboardRouter, ApiDashboardRouter, … (see src/fast_dashboards/).

Note: Many sub-routers expect host app modules (core.datastores, start_utils, configurations, …). Run inside a full FastMVC app or only import submodules you need (e.g. layout, embed_signing, providers).

Core vs dashboards: Generic “platform” building blocks that used to live under fast_dashboards.core (auth, tracing, encryption, smart cache, saga, etc.) are implemented in fast-platform under fast_platform.core (and fast_platform.caching). fast_dashboards.core still re-exports them for compatibility; prefer from fast_platform.core… in new code. Dashboard-only pieces remain here (layout, router, embed signing/theme/SEO, …).

Looker (recipe)

Looker Signed embed uses a server-generated SSO URL per session. Implement a small service that calls Looker’s API with your embed secret, then pass the returned URL to the iframe. Do not expect a static build_embed_url from this package — LookerEmbedProvider is a deliberate stub.

Power BI (recipe)

Use the Power BI REST API GenerateToken for reports/dashboards (Azure AD app registration). Return the embed URL + token to the client per Microsoft’s embed flow. PowerBIEmbedProvider is a stub pointing you to that flow.

Revocation example

from fast_dashboards import InMemoryEmbedRevocationList, sign_embed_url, verify_signed_embed_url

secret = b"your-32-byte-secret-here!!!!"
block = InMemoryEmbedRevocationList()
url = sign_embed_url("https://dash.example.com/view", secret, 3600, token_id="session-abc")
# Later: leak detected
block.revoke("session-abc")
assert verify_signed_embed_url(url, secret, revocation=block) is None

Install

pip install -e ./fast_dashboards

Optional dev extras

pip install -e ".[dev]"

Related packages

  • fast_db — when dashboards query SQLAlchemy.
  • Monorepo: ../README.md.

Tooling

See CONTRIBUTING.md, Makefile, and PUBLISHING.md.


Documentation

Document Purpose
CONTRIBUTING.md Dev setup, tests, monorepo sync
PUBLISHING.md PyPI and releases
SECURITY.md Reporting vulnerabilities
CHANGELOG.md Version history

Monorepo: ../README.md · Coverage: ../docs/COVERAGE.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastx_dashboards-1.7.0.tar.gz (176.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastx_dashboards-1.7.0-py3-none-any.whl (170.4 kB view details)

Uploaded Python 3

File details

Details for the file fastx_dashboards-1.7.0.tar.gz.

File metadata

  • Download URL: fastx_dashboards-1.7.0.tar.gz
  • Upload date:
  • Size: 176.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fastx_dashboards-1.7.0.tar.gz
Algorithm Hash digest
SHA256 2163214e8a481027755e35e2433048a252323795c704c6f302f8ca211d02f6af
MD5 be8fe1804859f96254e6bfc289d8b0aa
BLAKE2b-256 d0d442dfe98c7b50b842f399a3f5642fbbeeafbfb31e637e85b592c3f80322e9

See more details on using hashes here.

File details

Details for the file fastx_dashboards-1.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastx_dashboards-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d793e970c5055d502a46200185a9c56b873aa5dbd985a5b1317046960fc89f4f
MD5 32333c0cec9e86cca0a650fd00f84ab3
BLAKE2b-256 118873acb964684df3cab3e180da82464333725afeafb67f8f4943af5b8813fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page