Module 1 - Introduction
1. Welcome to the course2. Why Go3. Why start and build a blog?4. What about React/Vue/Angular?5. Getting setup and source filesModule 2 - Tech Stack Walkthrough
1. Introduction to Golang Part 12. Introduction to Golang Part 23. Introduction to Golang Part 34. Structuring Golang Applications5. Templating with Templ6. Just enough interactivity with HTMX7. Getting started with postgres8. Servers, routers and endpointsModule 3 - Creating the MVP
1. What are the minimal requirements?2. Doing some initial plumbing3. Embedding static assets4. Creating our first views5. Tailwind & Utility-first CSS6. Styling the Landing Page7. Styling the Article PageModule 4 - Managing Content
1. Choose your own adventure2. Writing in Markdown3. Parsing Markdown to HTML4. Frontmatter and Meta Information5. Making our code examples look nice6. Adding error pagesModule 5 - Adding the Database
1. What is a Migration?2. Our first migration: articles table3. Creating the Database Layer4. Showing the Latest Posts5. Slugs and Human Readable URLsModule 6 - Managing the Blog
1. What are the minimum requirements?2. A new layout approaches3. Introduction to authentication4. Our second migration: Users Table5. Storing passwords securely6. Authenticating users Part One7. Authenticating users Part Two8. Remember me/Forget me9. Managing posts using a hypermedia API10. Our third migration: Altering Posts Table11. Only show posts marked readyModule 7 - Adding Subscribers
1. What are the minimum requirements?2. Our fourth migration: Subscribers Table3. Creating the subscription form4. Adding some interactivity with HTMX5. Saving new subscribers in the database6. Verifying subscriber emails7. Our fifth migration: Tokens Table8. Email validation view9. Email validation tokens10. Sending validation emails with SES11. Making it all come togetherManaging Content
Choose your own adventure
Summary
In this video, I explain two approaches for storing blog articles: embedding files in the binary or using S3-compatible storage with a CDN. I break down how each option works and their pros and cons. For the S3 approach, I show how it involves multiple steps like creating buckets, setting up CDNs, and automating file uploads. While this is more scalable, I explain why it's complex for a simple blog. I then demonstrate why I chose the embedded approach for this tutorial - it's simpler, with fewer moving parts, and better suited for a developer blog. This leads into our next steps of implementing the embedded storage solution.
Transcript
Welcome to module four. Before we start building the functionality to start showing real articles on the blog, I want to provide you with two paths forward. Essentially, we need to store our articles as files somewhere that we can then pull out, process and then serve them to our users. We already have one way of doing this because we have the way that we embed our static files into the binary of our application, but we could also opt for another approach, which would be to use something like S3 compatible storage, put it in front of a CDN and that will technically be more scalable, but it also adds some overhead in terms of steps required to fulfill this workflow and maintaining this whole setup, right? And if you're not familiar with what S3 compatible storage is, it's literally just file storage in the cloud and a CDN is short for content delivery network. And that will simply be that some provider has a lot of data centers or servers around the world, and then they will serve the files from whatever server or data center that is closest to the user. But for now, let's just quickly go over the pros and cons of these two options and why we are going to be using the embedded approach or embedding our article files directly into the binary of the application. So let's begin by looking at the external file storage option. And we just need the bucket and the CDN service, and you can get those from AWS or DigitalOcean, Cloudflare, there's lots of options out there. A very basic setup is that we create the bucket, we point the CDN to the bucket, upload all of our articles as files, and then we serve the content through the CDN, through our URL that we get provided through the CDN, right? However, in a more realistic scenario, you would have something like what you see here, that a user requests something through the browser, the app then needs to process that request as the CDN or caching layer, and if the CDN or caching layer has the file on hand, it will return it and reprocess and return it back to the browser. If not, it will pull out of the bucket and then go through the flow one more time. And while we could technically upload all of these files manually, we would probably like to automate a little bit more. So we would add article to the code base, push to GitHub repository and then trigger an upload action. If we didn't do like this, we will need to either manually add the files to the bucket and then update the app about this new file or path that is available. You could also create like an upload flow in the app dashboard, admin, whatever, right? But as you can see, this setup quickly becomes complex. There's a lot of moving parts that are additional running costs to these services, and if you're just going to be you as the only developer, the only writer, this starts to look like a little bit of an over-engineered option. But if you're going to go down having thousands of articles and many different offers, then maybe you want something like this, right? Because it will scale more and it will also be able to handle a ton more of a ton, a ton more, a ton, ton more amount of articles. Compare this to our option that we're going to be going with here is that we, we embed the articles in the binary and now it's literally just a browser calling the app, the app processes, the request, you know, pulls out the file from the binary process and form it, and then return it to the browser and our release flow here is again, we just, you know, we add the article to the code base. We push the code to GitHub repository, and then we release a new version. And if you want to remove the article, we will just remove it from the code base again, push and release. So, so for a one-man blog, for a developer blog, this is a much simpler version and it's going to be much more easy to maintain, fewer moving parts. So, so we are going to be doing this, this approach by embedding the articles into the binary, and then you can always use the external file storage option. If you want to try out a bit more complex setup.