Guest Post: On Self Publishing with Leanpub, By John Koster

10 min readOct 25, 2022


I recently released my latest book Advanced PHP Strings: Text analysis, generating, and parsing via. Laravel, and I thought it would be fun to step back and look behind the scenes at the writing process and tools used to help manage such a large project, as well as my techniques for coming up with ideas and staying motivated throughout the life of a project.

Staying Motivated and Cultivating Ideas

One of the most common questions people have asked me over the years is, “Where do you find the time?!” Even though I have answered this question many times, I have never stopped to think about it in great depth.

After some retrospection, I can understand the motivation behind the question. I have a full-time job that I love, a wonderful family, a blog, and larger writing projects. I also contribute to open-source projects, such as Statamic, and create and maintain many of my own projects. My answer to this question has always been planning.

Understandably, this is one of those answers that never feels satisfying. Everyone wants that “one secret they don’t want you to know about.” But it is true; once you have an idea, spending even five minutes intently thinking through it and developing a plan to make progress on whatever it is can easily save hours of floundering later.

When I say to spend time thinking through and developing a plan, I make a conscious effort never to imply you should sit down and meticulously plan every last detail of a project. Developing a detailed plan for every step of a project is often challenging and unnecessary for most projects, especially creative ones. Have an idea of the project and where you want to go, and when you sit down to make progress on your project, make a small plan for what it is you are about to do. Allow yourself to be flexible and always allow for the possibility of pivoting at any time.

But how to start a project, and how to stay motivated throughout it? Whenever I start a project, I like to identify what is likely to be the most challenging aspect of that project and work through that first. For software development projects, working through the most challenging part of the problem helps to quickly validate the idea and will prevent spending an immense amount of time on an idea that may not work out. Always keep the option to pivot open. For writing projects, the approach is essentially the same.

Most of my writing projects contain an underlying question or concept I am trying to learn more about myself. For example, with Advanced PHP Strings, the overall goal was to take advanced string manipulation concepts and distill them into smaller, more straightforward concepts, eventually leaving the reader with a toolset to take things further on their own. With this specific project, the most challenging task was “how can I help someone approach writing parsers or extract information from input text where regular expressions are not the most appropriate tool.” My approach for this project was to first develop the code examples for these challenging topics and reverse engineer the smaller concepts and supporting techniques. These concepts and supporting techniques became the foundations for most of the book’s chapters leading up to the book’s larger hands-on projects. Know where you want to go, and develop small plans to help get you there.

Tackling the most challenging aspect of a project first and working back up to it can help tremendously with motivation. After all, you have already faced the hardest part. Nothing is more deflating than spending potentially hundreds of hours on a project and coming up against a seemingly unclimbable wall. But what about when you cannot climb the wall or are having difficulty staying motivated?

The Advanced PHP Strings project started as the third installment of The Laravel Companion series. When working on the third edition, I had tremendous fun working on the chapters related to strings and text management. However, I became frustrated and unmotivated when attempting to work through the remaining chapters. I would sit down and attempt to make substantial progress but always set it aside again; this process continued for almost a year before I decided it was not the book I wanted to write. Always allow for the possibility to pivot.

But what about the project ideas themselves? Where do those come from? This is a complex topic to discuss in general terms, as it is such a complicated thing and highly personal. However, I can spend some time talking about my own ideation process. Over the last ten years, I have written over six hundred blog posts, completed three self-published large writing projects, and written thousands of pages of projects that have never been released. Each of these writing projects started with an initial idea.

Each of these ideas has generally come from one of two things. The first and most common source of ideas is simply paying attention to what tasks I found challenging or things I thought took way too long to figure out on my own. When I encounter these scenarios, I write them down with a few basic contextual details and move on with my day. The second source of ideas is external: I pay attention to the questions I get asked or see what types of things others are having difficulty with. If these external prompts resonate with me, I will also note them.

My personal note-taking process is incredibly simple by design. For example, I keep all my notes in a simple text file, and I purposely do not use any dedicated software or services for this task. While this is not the most efficient or even the most organized, I personally find value in not optimizing every aspect of my day. I enjoy having the opportunity to slow down and spend some time with my ideas.

When I get the urge to start a new creative project, I will review my list of ideas and begin developing a plan for the first one that stands out to me on that day. This asynchronous process of tracking ideas and reviewing them helps me not rush into things and provides ample time to think through them. Don’t force the ideas; let the ideas choose themselves.

Leanpub, Statamic, and My Writing Process

Ever since early 2013, every time I have decided to work on an extensive writing project, I have always chosen to use Leanpub. I do this because I love that I can write a manuscript in Markdown and am not vendor-locked into proprietary text formats. Furthermore, I bring the content to them, meaning I can store it wherever I want, whether on another service like Dropbox or by integrating source control systems like git. No proprietary formats and I control the content.

