DEV Community

A0mineTV
A0mineTV

Posted on

Building a Laravel Blog with ChatGPT Codex

Introduction

Recently I wanted to experiment with ChatGPT’s Codex mode, so I asked it to help me create a small blog application using Laravel. The result is the repository you are currently browsing.

This post walks through the main features of the app and how Codex assisted me during development.

Project setup

I started from a fresh Laravel 12 installation. The project uses Tailwind CSS via the Vite build tool and includes a few development tools such as Pest for testing and Pint for code style.

npm install 
Enter fullscreen mode Exit fullscreen mode

The PHP dependencies are defined in composer.json and can be installed with Composer:

composer install 
Enter fullscreen mode Exit fullscreen mode

Note: if you are running this project in a container without PHP or Composer, you will need to install them first.

Using GitHub

All the source code lives on GitHub. I created small feature branches whenever Codex generated new code. After reviewing the diffs I committed each step so the history clearly shows how the app evolved.

git clone https://github.com/VincentCapek/blog_codex.git cd blog_codex composer install npm install 
Enter fullscreen mode Exit fullscreen mode

To inspect the commit history locally run:

git log --oneline --graph 
Enter fullscreen mode Exit fullscreen mode

Generating the basic blog

With Codex, I generated models for Post, Category, Tag and User. The relationships allow posts to belong to categories and have multiple tags. A lightweight policy restricts guests from creating posts. Factory classes and seeders generate fake data for local testing.

The application exposes:

  • Web pages for listing, creating and editing posts.
  • A REST API available under /api/posts supporting filtering by category, tag and full-text search.

All views are built with Blade templates and styled with Tailwind classes.

How Codex helped

Throughout the process I relied on ChatGPT Codex to write and refactor code snippets. For example, it generated the controllers and resource classes, and even suggested how to store placeholder images when seeding posts:

$path = UploadedFile::fake()->image($this->faker->uuid.'.jpg')->store('posts', 'public'); 
Enter fullscreen mode Exit fullscreen mode

I still reviewed the output and adjusted it where necessary, but Codex accelerated the scaffolding considerably.

Testing the application

The repository includes a small test suite built with Pest. Running the tests ensures that storing posts works correctly and that the API filters posts as expected.

php artisan test 
Enter fullscreen mode Exit fullscreen mode

Conclusion

This project was a fun experiment in pairing Laravel with ChatGPT’s Codex. While the app itself is intentionally simple, it shows how an AI assistant can speed up routine tasks and let you focus on higher level design decisions.

Feel free to clone the repo and try it out yourself!

Top comments (0)