Business in a box: the blocks that help build your Spark project

The building blocks behind every Spark project: customer accounts, payments, email, storage and more, ready from the moment the project exists.

Toy building bricks labelled Storage, AI, Auth, Payments and Email, stacked on a wide brick labelled Online Business.

AI has become really good. ChatGPT and Claude can create really nice web designs in minutes, but real businesses that make money need a lot more than that.

An online business that takes money needs customer accounts, payments, email, a database, file storage, scheduled jobs, analytics and more. Usually that means accounts with six vendors, six API keys, and someone who knows how to connect them.

On Spark, all of it is in the project from the moment the project exists. Internally, we call these pieces “lego blocks”. They provide the fundamental building blocks for all of the tricky parts of building an online business.

What a block is

A block is a service that Spark runs and a project’s code calls. Chat is a block. Email is a block. So are storage, scheduled tasks and model calls.

Every project has a small backend of its own, and that backend holds one credential: a signed token that names the project. Every block accepts that token. The block reads the project from the token’s signature, so one project can never read another’s data or spend on its account.

Here is what that looks like in code. A builder asks for a tips email to subscribers every Monday morning, and the coding agent writes this:

import { email } from './email.js'
import { requireDispatch, tasks } from './tasks.js'

// Every Monday at 9:00, call this project's own backend.
await tasks.put('weekly-tips', {
  cron: '0 9 * * 1',
  timezone: 'America/New_York',
  path: '/hooks/weekly-tips',
})

// The hook emails everyone who owns the monthly plan.
app.post('/hooks/weekly-tips', async (c) => {
  const dispatch = await requireDispatch(c)
  if (dispatch instanceof Response) return dispatch

  await email.send({
    to: { audience: { offer: 'pro-monthly' } },
    category: 'marketing',
    subject: 'This week: bedtime without the battle',
    html: tipsHtml,
    text: tipsText,
  })
  return c.json({ ok: true })
})

That file contains no API key, and there is no account with an email provider behind it. Nobody runs a cron server or a queue. The schedule lives in the tasks block and the sending happens in the email block.

Every block keeps the same contract:

  • One token. Each call proves which project it comes from.
  • Checked before the work. The block confirms that the project’s plan allows the call and that today’s limit has room.
  • Metered after the work. Usage is recorded per project and arrives on one bill.
  • Provider keys stay with Spark. A project never holds a key for a model provider or an email service.
  • A typed client in every project. Each project starts with a client for every block, and the coding agent has a written guide for each one.

Blocks you can use today

BlockWhat the business gets
AuthAllow users to sign up and interact with your business
PaymentsPlug in with your Stripe account, so you can take payments from your customers
ChatAn AI assistant for customers, with memory and with tools the project defines
AIModel calls from the project’s own code: text, structured answers, embeddings and web search
StorageDocuments in collections with vector search, and files of any type, scanned for malware
KnowledgeSearch across the business’s own documents
EmailEmail to one customer, an audience or a saved segment, now or on a schedule
TasksSchedules and one-off jobs that call the project’s backend
CredentialsEncrypted storage for the business’s own third-party keys
App eventsNamed product events with daily totals
AudiencesTags, attributes and saved segments of customers, such as “inactive 14 days”
ConverterFile conversion: Office documents to PDF, spreadsheets to CSV, pages to images
RealtimeLive updates over WebSocket, and the relay credentials a call needs
IntegrationsWeb search, and image, video, voice and music models from ten providers

Integrations is a special block that acts as the middleman between Spark and a collection of third party providers. We’re constantly adding to these - if you have any special needs, please let us know!

Case study - Parenting app

Take Lucy, a parenting expert who wants to sell a paid advice assistant built on her own articles. With no coding knowledge, Spark can take Lucy’s idea and give it superpowers by plugging into our pre-built blocks.

What she asks forWhat serves it
Parents ask a question and get advice in her voiceChat
Answers come from her articles and newslettersKnowledge
She uploads a PDF guide and it becomes searchableStorage and Knowledge
Parents sign in and subscribe monthlySign-in and payments
A tips email to subscribers every MondayTasks and Email
A nudge to parents who have been away for two weeksAudiences and Email
A dashboard of the most common questionsApp events, shown in an internal tool

She describes each feature in the chat, and the coding agent writes the code that connects it to the right block. The only outside account she needs is Stripe, to receive her money.

Many more to come!

This “lego blocks” design has been really successful for Spark - and it means not only can we enable online businesses with great features, but we can handle all of the security and performance concerns that would usually come with writing it yourself.