My writing process with Leanpub has changed significantly over the last nine years. When writing the first few projects, I would simply write them in simple Markdown files and add them to the “Book.txt” file in the order I wanted them to appear. This technique works well for small to medium-sized projects but can quickly become overwhelming when working on extensive projects, such as Advanced PHP Strings.

When beginning Advanced PHP Strings, I knew it would be one of my larger projects (it ended up being much more significant than I initially thought). Because I am a software developer, I thought about creating a system to help manage the project. However, the more I thought about what I wanted this system to do, I realized I needed a content management system.

I spent a few days working on a small system (because every developer needs to develop multiple content management systems throughout their career). After a few days, I came to a slightly embarrassing realization: I was wasting my time. I consider this an embarrassing realization because I already knew the perfect solution to help me organize and manage my project. I had even been using it since the summer of 2017! Enter Statamic.

Statamic is a content management system built on top of the Laravel framework. By default, it is a flat-file system and allows you to write your content using Markdown. A match made in heaven for anyone looking to stay organized while working on large Leanpub projects.

Statamic is incredibly flexible and allows anyone with even a small amount of PHP knowledge to quickly build up a bespoke, custom solution to match their project’s specific needs. While it has some sensible defaults and some recommendations, it does not impose any real restrictions on you. Your project — implement it the way you want. And just like Leanpub, you’re not locked into specialized file formats or methods of doing things.

I won’t spend much time going through the technical details of the project I created using Statamic, but I think it will be fun to go through some high-level ideas.

For starters, each writing project I am working on is organized into a Collection within Statamic, which is just a way to group related content together. This could be pages, blog posts, events, or anything else you could think of. For my use case, it is sections and chapters of my Leanpub book. I also have other collections to help organize notes specific to the writing project, references, and additional resources that I may need across multiple writing projects.

With this specific project, I decided to lean into some of Statamic’s more powerful features, such as its incredibly extensible Bard editor. Their Bard editor allows you to get as complicated as you want with the editing experience. I used it to develop specialized editing blocks that are equivalent to the various features offered by Leanpub Flavored Markdown and Markua.

From here, I was able to develop a simple website template that outputs the editor’s contents in a way close to what Leanpub will produce using the Preview book feature. Combining the Bard editor and the Live Preview features within Statamic allowed me to create a way to approximate how my Leanpub book would look throughout the writing process.

Although I used Statamic’s Control Panel and Bard editor throughout the writing process, the book’s content is still stored as flat files, allowing me incredible flexibility in how I eventually managed and exported the project. While stored as flat files, the Bard editor has special structural requirements for the Control Panel experience to function correctly. To get the content in a format suitable for Leanpub, I created an additional set of templates that produces Leanpub Flavored Markdown instead of HTML as output. Just because a system is primarily designed to make something for web browsers does not mean it is restricted to only doing that.

To help stay focused during the writing process, I split each chapter, and sometimes sections within each chapter, into their own Statamic entry. To help bring all of these individual entries into one cohesive export for Leanpub, I extensively use Statamic’s navigation menu feature. Instead of using the feature to organize menus for a website, I used it to organize each of the entries into a series of chapters and sections.

Part of my project’s export process is to use the navigation menu to determine the order in which files should be “rendered.” This helped to make the output of chapter and section headings dynamic, allowing incredible flexibility with how the book is organized without having to worry about the relative headings within each entry. Additionally, part of the export process automatically creates a “Book.txt” file for me that Leanpub can understand.

And finally, I customized Statamic’s dashboard to feel a little cozier and welcoming. When I log in, I can see the covers of all my large active writing projects and quickly access the chapters and sections I have been working on recently.

Writing The Laravel Companion 2nd Edition took me over a year from start to finish, manually organizing and keeping track of files. With the powerhouse combination of Leanpub and Statamic, the writing process for Advanced PHP Strings took just under forty-five days once I decided I wanted to write the book.

Final Thoughts

To round out this article, I just wanted to say that if you have been contemplating working on a larger writing project but have been putting it off, you should try it. I know these types of projects can feel intimidating and scary, but no progress is made by standing at the base of a wall staring up. Pick a spot and start climbing.

You are almost guaranteed to slip somewhere, and if you make it back to the bottom, you do so with more knowledge for your next climb.

John Koster is the author of the Leanpub book Advanced PHP Strings: Text analysis, generation, and parsing via. Laravel. Click here to see John’s profile on Leanpub, and if you’re a Leanpub author and you’d like to write a guest post of your own, please reach out to the team anytime at Thanks for reading!




Leanpub is the best way in the world to write, publish, and sell ebooks. Publish in-progress, serial and complete ebooks in PDF, EPUB and MOBI.