Vibe code your entire CRM on rock-solid engineering.
Spools is an open source CRM framework. It gives your coding agents the sign-in, data layer, security, search, email and tests, so they only write what is specific to your business. A CRM built with it is called a Spool.
Website · Documentation · Quickstart · Contributing
Built and maintained by the team at Swirls.
Your agents write a config, choose the services and add your own code. Spools handles everything underneath:
- Access checked on every request. Pages and endpoints check the session and the access list. Lint refuses one your agent writes without the check.
- Roles the server enforces. A role can be denied an object or left to read it, and a branch kept to its own records. The check is in the data layer, for every page, search, export and your own code.
- Typed Postgres tables. Each object is a table in your database, with migrations and row-level security.
- Rules that hold for every writer. Unique values, locked and append-only records, and fields set once are each a line of config, kept for the interface, imports, the assistant and your own code alike. A field can also be left to the server to write.
- Each email sent once. Sequences keep their place through a restart, and two servers never send the same email.
- Each post sent once. Social posts go out when a teammate approves them, to LinkedIn, X, Facebook or a network you add, and never twice.
- Secrets kept on the server. Tokens are sealed before they are stored, and the build fails if server code built on Effect reaches the browser.
- Time limits on outside calls. Failures are typed with Effect, and calls are retried where that is safe.
- Modules. A feature set (its objects, code, tables and panels) plugs into any Spool, and a clash with yours is refused, never silently won.
- More than 1,300 tests. The server tests run on all three database adapters.
Most changes are a few lines you can read. The framework updates as a package, so you never merge it. You can import your records from HubSpot, Salesforce or a spreadsheet.
Read building with coding agents and when to use Spools.
Install Bun 1.4 or later, then make a Spool:
bun create @swirls/spools my-crm
cd my-crm
bun run db:seed
bun run devOpen http://localhost:3000. You need no accounts. Until you choose real services, records go in a Postgres inside the server and you are signed straight in. A production build refuses to start that way.
Or let your coding agent do all of it. Paste this into Claude Code, Cursor or Codex:
Read https://md.spools.codes/prompt.md and follow it to build my CRM with Spools
Once you have a Spool, open the folder in your agent and say what you need:
Build our CRM. We sell commercial insurance, and we track companies, the people at them, policies with a renewal date, and claims. Policies move from quoted to bound to renewed or lost.
AGENTS.md tells your agent where each kind of change goes, and bun run check tells it what to fix. The quickstart makes a few changes by hand.
// src/spool.server.ts
import { defineSpool } from '@swirls/spools'
import { swirls } from '@swirls/spools/agents/swirls'
import { clerk } from '@swirls/spools/auth/clerk'
import { postgres } from '@swirls/spools/database/postgres'
import { resend } from '@swirls/spools/email/resend'
import { drive, s3Blobs } from '@swirls/spools/files/drive'
import { aes } from '@swirls/spools/vault/aes'
import crm from '../crm.config.json' with { type: 'json' }
import extensions from './app/extensions'
export default defineSpool({
crm, // your business
extensions, // your code
auth: clerk(),
database: postgres(),
files: drive({ blobs: s3Blobs() }),
email: resend(),
vault: aes(),
agents: swirls(),
})Each page and endpoint is a small file in src/routes. Delete one to drop a page, or write your own.
| Import | What it is |
|---|---|
@swirls/spools |
defineSpool |
@swirls/spools/extensions |
For src/app/extensions.ts: hooks, handlers, and the record functions |
@swirls/spools/module, ui/slots |
What a module is written with |
@swirls/spools/auth/*, database/*, files/*, email/*, vault/*, agents/*, rate-limits/* |
The adapters that ship with it |
@swirls/spools/adapter |
What an adapter is written with |
@swirls/spools/pages/*, api/*, ui/* |
Pages, endpoints, and interface parts for your route files |
| Part | Ships with | Without one |
|---|---|---|
auth |
Clerk, Better Auth, a development sign-in | Required |
database |
Any Postgres through Effect SQL, PGlite in the server, Prisma 8 (release candidate) | Required |
files |
Your database with a local disk or any S3 bucket, FlashDrive | The Files pages say files aren't set up |
email |
Resend, or your own function | Emails are logged |
vault |
CipherStash, AES-256-GCM | No outside tokens are stored |
agents |
Swirls | Workflows are skipped, the assistant is off |
rateLimits |
Counts in the server's memory, or in your database | Counted in memory, per instance |
Every database adapter runs the same integration tests. See choosing adapters and writing your own.
A feature set of your own, or someone else's, plugs in as a module: modules: [approvals] in the same file. examples/modules/approvals is a worked one.
Read the deployment guide and the security guide. Everyone on the access list can see and change every record until you give roles access or turn on record scopes, and fields marked encrypted are stored as plaintext until @cipherstash/stack-prisma supports Prisma 8.
Spools is early software (0.x). It works end to end, and minor versions may include breaking changes, which the changelog explains.
| Area | State |
|---|---|
| Config, records, views, search, tasks, notes, reports, CSV, actions, sequences | Unit and integration tested on PGlite, Postgres through Effect SQL, and Postgres through Prisma |
| Modules, record rules, role access, live updates, idempotent requests, rate limits | Unit and integration tested on the same three stores, each on a Spool of its own |
| Interface | Browser tests cover access, records, the board, search, import, tasks and the assistant |
| Swirls workflows, assistant, tool API | swirls doctor clean and the tool API tested; not yet run against a live project |
| Better Auth, Resend, FlashDrive, S3, the AES vault | Tested against stand-ins; not yet run against live accounts |
| Marketing: the website check, posts, ad results, and each built-in network | Tested against stand-ins; not yet run against live LinkedIn, X, Meta or Google Ads accounts |
| Clerk, CipherStash, the Swirls adapter | Only the code around the service is tested; not yet run against live accounts |
| Field encryption in the database | Not yet |
What's next is in the roadmap.
git clone https://github.com/ByteSliceHQ/spools.git
cd spools
bun install
bun run devThe starter CRM runs at http://localhost:3000 and the website at http://127.0.0.1:8788. bun run verify runs the build, types, tests, lint and formatting. CI also runs the tests on Postgres and Prisma, makes a new Spool from the packed packages, and runs swirls doctor.
| Path | What it is |
|---|---|
packages/spools |
@swirls/spools, the framework |
packages/create-spools |
@swirls/create-spools, which makes a new Spool |
apps/starter |
A working Spool: what create-spools copies, and where work happens |
apps/docs |
Source for spools.codes |
examples |
Adapters and a module written outside the framework |
docs |
The documentation |
Use GitHub issues for bugs, feature proposals, and usage questions. Include a small reproduction when reporting a bug, and remove credentials and customer data from anything you share.
Code, documentation, adapters, reproductions, and thoughtful reviews are welcome. Read CONTRIBUTING.md to get started and our code of conduct for community expectations.
Report suspected vulnerabilities privately to [email protected], following SECURITY.md.
Spools is maintained by the team behind Swirls, which also makes Looms, a durable execution runtime for agents and workflows.
Spools is licensed under Apache-2.0. See NOTICE for attribution.