Thirty-minute path
The shortest route from an empty folder to a passing mainsdk check, with only three ideas to learn.
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.
This is the short path. You learn three ideas, write no main.yaml by hand and finish with a passing mainsdk check. The quickstart builds a larger app once you are through.
The three ideas
- Interface. One standard way to do a job, such as sign-in (
auth), data (db) or model calls (ai). Your code calls the interface, never the provider. - Driver. The provider behind an interface. In development it is a local one that needs no account or key. You swap it later by editing one line.
- The check.
mainsdk checkreads your project and fails on mistakes, such as a key in code or an action anyone can call. It says how to fix each one.
Everything else is optional and has a name in the glossary.
1. Create an app and initialise
npx create-next-app@latest hello --ts --app
cd hello
npx mainsdk initinit writes a main.yaml with the local auth, db and files drivers, logging and a deny-by-default network (the indie preset, the default). It asks no questions. For the bare four-key file, run init --preset minimal.
2. Add what you need
npx mainsdk add auth
npx mainsdk add aiEach add uses a local driver, writes one example test and runs the check.
3. Check
npx mainsdk doctor
npx mainsdk checkdoctor looks at your machine and project. check looks at your code. Both name the fix for every problem.
Let your agent do it
Point your agent at mainsdk check --json --agent. It gets the file and the fix for each finding. After three tries on the same finding it is told to ask you instead of weakening the check.
What runs when
Nothing is published to npm yet. You can run the parts marked Building from the repository today with pnpm install and pnpm mainsdk <command>; the rest is the planned design. Each row says the milestone that makes it run.
| Milestone | What runs | Spec |
|---|---|---|
| Building now | init --preset, check --json --agent, info, network export --to k8s or aws-sg and doctor. The network, files (memory, local, s3), log, access and agent budget interfaces, and @mainsdk/testing. | network, files-share, log-telemetry, agent-governance, cli-core |
| 0.2 | mainsdk init, check, sync, info, logs and dev. Local mode for config, secrets, policy and log, so dev runs offline with no account. | cli-core |
| 0.3 | init --preset, add, doctor and check --json --agent. Local drivers for auth, db and ai, and the other interfaces specified for 0.3, such as files and share. | fast-start and the interface specs |
| 0.4 | The testing kit: @mainsdk/testing with a fake of every interface. | testing-kit |
| 0.5 | Public beta, the migration skill and mainsdk adopt for an existing app. | public-beta, migration-skill |
The installation page has the setup for each framework.
Was this page helpful?