Recipe: API-to-SPA Dashboard
This recipe ingests data from an external API and serves it as a custom single-page app. An http endpoint (buffered through a queue) lands the data in sql, and a spa hosts the dashboard your users actually see — your own React/Vue/Svelte front end, built and served by the platform.
The problem it solves
You have data arriving over HTTP and you want a real, branded front end on top of it — not a generic admin table, but the dashboard your team designed. The usual answer is a separate hosting stack, a separate deploy, and glue code to connect the two. This recipe keeps ingest, storage, and the custom UI as elements in one circle, so the front end and its data live together.
Elements
| Element | Role |
|---|---|
http | Receives inbound API requests / payloads. |
queue | Buffers bursts so ingest never overwhelms the database. |
sql | Stores the structured data the dashboard reads. |
spa | Hosts your custom single-page app (React, Vue, Svelte, Solid, Astro, or vanilla). |
Flow
- Create an
httpelement to receive inbound requests — it connects flows to HTTP endpoints for receiving and sending. - Put a
queuebetween ingest and storage.publisheach incoming payload to the queue so spikes are absorbed; check depth any time withqueue_stats. - Create a
sqlelement. As messages drain from the queue,insertthem; shape the tables withmigrateand read them back withquery(bind parameters supported). - Create a
spafor the front end.buildit (BuildForce auto-detects the framework — react/vue/svelte/angular/solid/astro/vanilla), thenservethe assets; usebuild_statusto watch the build andpreviewbefore you publish. - Have the SPA read its data from the
sqlelement’squeryoperation, so the dashboard always reflects what ingest landed.
What this shows
The spa element means “custom front end” is a first-class building block, not an afterthought bolted onto an API — you bring your own framework and the platform builds and serves it. The ingest path stays honest about load: the queue gives you backpressure between a bursty HTTP source and a database that prefers steady writes, and sql is the durable middle the UI reads from. Three layers — receive, store, present — each a real element you can deploy and inspect on its own.