Leanpub Header

Skip to main content

Offline AI & Local LLMs. Running Llama 3 and Vector Search directly on the Smartphone

This book is 100% completeLast updated on 2026-07-07

Minimum price

$15.99

$19.99

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

Buying multiple copies for your team? See below for a discount!

EPUB
About

About

About the Book

Stop running your applications directly on "localhost" and step into production-grade systems architecture.

For modern developers, building a local prototype is only the first step. The true challenge lies in deployment. When your application scales to include JavaScript frontends, Node.js backend APIs, Python AI inference engines, and relational databases, managing the dependencies and ensuring they run identically across different environments becomes incredibly difficult. This volume provides the definitive, practical guide to containerizing and orchestrating your full-stack JavaScript and AI applications.

In No More Localhost, you will explore the operational patterns used by DevOps and systems engineers to package, secure, and run applications. By treating infrastructure as code, you will learn to build resilient, portable, and highly optimized environments that eliminate the "it works on my machine" problem once and for all.

What you will discover inside:

  • The Core of Containerization: Learn the low-level systems logic behind Docker, distinguishing containers from virtual machines, and mastering namespaces, control groups (cgroups), and layered filesystems.
  • Production-Grade Dockerfiles: Build highly optimized images using multi-stage builds. Implement Next.js Standalone Mode, secure your runtime with non-root users, and ensure proper signal handling with processes like tini.
  • Multi-Container Orchestration: Use Docker Compose to organize your entire stack. Learn to coordinate Node.js, PostgreSQL (with pgvector), and Redis caches, managing startup dependencies with declarative health checks.
  • Local AI and GPU Passthrough: Configure your local environment to run hardware-accelerated AI models using Ollama and Python/FastAPI, utilizing the NVIDIA Container Toolkit to access physical GPU silicon directly from your containers.
  • Essential Linux & DevOps Shell Commands: Master the terminal commands needed to manage processes, configure file permissions (chmod), audit logs, and test network pathways.
  • Security and Vulnerability Scanning: Secure your software supply chain. Learn to scan container layers with Trivy and manage sensitive environment variables and secrets safely at runtime with Zod validation.
  • High-Performance WebAssembly (WASM): Architect client-side pipelines that execute heavy computation inside headless environments, utilizing Web Workers and SharedArrayBuffer for parallel processing.
  • Introspective Debugging: Learn how to diagnose running containers without interrupting service, using logs, interactive terminal executions, and remote debugging ports.

Who this book is for:

This book is written for intermediate to advanced JavaScript/TypeScript developers, full-stack engineers, and technical founders who want to build a bridge between application code and robust systems operations. It assumes basic familiarity with Node.js and the command line, building your DevOps foundations step-by-step.

Master the tools of container orchestration and build scalable, secure, and reproducible systems today.

Table of contents

Chapter 1: Why Run AI on Device? (Privacy, Cost, Offline)

Chapter 2: Understanding Mobile Hardware (NPU, GPU, RAM)

Chapter 3: Introduction to Executorch and Llama.rn

Chapter 4: Quantization - Shrinking Models to fit in your pocket

Chapter 5: Managing Large Assets in App Bundles

Chapter 6: SQLite as a Vector Database (libSQL / OPSqlite)

Chapter 7: Generating Embeddings on Device (Transformers.js)

Chapter 8: Performing Semantic Search Offline

Chapter 9: Syncing Local Vectors with Cloud DBs

Chapter 10: Encrypting Sensitive AI Data

Chapter 11: Running Phi-3 / Gemma-2b on iOS & Android

Chapter 12: Prompt Engineering for Small Models

Chapter 13: Streaming Tokens from Local Models

Chapter 14: Managing Thermal Throttling & Battery

Chapter 15: Fine-tuning basics for Mobile Tasks

Chapter 16: Router Pattern: Local vs Cloud AI switching

Chapter 17: Background AI Tasks (Headless JS)

Chapter 18: Personalization using On-Device Learning

Chapter 19: The Future of Mobile AI Hardware

Chapter 20: Capstone - Building a Completely Offline Chatbot

If printed, this ebook would span over 350 pages. Each chapter is structured into theoretical foundations, an annotated basic example, an annotated advanced example, and five coding exercises based on real-world scenarios with complete solutions.

Team Discounts

Team Discounts

Get a team discount on this book!

  • Up to 3 members

    Minimum price
    $39.00
    Suggested price
    $49.00
  • Up to 5 members

    Minimum price
    $63.00
    Suggested price
    $79.00
  • Up to 10 members

    Minimum price
    $111
    Suggested price
    $139
  • Up to 15 members

    Minimum price
    $159
    Suggested price
    $199
  • Up to 25 members

    Minimum price
    $239
    Suggested price
    $299

Author

About the Author

Edgar Milvus

A veteran software engineer with 20 years of experience, I have dedicated my career to the art of automation. My philosophy is simple: programming should eliminate repetitive chores to unlock human creativity. This journey began early on with the development of custom code-generation tools and has evolved into a deep mastery of LLMs and their APIs. Today, I specialize in architecting AI-driven solutions that handle everything from complex coding and security tasks to advanced knowledge retrieval, transforming the way we interact with technology

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