Power your frontend β
Build APIs that power your mobile apps, React frontends, and third-party integrations.
APIs sit behind your mobile apps, frontend interfaces, and third-party integrations. Leaf helps you build them fast, keep them secure, and maintain them without headaches.
Getting started β
leaf create my-app --api
cd my-app
leaf serveYou're live and ready to build.
Start with a real API, not a blank page β
Out of the box, you can build:
- π User authentication (login, signup, JWT)
- π± Mobile app backends
- π Third-party integrations
- π³ Payment webhooks
- π Frontend APIs (for React, Vue, Svelte)
There's no wiring to do, and no guessing about structure.
Your API is ready for AI β
Leaf MVC gives agents shared project memory out of the box. Open an agent in the project and it reads .leaf/CONTEXT.md alongside your routes, controllers, models, and database files, then syncs useful structural changes back into the context.
Tell it:
"Add a stripe webhook endpoint"
"Create a user authentication API"
"Build a todo list API"
No AI setup or context command is required.
If you use an external assistant without access to the project folder, run leaf context and paste the compact output into your conversation.
Project Structure β
Leaf organizes your API into a simple, convention-based structure:
- Routes: Define your endpoints
- Controllers: Handle requests and return JSON
- Models: Interact with your database
- Database: Your schema and migrations
ββββapp
β βββ controllers
β βββ database
β βββ models
β βββ routes
ββββpublicReady for real users β
Once your API is built, tested, and ready, deploy it to Heroku, Fly.io, DigitalOcean, or any shared hosting service.
For your frontend, upload to Google PlayStore or the Apple App Store, use Netlify, Vercel, or GitHub Pages for web apps.
What to read next β
Now that you have an API live, here's what you need to know next:
Routing
Learn more about routing in Leaf, dynamic routes, middleware and more.
Using Controllers
Controllers are the 'C' in MVC, and separate your logic from your views.
Using Models
Models are the 'M' in MVC, and let you interact with your database programmatically.
Authentication
Learn about signing users in and out, user management, roles + permissions, and more.
