The Next-Generation AI-Powered Content Management & Blogging Platform
Elevate your content creation with an intelligent platform that generates SEO-optimized articles, manages your publications, and fosters reader engagement automatically using the power of Google Gemini AI.
Write AI is a highly scalable, robust content management system (CMS) and blogging platform designed for modern creators, authors, and publishers.
Creating high-quality, SEO-optimized blog posts from scratch is time-consuming and often causes writer's block. Write AI solves this by integrating Artificial Intelligence deeply into the drafting process. By simply providing a topic prompt, the platform's AI controller acts as an expert SEO specialist, generating a complete, richly-formatted articleโincluding a catchy title, meta excerpt, HTML content, and relevant tagsโin seconds. The platform also offers robust social engagement features, allowing readers to interact with authors through comments, favorites, bookmarks, and a comprehensive follow system.
- AI Content Generator: Utilizes Google Gemini 2.5 Flash to automatically draft complete blog posts based on a user-provided prompt.
- SEO Optimization: AI automatically generates meta excerpts, tags, and SEO-friendly titles alongside the content.
- Structured JSON Responses: Strict prompt engineering ensures the AI returns clean JSON that perfectly maps to the database structure.
- Advanced Authentication: Built using Laravel Fortify with support for standard login, Two-Factor Authentication (2FA), and modern Passkeys.
- Roles & Permissions: Secure Role-Based Access Control (RBAC). Differentiates between standard users, authors, and administrators.
- Profile Management: Custom user profiles with tracking of account status (Active, Inactive, Suspended) and last activity.
- Rich Post Creation: Create articles with cover images, categories, and tags.
- Post Workflows: Manage articles through multiple states (Draft, Published, Archived).
- Soft Deletes: Accidentally deleted an article? Safely recover it from the trash or permanently force delete it from the dashboard.
- View Tracking: Asynchronous event-driven view counters to track article popularity.
- Follow System: Users can follow and unfollow their favorite authors to curate their reading experience.
- Favorites (Likes): Readers can "like" their favorite articles.
- Bookmarks: Readers can save specific articles to their private reading list.
- Nested Comments: Interactive comment sections on every published post.
- Real-Time Alerts: Database-driven notifications for interactions (when someone comments on your post, favorites it, or follows you).
- Notification Dashboard: Mark individual alerts as read/unread or clear all notifications at once.
- Queue-based Mailing: Background processing of automated emails (e.g.,
SendNewPostsSummary). - Async Notifications: System notifications are dispatched asynchronously via queues to ensure blazing-fast UI response times (
SendNotificationjob).
- Route Authorization: Comprehensive use of Laravel Gates and Policies (
UserPolicy,PostPolicy) to ensure users only modify their own data. - Sanctum API Protection: Built-in support for secure API token generation using Laravel Sanctum (
personal_access_tokens). - CSRF & XSS Protection: Full cross-site request forgery and cross-site scripting prevention.
| Technology | Purpose / Role |
|---|---|
| PHP 8.3 | Core backend language utilizing the latest features and types. |
| Laravel 13.x | The MVC framework handling routing, ORM, requests, and security. |
| MySQL | Relational database management system. |
| Tailwind CSS v4 | Utility-first frontend styling framework. |
| Vite | Lightning-fast frontend build tool and hot module replacement. |
| Vanilla JavaScript | DOM manipulation and client-side API requests. |
| Google Gemini API | Autonomous AI content generation (gemini-2.5-flash). |
| Laravel Fortify | Headless backend authentication logic. |
| Laravel Sanctum | API authentication and token management. |
| Composer / NPM | Package managers for backend and frontend dependencies. |
The application is built on a strictly decoupled architecture, extending beyond standard MVC by utilizing Actions, Services, and Events to keep controllers exceptionally clean and maintainable.
- MVC Pattern: The core of the application utilizing Models, Views (Blade), and Controllers.
- Service Layer: Abstracted complex business logic (e.g.,
PostService) for creating and managing posts. - Actions Pattern: Single-responsibility classes handling specific tasks like
FileUploadfor handling cover images andSyncPostTagsfor managing many-to-many tag relationships. - Events & Listeners: A robust event-driven architecture. For example, viewing a post triggers a
PostViewedevent, which is handled asynchronously by anIncrementPostViewslistener. - Jobs: Background tasks like
SendNewPostsSummaryhandle heavy lifting off the main web thread. - Policies: Authorization logic is strictly isolated in classes like
PostPolicyandUserPolicy.
The relational database is highly normalized and relies heavily on Eloquent relationships (One-to-Many, Many-to-Many, and Polymorphic).
users: Core identity table (includes Two-Factor Auth, Passkeys, and Activity tracking).posts: The primary content table (includes metadata, soft deletes, and status tracking).categories&tags: Taxonomy tables for organizing posts.comments: Relates to both Users (authors) and Posts.roles: RBAC entity.
post_tag: Many-to-Many relationship between posts and tags.favorites: Many-to-Many mapping for users "liking" posts.bookmarks: Many-to-Many mapping for users saving posts.followers: Self-referential Many-to-Many mapping linking users to other users.role_user: Maps users to specific administrative roles.
โโโ app/
โ โโโ Actions/ # Single-responsibility logic (FileUpload, SyncPostTags)
โ โโโ Events/ # Application events (PostViewed)
โ โโโ Http/Controllers/ # Request handlers (AiController, PostController)
โ โโโ Http/Requests/ # Form validation and sanitation rules
โ โโโ Jobs/ # Queued background tasks (SendNewPostsSummary)
โ โโโ Listeners/ # Event handlers (IncrementPostViews)
โ โโโ Models/ # Eloquent ORM Models and Scopes
โ โโโ Notifications/ # Database notification classes (FollowNotification)
โ โโโ Policies/ # Authorization logic (PostPolicy)
โ โโโ Services/ # Business logic abstraction (PostService)
โโโ database/
โ โโโ migrations/ # Database schema definitions
โโโ resources/
โ โโโ css/ # Tailwind CSS configurations
โ โโโ js/ # Client-side JavaScript
โ โโโ views/ # Blade templating files (Dashboard, Auth)
โโโ routes/ # Web, API, and Console route definitions
โโโ tests/ # PHPUnit Feature and Unit tests
Write AI integrates seamlessly with Google's Gemini models:
- User Prompt: A user submits a topic via the Dashboard (
AiController). - System Injection: The backend formulates a strict system prompt requiring the AI to act as an SEO specialist and format the output exclusively as a specific JSON schema.
- Execution: The request is sent asynchronously to the Gemini API (
gemini-2.5-flash). - Parsing: The Controller catches the response, strips markdown wrappers, decodes the JSON, and safely populates the post creation form dynamically on the frontend.
git clone https://github.com/yourusername/write-ai.git
cd write-aicomposer install
npm installcp .env.example .env
php artisan key:generateCreate a new MySQL database for the project. Open your .env file and configure the connection:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=root
DB_PASSWORD=your_passwordphp artisan migrate
# Or to include seeders: php artisan migrate --seedphp artisan storage:linkCompile the frontend assets and start the server concurrently:
# This command runs Laravel Serve, Vite, and the Queue Worker simultaneously
composer dev Visit http://localhost:8000 in your browser.
The following variables in the .env file are crucial for the application to function:
APP_NAME="Write AI"
APP_URL=http://localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
# Gemini AI Configuration
GEMINI_API_KEY=your_gemini_api_key
GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta
GEMINI_MODEL=gemini-2.5-flash
# Queue & Cache
QUEUE_CONNECTION=database
CACHE_STORE=database- Eager Loading: Used extensively in controllers (e.g.,
Post::with('category', 'user')) to eradicate the N+1 query problem. - Asynchronous Queues: Email dispatching and notification generation are pushed to the database queue rather than holding up the HTTP response.
- Event-Driven Counters: Page views are handled via the
PostViewedevent rather than synchronous database writes during page loads.
(Add paths to your local images here)
The application is thoroughly tested using PHPUnit. To run the test suite:
# Clear caches and run tests
composer test
# Or using artisan
php artisan testFor production deployment, run the following commands:
composer install --optimize-autoloader --no-dev
php artisan config:cache
php artisan route:cache
php artisan view:cache
npm run build
# Ensure the queue worker is running via Supervisor or similar
php artisan queue:workphp artisan migrate # Run database migrations
php artisan migrate:fresh --seed # Reset database and seed fake data
php artisan storage:link # Link public storage directory
php artisan queue:listen # Start processing background jobs
php artisan optimize:clear # Clear all application caches
php artisan route:list # View all registered endpoints- Implementation of Redis for faster caching and queue management.
- OAuth Social Login integrations (Google, GitHub) via Laravel Socialite.
- Detailed reporting and analytics dashboard for authors.
- Enhanced AI features including automated image generation for post covers.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- 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
Distributed under the MIT License. See LICENSE for more information.
- Framework: Laravel
- Frontend UI: TailwindCSS
- AI Engine: Google Gemini
- Authentication: Laravel Fortify


