/benjamincrozat.com

Source code for Benjamin Crozat's blog built using the TALL stack and getting more than 30K monthly visitors.

Primary LanguagePHP

Laravel Forge Site Deployment Status

The logo of the blog of Benjamin Crozat.

This is the source code of my blog, benjamincrozat.com. This blog was built with the TALL stack and gets more than 30K visitors per month.

My Pirsch Analytics Dashboard. My Pirsch Analytics dashboard that is publicly accessible.

 

My Google Search Console. My Google Search Console. You can see the growth since I launched in September 2022.

 

I feel obligated to mention that my relative success is not correlated to my tech stack. I just want to own my piece of real estate online and do whatever I want with it. If you also want to create your blog, I don't recommend to copy and paste anything I did. While the code works for my specific needs, it might not be the ideal solution for everyone. But if you're curious, there you go, enjoy!

Before you proceed

  • I don't need pull requests. This is a project I'm working on alone, and I only have time for the bad code I write myself. 😅
  • This isn't an opportunity for mentoring. Please try to resolve your issues on your own. If you tried your hardest, then you can open a new discussion! Also, feedback is welcome (but useful feedback, not something like "whAt aBoUt SrP DudE?"
  • This isn't a reference for SEO. If you want to rank on Google, write content people search for and BE PATIENT. I actually wrote about my journey on the blog.

What you will learn

This is a small project. It certainly won't teach you how to maintain apps at huge scales. That being said, you can learn about:

  • Simplicity. Most developers underestimate its benefits.
  • Using the GPT API from OpenAI to create features that were unthinkable not so long ago.
  • Creating admin pages based on Laravel Nova. (I'm working on Filament's integration in the feature/filament branch.)
  • Testing. A crucial part of ensuring everything stays stable. Because I can be forgetful, distracted and overconfident sometimes. These are flaws of human beings that can easily be mitigated by machines.
  • How to use various frontend technologies such as Livewire v3 + Volt, Alpine.js, and Tailwind CSS.
  • But you will also learn what you should avoid. This codebase is far from what I consider perfect.

Requirements

This project requires Laravel Nova, which is a paid package. For now, I don't know how to make it optional, but meanwhile, you can switch to the feature/filament branch.

  • PHP 8.2+
  • MySQL 8+

Installation

The instructions below have been written assuming that you are using Laravel Valet. But you can run the project in whichever environment you want (Herd, Docker with Laravel Sail, Laragon, etc.).

Clone the repository and cd into it:

git clone git@github.com:benjamincrozat/benjamincrozat.com.git

cd benjamincrozat.com

Create a .env file and generate the app key:

cp .env.example .env

php artisan key:generate

Install the dependencies (if you don't have a Laravel Nova license, switch to the feature/filament branch):

composer install

Create the database:

mysql -u root -e "CREATE DATABASE benjamincrozat"

Migrate the database with some fake data:

php artisan migrate --seed

Install the frontend dependencies and build the assets:

yarn && yarn build

Testing

To run the tests, execute the following command:

php artisan test

Deployment

Once the tests are green in the CI environment, a webhook from Laravel Forge is called, which triggers the deployment.

Some details about the production environment:

  • I host the blog on a $6 DigitalOcean VPS.
  • I could have stopped here, but I'm also using a managed MySQL database for frequent automatic backups and not having to deal with anything related to the configuration.
  • I use Sentry to monitor errors in the production environment only.