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.
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.
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
npx mainsdk initThis 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
npx mainsdk add authadd 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
npx mainsdk doctordoctor 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
npx mainsdk --helpmainsdk --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
| Output | Fix |
|---|---|
Node ... is too old | Install Node 22.18 or later |
No main.yaml | Run npx mainsdk init |
.mainsdk/ is not in .gitignore | Add .mainsdk/ to .gitignore |
Next
Was this page helpful?