MyBlog is a highly optimized, full-stack blogging application designed for speed, security, and developer experience. It features a rich-text editor for content creation, a custom Role-Based Access Control (RBAC) system for administrators, and is fully tailored to be deployed on Vercel as a serverless application.
- Authentication System: Full login, registration, email verification, and password reset flows (Laravel Breeze).
- Role-Based Access Control (RBAC): Custom middleware protecting admin and author routes.
- Post Management (CRUD): Create, read, update, and delete blog posts.
- Rich Text Editor: Seamless writing experience built with Tiptap & Highlight.js for code block formatting.
- Image Uploads: Cloud storage integration via Cloudinary PHP.
- Serverless Optimized: Configured specifically to run flawlessly on Vercel's serverless PHP runtime (
vercel-php). - Modern UI/UX: Fully responsive and animated interfaces built with vanilla Tailwind CSS.
- Backend: Laravel
^13.8(PHP^8.3.0) - Frontend: Blade Templates, Alpine.js
^3.4.2, Tailwind CSS^3.1.0 - Editor Content: Tiptap
^3.29.2, Highlight.js^11.11.1 - Security: Mews HTML Purifier
^3.4 - Media Storage: Cloudinary PHP
^3.1 - Database: MySQL (Aiven Cloud / PlanetScale ready)
- Deployment: Vercel (Serverless Functions)
- Email Service: SMTP (Gmail / Resend compatible)
Follow these steps to set up the project on your local machine.
- PHP 8.3+
- Composer
- Node.js (v20+) & NPM
- MySQL or SQLite
-
Clone the repository
git clone https://github.com/VYDev37/MyBlog.git cd MyBlog -
Install PHP & Node dependencies
composer install npm install
-
Environment Setup
cp .env.example .env php artisan key:generate
Configure your
DB_CONNECTIONin.env. For local testing, you can usesqlite. -
Run Migrations & Seeders
php artisan migrate --seed
-
Start the Development Servers You need two terminal windows:
# Terminal 1: Vite for compiling Tailwind CSS npm run dev # Terminal 2: Laravel local server php artisan serve
Visit
http://localhost:8000in your browser.
This repository has been heavily customized to run on Vercel's Serverless environment.
- Import this repository to Vercel.
- Set Framework Preset to
Other. - Set Build Command to
npm run build. - Set Install Command to
npm install.
Add the following crucial variables to your Vercel Dashboard:
APP_ENV=production
APP_DEBUG=false
APP_URL=https://your-vercel-domain.vercel.app
APP_KEY=base64:your_app_key_here
# Force Laravel to use /tmp (Vercel is Read-Only)
VIEW_COMPILED_PATH=/tmp
SESSION_DRIVER=cookie
LOG_CHANNEL=stderr
QUEUE_CONNECTION=sync
# Database (e.g. Aiven Cloud)
DB_CONNECTION=mysql
DB_HOST=your-cloud-database-host
DB_PORT=your-port
DB_DATABASE=your-db-name
DB_USERNAME=your-username
DB_PASSWORD=your-passwordSince Vercel has no terminal, you must run migrations against your production database from your local machine:
# Set your local .env to your cloud DB credentials, then run:
php artisan migrate --forceBuilt with ❤️ for a modern web experience.