MainSDK
Search⌘K
How-to

Start a project and add interfaces

Create main.yaml, add an interface with its local driver and a test, and check the machine and project.

Planned for 0.3

Status Status is where the work is: Planned (in a milestone, not started), Building (tickets in progress), Preview (usable, may change), then the stability it ships at.

Stability The promise an interface ships with.

  • Stable Follows semantic versioning; breaking changes need a new major, 12 months of overlap and a codemod.
  • Beta Usable in production; may change before it becomes stable.
  • Experimental May change or go away; needs an explicit opt-in in main.yaml.
Stability levels
Updated 2026-10-28

You will create a MainSDK project, add the interfaces you need one at a time, and check that the machine and the project are healthy. It takes about 10 minutes.

You need

  • Node 22.18 or later and a repository for your app.

1. Create the project

bash
npx mainsdk init

This writes main.yaml with a project id and the local auth, db and files drivers, logging and a deny-by-default network (the default indie preset; --preset minimal writes only the four required keys), and adds .mainsdk/ to .gitignore. Running it again in the same repository exits 2 unless you pass --force or --new-id.

2. Add an interface

bash
npx mainsdk add auth

add works for auth, db, files, network, log, ai and pay. It sets the interface's local driver in main.yaml, writes one example test and runs check. It never weakens a key that is already set.

3. Check the machine and the project

bash
npx mainsdk doctor

doctor checks the Node version, that main.yaml loads and that .mainsdk/ is ignored. It prints one problem line for each failure and exits 1.

4. Find a command

bash
npx mainsdk --help

mainsdk --help (or mainsdk -h, or mainsdk alone) prints every command by group; mainsdk help <command> prints the usage, flags, examples and exit codes of one.

Check it worked

npx mainsdk doctor prints mainsdk doctor: all good and npx mainsdk check passes.

If it fails

OutputFix
Node ... is too oldInstall Node 22.18 or later
No main.yamlRun npx mainsdk init
.mainsdk/ is not in .gitignoreAdd .mainsdk/ to .gitignore

Next

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet