Building AI into your software (without the hype)
We’re building a multi-million dollar education business with just two and a half people—powered by AI and automation. I break down the real principles, code, and prompts that let us scale fast without adding headcount.
Everything I said
I'm gonna show you how me and my friend Steve are using AI to make a multimillion-dollar business. Now, importantly, this is not an AI company. We're not an AI company. We're a very boring, traditional education company, but we're using AI to make ourselves more effective. So it's me and Steve, and we have one part-time employee, so there's two and a half people, and we're looking to hit two and a half million dollars.
Now, I know Sam Altman said there's gonna be a billion-dollar one-person company. That sounds awesome. That's not us. So I'm gonna show you actual code, actual prompts, and we're gonna dive into how AI is helping us run this business. It's probably helpful to explain what our business actually does. So like I said, we are an education business. We sell primarily developer education.
So here we've got High Performance SQLite if you wanna... Hey, if you wanna learn how to use SQLite the database, if you wanna learn how to use Postgres the database, we've got Mastering Postgres. If you wanna learn how to use Rails with SQLite, we've got High Leverage Rails. And then finally, we've got a course on how to create video at screencasting.com.
So this is what we sell. We sell education, primarily videos, primarily taught by me. Now, where does AI come in? It comes in everywhere. Here, here are several of the steps. It comes in at almost all of these steps. In the research phase, in the research phase, I'm doing a ton of... Well, I'm doing a ton of, of reading. You can see behind me all those books. I'm doing a ton of reading. I'm finding stuff on the internet.
Deep research helps here, so help me uncover new primary sources. It also helps me synthesize a lot of the research that I've already done. But I'm not really asking GPT to come up with an entire course outline, but I am brainstorming with it, with my domain knowledge to help me figure out, uh, maybe a good way to break stuff up or go deeper in certain areas.
Recording and editing, that is, uh, that's a hundred percent human. I do all of the recording, and Steve does all of the editing, unless it's a guest instructor. Um, and I think one of the principles here is we should let computers do what computers are good at, and humans do what humans are good at. When we get down to transcoding and publishing, those are very much just computer activities.
But recording the videos, actually teaching other people, I still think is a pretty human activity. I use AI all the time while I'm coding, um, but I still think teaching is a very human activity. And one thing that I'm not gonna do is ever create an AI avatar of myself and then pretend like it's actually me. I think that's a bad idea.
So over here, we've got some principles. Um, let's say, "Let the computer, let the computer do what computers are good at." And let's make this, uh, we'll make this black and not faded. Um, so that is one principle, and we're gonna come back, we're gonna come back over time.
I've got a few other principles, um, principles for working with AI. First is, "Let the computer do what the computer's good at so that the humans can do what the humans are good at." I think it's really sad when we're letting the computers do what humans should be doing, but that's a topic for a different day. Now, getting down here to transcoding and publishing, there's a lot of grunt work down here.
So the first thing is transcoding. That's taking those massive videos that we record and turning them into something that is, uh, more easily delivered over the internet. Now, we've got a full article on this with a very good, if a little bit wordy, title, "Delivering 15 terabytes of 4K video with Cloudflare R2 for $2.18." It's a good title.
It could be a little pithier, I will admit. Um, but in this article, we just basically share all the secrets for how we deliver all of our video, including this giant script right here, this FFmpeg command. And this is where AI comes in again. Um, and let's do this. I, I have another principle here.
So another principle is, um, "Use non-deterministic..." Uh, hey, I got that right. "Use non-deterministic systems to produce deterministic..." Boy, it's a long one. Uh, "systems." Now, what in the world does that mean? "Use non-deterministic systems to produce deterministic systems." AI fundamentally is non-deterministic.
You can ask it the same question over and over and over or have it solve the same problem over and over and over, and you'll get something slightly different each time. That can be totally fine. If you're having it generate text or whatever, that can be totally fine. Um, but in a lot of systems, you need, uh, a, an input to always produce the same output, and that is deterministic.
And so here, I like to use AI to write code for me because code is fundamentally deterministic where this AI is not. So if we look over, if we look over at some code here... Let's close all of this, and let's go to, let's open this directory here. We have an HLS directory with some scripts in it. ChatGPT wrote all of these scripts, and if we look at this, you'll see these are the scripts that we use.
Steve runs this on his computer. These are the scripts we use to take these massive videos and turn them into something that is streamable. It's a bunch of lines, and you can see it's got a little output down here. It's a bunch of lines of a, a bunch of bash scripting and a bunch of FFmpeg, and this is written basically fully by ChatGPT.
So you can see we define some resolutions here, some bit rates, and some outputs. And, um, this is what takes our videos and makes them streamable. Now, Steve is only able to use ChatGPT to do this because he already has the domain knowledge, the domain expertise to produce that script. So maybe another principle is, um- Use your domain knowledge.
Um, maybe, maybe we'll say leverage your domain knowledge with AI. So it is possible that you could have gotten all the way to that script knowing literally nothing about video. I think it would have been very hard. Steve knows a ton about video, and so he's able to chat with ChatGPT to get to that very complex script that does all of the work.
So we'll keep those principles going, but that's the transcode section. Now, the publish section actually has a bunch of different parts, and so we're gonna make a new guy over here, and we're gonna say that this is publish, but in fact, this is breaking down publish. And the first step in publishing is push videos to R2.
So from Steve's script, from his FFIMPE- eg- FFIMPEG script that GPT wrote, we get a giant folder of output. We push all of that to Cloudflare R2. Then after that, we have, uh, after that, we have a script that checks R2.
We have a script that checks R2, and then if there are any new videos, then we have a script that transcribes the videos. And then we just keep going, and I'll show you the code for all of this. It's actually, it's actually pretty simple. Um, we-- what do we do after we transcribe the videos? Uh, we create VTT files, and that is just captions.
So all of the videos, um, that we produce have closed captions, and that is powered by a VTT file. After we create VTTs, we have more work we have to do. So after we create the VTTs, we create a markdown transcript, and the markdown transcript is what actually goes on the webpage, so you can see below the video a word-for-word transcript.
Then, you can see this is getting quite, uh, it's getting quite long already. Um, then after that, we, from the markdown transcript, we do a few different things. Um, we create a short d-- actually, we create a description. We create a description, and then, um, we create, I think maybe just one other thing.
We create a, uh, snippet, and these are both text generation. These are both text generation, uh, processes here that ChatGPT handles for us, but it handles it for us automatically. And I'm not gonna say that it's agentic because I don't know, one, I, I don't really know what that means.
I don't know if anyone really knows what that means. Um, but also, I have opinions on, uh, agentic stuff. So this is the process. We can go look at the code now. This is the process. We push the videos to R2. We have a script that checks R2, transcribes the videos, creates VTTs, creates a markdown transcript, creates a snippet, and creates a description, and all of that is done by a computer.
Now, I think another, uh, another principle or something that I care about here is I don't care if it's done by AI or some other, some other computer. Now, I think there's a temptation to, like, push all of this into some provider of workflows that orchestrates it all for you. You know what I use for the orchestration?
A cron job. That's it. I just use a simple cron job and the database, um, because I want to be in control, and I'll show you why here in a second. But we break it down into discrete tasks as much as possible because that's going to have the highest chance of success. And maybe that's another, maybe that's a good principle too. Uh, we wanna break down the entire system into small, discrete steps.
I don't want to be chaining this long-running thing that has to be carefully handed off from step to step. I want them to be small, repeatable, debuggable, inspectable. Um, so break down the system into small, discrete steps. Each one of these things right here, each one of these things is a command that is run by, um, my software in the background, which is a Laravel application.
So looking at this Laravel application, I am in the console.php, which defines basically my cron jobs. So here you'll see every minute we transcribe videos, we do markdown, we do snippets, we do captions every 10 minutes, we do summaries every 10 minutes, and we set vanity numbers, which is irrelevant.
Then, um, every 30 minutes, we check Cloudflare to see if there are any new videos that have been uploaded by Steve. We do that every 30 minutes because it doesn't happen that often, and we can wait, we can wait up to 30 minutes. That's totally fine. Now, you'll notice these all, they can all just overlap. Like, I don't have anything that says, I don't have anything here that says, um, "Do it in this order." That's because each step is discrete and can operate
on its own. We start, what do we start with? Um, we start with the script that checks R2, which is not terribly interesting, but I'll show it to you anyway, Cloudflare sync. There's my R2 videos disk, and then I just loop through every directory on R2, looking for two specific files that need to be there.
Those must exist. Uh, so I look through those, and then I write it to the database. So anytime I see a new video on Cloudflare, I write that into the database as a model. And this, um, this is because I want to be the source of truth. I want to, um, orchestrate a bunch of different third parties, but fundamentally, I am responsible for all of that data.
So I bring it all home into the database, and then I become the source of truth. Uh, that is a good principle. I want to, um, I want to own the source of truth. And now my database becomes the source of truth, one, because I am in control of it.
Two, it becomes very easy to query. It's, it's just in the database at that point. So coming back here, we'll go back to the console. Now, once we have the videos, we can go to the transcribe. I think that is the next one. Checks R2 transcribes the videos. So Steve did the first part on his computer. We already covered the second part, and now we're gonna cover this third part here, transcribing the videos.
Okay, so here's how we do this. Because I am in control, because I am the source of truth at this point, we can just query the database. This is the best part. I'm not, like, again, orchestrating a long-running process. I'm just asking the database, "Hey, give me all of the videos, um, with an ID greater than two ninety-nine," 'cause we switched providers.
That doesn't matter. Give me all of the videos. I'm just gonna drop that. Give me all the videos where the transcript field is null, but it does have a Cloudflare video. So I need to know, um, all of the videos in my database that don't have transcripts but do have an underlying video file, and we haven't requested the transcript in the past four hours.
So let's say that something goes wrong. I don't wanna be hammering the provider over and over and over, um, with the same failing video. I'll retry it every four hours, but I don't wanna be doing it every minute, right? So we say, "Give me the ones that haven't been, uh, attempted in the last four hours. Put them in random order." This may seem pointless, but imagine that we do have a video that fails.
I actually don't want it to fail. Like, I don't want, um, I don't wanna get three videos that fail and have those fail every, you know, four hours or whatever. I kinda wanna just shuffle them up, so if there's one that fails, I'm not gonna be holding up all of the others. So give me them in random order. Give me three of them. And then we hop down here, and we say, "All right.
I'm about to request this transcript, so let me add an event to this record." This is just writing a, a model and-- or it's just writing a new row in the database. And then we come down here. We grab, uh, the audio file, the MP3 audio file, and then we just send a create transcript request off to Eleven Labs.
This video is not sponsored, but Eleven Labs is great. We use Eleven Labs for all of our transcription, um, create realistic speech. In fact, we're doing the opposite. We're creating text from speech. It's very good at that. So we send it off, and then again, look, look. This is what we're doing. We're writing it to the database. That's it. We're not handing it off to the next, uh, the next step in the workflow.
All we're doing is we're saying, "Here's the transcript. Put it in the database. My job here is done." I don't know what else is going on out in the rest of the world. I don't care. My job is done. I wrote the transcript to the database. I'm the source of truth. This is a discrete action. Y'all have fun. Good luck.
Um, the actual transcript request is very simple. It just mirrors what their API expects, which is, um, you upload the file. And you can pick your model, you can pick your language, but you just upload the file. So that is the transcribe videos. So coming back to, coming back to console, you'll see transcribe videos we have just done.
So we've done that one, and we can close you. So now all of these are done right here, and we are sticking to this principle of small, discrete steps, right? 'Cause I'm just saying, "I did my job. Good luck. Do the rest." And then I am the source of truth, meaning it's all in my database. Coming down here, we need to create VTT files.
So this is another case of using a non-deterministic system to produce a deterministic piece of code, because a VTT file is a-- it's kind of a wonky format. It, it is a formatted, um, it's a formatted file that is the standard for closed captioning. And what I get back from Eleven Labs is JSON, which is, which is fine.
That's actually more useful to me. But to create, uh, captions that work with our video player, I need to create a VTT file. I don't want to send the JSON off to some provider and say, "Can you make a VTT out of this?" Because it's a rigid format going to a rigid format. That's what code is for.
So let's go to VTT. Um, that one's right here. So every ten minutes, we create captions. Let's click into that, and you'll see convert Eleven Labs JSON transcripts into VTTs. I'm, I'm pretty good at writing these descriptions. I'm the only one that ever sees them, but, you know, I'm pretty proud of those. So again, we're going back to the source of truth, which we own, and we're saying, "Hey, let's start a new query." And we wanna see, um, videos that don't have captions yet.
So give me all the videos that don't have captions, but they do have transcripts, so where not null transcript. And in fact, because the JSON formats are a little bit different, we only want transcripts where the provider is Eleven Labs. Give me all of those. And you know what? I'm gonna get all of them. Instead of limiting down to two or three, I'm gonna get all of them, 'cause we're not calling any external provider here.
So we can just burn through all of them. That's not gonna cost me any money. I'm not gonna hit any rate limits. It's gonna be just fine. Now- Coming down here, we're gonna loop over the videos, and we're gonna generate a VTT. And this is just a local, this is just a local method. And I wrote zero lines of this code right here.
This, again, is where I'm saying, "Let's use a non-deterministic system to write deterministic code," and this was all written, uh, by ChatGPT, and I said, "Here's the input, here's the output. Write me a, uh, write me a function that will handle that for me." And it did. So it takes the JSON format, it turns it into a web VTT.
You can see we've gotta format the time correctly, we gotta add these weird little arrows. You gotta do a bunch of stuff, but again, not my problem. Not my problem. The computer should do that, and the computer does do that. So coming back here, create VTTs. We are good there. Uh, we can turn that guy down. Now, create a markdown transcript.
This one we actually are gonna phone out to OpenAI to handle. So let's hop back over here. We'll come here. So we already did that one. We need a markdown transcript. Generate markdown from transcripts using OpenAI. Cool. Same idea. Where it has captions...
So in the previous one, we just created captions, so now we're checking, hey, any videos have captions out there, specifically English captions? Because in the future we might do other languages. Anybody have captions but you don't yet have a markdown transcript? So now what we're doing is we're basically creating a third format. We're creating a third format of the word for word transcript.
We've got the JSON, we've got the VTT, and now we're creating the markdown. And this is what's gonna show on, um, this is what's gonna show underneath the videos on the webpage. And here, again, we're gonna say, "Hey, uh, let's, let's just only do this every four hours." Code comments, huh? They're never quite right. We haven't attempted this in four hours.
So again, we're just having a little bit of a fail-safe here. We're gonna do it in random order again and just get five of them. And then once we're down here in the loop, we're gonna say, "I've attempted markdown. Who knows if it's succeeded, but just in case, I've attempted it." Now, here is our first prompt. Here's our first prompt built into the system.
I'll provide you with VTT from a video. I'd like you to provide me a well-formatted markdown transcript. Do not change the content, but please add headers, headers and line breaks where appropriate. Here is the VTT. And then I use these little fake XML tags to offset it, VTT, and then I pull off of the video the English captions and the VTT, um, like, the actual captions.
And then at the end, I repeat the instructions, 'cause now we've got a long set of context, you know. And I say, "Please provide me a well-formatted markdown transcript." And then I'm just using OpenAI's, uh, library here, and I'm saying, "You're helpful when I ask you to write something fifth grade. I'll tip you $200." Who knows if that works, but I've seen it on the internet. Please only respond with an answer to the question, user prompt.
And we come down here, make sure that it passed. And again, we just write it, we just write it into the database. Who knows what we're gonna do with it later? Not my problem. We'll figure it out. And then we sleep for 15 seconds just for giggles. I could put in proper rate limiting, uh, I could handle all that, but this, this works, and it took me literally .2 seconds to write, so I'm not gonna worry about it.
Okay, we've created the markdown transcript. You'll see the pattern here is, um, try to create every step as a discrete step that can be retried. You can have observability into. Um, you can, uh, you can reason about it independently, which I think is very important. And I think this is a kind of, like, eventually consistent, uh, workflow, basically.
And the nice thing is, I can come in here and just, like, add a new thing right in the middle between any of these steps, and I don't really have to change anything. And you'll see down here that these two can run in parallel because they both rely on create a markdown transcript, and once that transcript is there, well, we can just run these in parallel. In fact, let's take a look at create a description.
You'll find that these are now very similar. So we've already done, we've done markdown, and what do you wanna do next? What did we say? Create a description. I think that's a summary. So we're gonna go to summarize. Create, generate summaries from transcripts using OpenAI. Exact same thing. Where null summary, where not null, markdown transcript.
So now what we're gonna do is we're gonna take the markdown transcript, send that off to OpenAI and say, "Hey, can you give me a summary?" Why we're doing markdown transcript instead of VTT? Dealer's choice. I don't really care. Same deal down here, provide you a transcript. Three sentence summary of the transcript optimized for SEO and not in first person.
Should focus on what the course taker will learn. Do not use, "Learn how to," or, "This video covers." I just, I don't like that. Here's the transcript, transcript, markdown transcript, three sentence summary, same deal. We write it to the database. In fact, I think the other one is identical, so we just did that one, and then the snippet is same deal.
It has no snippet. It does have a transcript. It hasn't been attempted. Uh, no longer than 10 words. So this one is even shorter. Give me 10 words. Should focus on the same thing, and then we write it to the database as a snippet We have run many hundreds of videos through this process just in the past year, and we couldn't have published everything that we've published so far if we did not have the computers working for us.
So this is, this is an instance of maybe not necessarily, uh, AI taking someone's job, but this is an instance of we didn't have to hire a freelancer to do all of this work. Because instead of, instead of saying, "Hey, go find out how to create a transcript, then write a summary, then create a markdown file, then create a snippet," we just coded it one time and now it runs forever.
So now we've got, I don't know how many videos we've published, maybe three or four hundred videos that have everything that we need, and it took us no time at all and maybe cost us a few dollars, which is kind of crazy. Um, the other thing is whenever we add a new requirement, like we just added the requirement for the, the ten-word snippet, we just added that requirement this week.
Now we can just go back and populate all of those because this system is set up not to run as one workflow, but to kinda run as a guess and check. Every few minutes, something wakes up, checks the source of truth, and says, "Hey, does anything need to be done? No? Great. I'll go back to sleep. See you in a few minutes." But in this case, it woke up and said, "Oh, we got four hundred videos we gotta make snippets for.
No problem. I'll get to work." That actually reminds me of a few other principles. Let's finish out with these last few principles here. Um, one of the last principles is expect AI to get it, meh, ninety-five percent right. This one, um, the, the way that we handle this one is we take all of, like, the description and the snippet and the markdown transcript, and we write it to the database, and then we never let AI touch that again.
So after it's been written to the database, we can go in and look at it. We can go review every video and say, "Yeah, that looks fine," or, "Actually, I'm gonna change that word." And we have an admin interface where you can go in and just change the words. So I'm not expecting it to get it a hundred percent right. I just need it to get ninety-five percent of the way there, which means on some videos it'll be a hundred, and on some videos it'll be ninety, and we can go in and tune up the ones that it kinda messed up.
My final principle, I think, right now is, um, it doesn't have to be AI. It can just be programming. So this is, I mean, this is kind of important to me. I think right now, um, people want to use AI for everything, and that's great. It's new. It's incredibly useful.
But do remember that sometimes it can just be a cron job. It can just be a cron job. You don't have to figure out, um, who's the best agentic workflow provider. You can just write fifteen different commands that query your database and then run on a cron job. Doesn't have to be AI. It can just be programming. These are the principles. These are the exact principles that we've encoded into our system that have allowed us to scale from a, a cold start.
We started with zero dollars of revenue all the way up to almost a million dollars in the first year. And like I said, our goal is at least two and a half million with two and a half people, and we're well on our way. So hopefully, these principles will help you think about your business and how you can scale your business without scaling your headcount.
Let me know what you think. I would love to hear your thoughts. Until the next time, see ya.