Leanpub Header

Skip to main content

Build with AI, Build for AI

How to build a modern SaaS using AI as your copilot and as your platform.

Software changed its front door: we don't open apps anymore; we talk to an assistant. Learn to build for that world —a real AI-native app with MCP, OAuth, and LLMs— using AI as your copilot. From zero to production.

There is a new edition of this book available:

Programar con IA, Programar para la IA

Minimum price

Free!

$10.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Software is changing its front door. We no longer open apps and hunt for the right tab: we talk to an AI assistant and expect a direct answer. This book teaches you to build for that world.

You build, from scratch and with your own hands, a complete AI-native application: an MCP server that connects real data to Claude, ChatGPT, or Gemini, with OAuth, a language model working under the hood, and a proactive summary that sends itself. And you do it using AI as your copilot to write the code.

You'll learn to: set up the environment and create a Laravel project; expose MCP tools an assistant discovers and uses; connect an API with OAuth and handle tokens safely; call an LLM and write prompts that work; turn the prototype into a product with plans, deployment, and security; and launch it.

For anyone who has written some code and wants to make the leap to building products in the age of AI. Practical, hands-on, and current.

Share this book

Author

About the Author

Juan Urquiza

Software Engineer | Ciberseguridad | Construyo soluciones con IA | Fundador de hackeruna.com

Contents

Table of Contents

Preface

  1. Who this book is for
  2. The two layers of this book
  3. What you’ll build
  4. How it’s organized
  5. Conventions
  6. A promise and a warning

Chapter 1. What is an AI-native app

  1. A change of front door
  2. What “AI-native” means (and what it doesn’t)
  3. The two directions of the arrow
  4. MCP in plain language
  5. The anatomy of what you’ll build
  6. What you need before you start
  7. Chapter summary

Chapter 2. Set up your workshop: environment and first project

  1. The pieces we’ll install (and why)
  2. The short path: install PHP and Laravel in one go
  3. Install Node.js
  4. The editor: Visual Studio Code
  5. Create the project
  6. Start the server
  7. Put the project under version control
  8. A first “with AI” gesture
  9. Chapter summary

Chapter 3. Your first MCP server and your first tool

  1. The idea in one sentence
  2. Install the official package
  3. Create your first tool
  4. Register the server
  5. Test it from an assistant
  6. A design note: small, honest tools
  7. Chapter summary

Chapter 4. Real data: OAuth and the external API

  1. OAuth explained from scratch
  2. Register your app with the provider
  3. The two routes of the flow
  4. Store the tokens safely
  5. Refresh the token before it expires
  6. Close the loop: real data in your tool
  7. Chapter summary

Chapter 5. Real AI: the LLM and the proactive digest

  1. Two AIs, don’t confuse them
  2. Calling a model from your code
  3. The prompt matters more than the model
  4. From reactive to proactive: the weekly digest
  5. Chapter summary

Chapter 6. From prototype to product: plans, deployment, and security

  1. Plans: the upgrade trigger must be felt
  2. Deployment: get it off your machine
  3. Security: the non-negotiable minimum
  4. Differentiate where it matters
  5. Chapter summary

Chapter 7. Launch: put it in front of real users

  1. The asset almost nobody has: the mobile demo
  2. The channels, one by one
  3. The golden rule of communities
  4. The counterintuitive idea: reactivate before you acquire
  5. Measure what matters
  6. Chapter summary

Chapter 8. Building with AI: the method behind the method

  1. AI doesn’t replace your judgment; it amplifies it
  2. Where AI shines in a project like this
  3. The method in four habits
  4. How this book was written
  5. The full circle
  6. Chapter summary

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub