A modern, clean blog application built with Laravel 12, Livewire 3, and Torchlight for beautiful syntax highlighting. Inspired by PaperMod theme design.
- 📝 Markdown Support - Write posts in Markdown with full support for GitHub Flavored Markdown
- 🎨 Syntax Highlighting - Powered by Torchlight for beautiful code blocks
- 🔐 Authentication - User registration and login system
- 🛡️ Authorization - Users can only edit/delete their own posts
- ⚡ Livewire 3 - Interactive post creation with real-time validation
- 🎯 Clean Design - PaperMod-inspired minimalist design with dark mode support
- 📱 Responsive - Fully responsive design that works on all devices
- 🌙 Dark Mode Toggle - Manual dark/light mode switching with localStorage persistence
- ✨ Smooth Animations - Fade-in effects, hover animations, and smooth transitions
- 🔔 Toast Notifications - Beautiful toast notifications for success/error messages
- ⏳ Loading States - Loading spinners and disabled states during form submissions
- 📄 Enhanced Pagination - Beautiful, accessible pagination design
- ⚙️ Admin Settings - Site settings management for administrators (site name, descriptions, etc.)
- PHP 8.4.11
- Laravel 12.37.0
- Livewire 3.6.4
- Tailwind CSS 4.1.16
- Torchlight - Syntax highlighting API
- CommonMark - Markdown parser
- SQLite - Database (can be changed to MySQL/PostgreSQL)
- PHP >= 8.2
- Composer
- Node.js & NPM
- SQLite (or MySQL/PostgreSQL)
-
Clone the repository
git clone https://github.com/yourusername/laravel-blog.git cd laravel-blog -
Install PHP dependencies
composer install
-
Install Node dependencies
npm install
-
Environment setup
cp .env.example .env php artisan key:generate
-
Configure database
Update
.envwith your database configuration:DB_CONNECTION=sqlite # Or use MySQL/PostgreSQL # DB_CONNECTION=mysql # DB_HOST=127.0.0.1 # DB_PORT=3306 # DB_DATABASE=blog # DB_USERNAME=root # DB_PASSWORD=
-
Run migrations
php artisan migrate
-
Configure Torchlight (Optional but recommended)
Get your API token from Torchlight.dev and add it to
.env:TORCHLIGHT_TOKEN=your_token_here
-
Build assets
npm run build
-
Start the development server
php artisan serve
Or use the dev script:
composer run dev
-
Register/Login - Create an account or login
-
Create Post - Click "New Post" in the navigation
-
Write in Markdown - Use Markdown syntax for formatting
-
Add Code Blocks - Use triple backticks with language identifier:
```php <?php echo "Hello World!"; ```
-
Publish - Check "Publish immediately" to publish right away
- Headings (
#,##,###) - Bold and italic text
- Lists (ordered and unordered)
- Links and images
- Code blocks with syntax highlighting
- Blockquotes
- Tables
Torchlight supports all languages that VS Code supports. Simply specify the language in your code block:
php- PHP codejavascriptorjs- JavaScriptpython- Pythonhtml- HTMLcss- CSS- And many more...
- Dark Mode Toggle - Click the sun/moon icon in the header to switch between light and dark themes. Your preference is saved in localStorage.
- Smooth Animations - All pages feature fade-in animations and smooth transitions for a polished experience.
- Loading States - Forms show loading spinners and disable buttons during submission to prevent double submissions.
- Toast Notifications - Success and error messages appear as elegant toast notifications that auto-dismiss after 5 seconds.
- Enhanced Interactions - Hover effects, focus states, and smooth transitions throughout the interface.
- Responsive Pagination - Beautiful pagination controls that work seamlessly on all screen sizes.
GET /- Redirects to posts indexGET /posts- List all published postsGET /posts/create- Create new post (requires authentication)POST /posts- Store new post (requires authentication)GET /posts/{post}- Show single postGET /posts/{post}/edit- Edit post (requires authentication & ownership)PUT/PATCH /posts/{post}- Update post (requires authentication & ownership)DELETE /posts/{post}- Delete post (requires authentication & ownership)GET /login- Show login form (guest only)POST /login- Process login (guest only)GET /register- Show registration form (guest only)POST /register- Process registration (guest only)POST /logout- Logout (requires authentication)GET /settings- Show settings page (admin only)PUT /settings- Update site settings (admin only)
app/
├── Http/
│ ├── Controllers/
│ │ ├── AuthController.php # Authentication logic
│ │ ├── PostController.php # Post CRUD operations
│ │ └── SettingsController.php # Site settings management
│ └── Requests/
│ ├── LoginRequest.php
│ ├── RegisterRequest.php
│ ├── StorePostRequest.php
│ ├── UpdatePostRequest.php
│ └── UpdateSettingsRequest.php
├── Livewire/
│ └── Pages/
│ └── Post/
│ └── CreatePost.php # Livewire component for post creation
├── Models/
│ ├── Post.php # Post model with Markdown formatting
│ ├── Setting.php # Settings model with caching
│ └── User.php # User model with admin support
└── Policies/
├── PostPolicy.php # Authorization policies for posts
└── SettingPolicy.php # Authorization policies for settings
resources/
├── css/
│ └── app.css # Tailwind CSS with custom animations
├── js/
│ ├── app.js # Main JS entry point
│ ├── dark-mode.js # Dark mode toggle logic
│ └── toast.js # Toast notification system
└── views/
├── auth/
│ ├── login.blade.php
│ └── register.blade.php
├── components/
│ ├── layouts/
│ │ └── app.blade.php # Main layout with dark mode support
│ └── skeleton-post.blade.php # Skeleton loader component
├── livewire/
│ └── pages/
│ └── post/
│ └── create-post.blade.php
├── posts/
│ ├── index.blade.php
│ ├── show.blade.php
│ └── edit.blade.php
└── vendor/
└── pagination/
└── tailwind.blade.php # Custom pagination design
Torchlight is configured in config/torchlight.php. You can customize:
- Theme (default:
github-dark) - Line numbers
- Other highlighting options
See Torchlight Documentation for more options.
Authentication is handled by Laravel's built-in authentication system. Users can:
- Register new accounts
- Login with email/password
- Logout
- Remember me functionality
Dark mode is implemented using Tailwind CSS v4's @custom-variant feature:
- Toggle button in the header (sun/moon icon)
- Preference saved in browser localStorage
- Auto-detects system preference on first visit
- Smooth transitions between themes
- Works with all Tailwind dark mode utilities (
dark:*)
The dark mode configuration is in resources/css/app.css:
@custom-variant dark (&:where(.dark, .dark *));The application includes custom CSS animations:
- Fade-in - Pages fade in smoothly on load
- Staggered animations - Post items animate in sequence
- Hover effects - Interactive elements respond to hover
- Smooth transitions - All color changes are animated
Custom animations are defined in resources/css/app.css.
The application includes a settings management system for administrators:
- Site Name - Customize the site name displayed in header and page titles
- Site Description - Meta description for SEO
- Home Page Title - Main heading on the home page
- Home Page Description - Subtitle or description below the home page title
- Footer Text - Custom footer text
To access settings:
- Make a user an admin by setting
is_admin = truein the database - Login as an admin user
- Click "Settings" in the navigation menu
- Update settings and save
Settings are cached for performance and automatically cleared when updated.
Making a User Admin:
php artisan tinker$user = \App\Models\User::first();
$user->update(['is_admin' => true]);Settings are stored in the settings table and can be accessed via Setting::get('key') or through view variables shared globally.
Run tests with Pest:
php artisan testThis project uses Laravel Pint for code formatting:
vendor/bin/pintContributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open-sourced software licensed under the MIT license.
- Laravel - The PHP Framework
- Livewire - Full-stack framework
- Torchlight - Syntax highlighting
- Tailwind CSS - Utility-first CSS framework
- PaperMod - Design inspiration
If you have any questions or issues, please open an issue on GitHub.


