Prerequisites
Before installing MyDiary, ensure you have the following installed on your system:PHP 8.2 or higher
Required for Laravel 12 framework
Composer
PHP dependency manager for Laravel packages
Node.js 18+
JavaScript runtime for React and Vite
MySQL 5.7+
Relational database for data storage
Additional requirements
- npm or yarn - Package manager for JavaScript dependencies
- Git - Version control to clone the repository
- Web server - Apache or Nginx for production deployment
Installation
Follow these steps to set up MyDiary on your local machine.Install PHP dependencies
Use Composer to install all Laravel and PHP packages:This installs key dependencies including:
- Laravel Framework 12
- Inertia.js Laravel adapter
- Ziggy for route generation
- Laravel Tinker for debugging
Install JavaScript dependencies
Install React, Vite, and frontend packages:Key packages installed:
- React 19 and React DOM
- Inertia.js React adapter
- Tailwind CSS 4.0
- Vite 6 and Laravel Vite plugin
- HugeIcons for UI icons
Configure environment variables
Copy the example environment file and configure it:Update the
.env file with your configuration:MyDiary uses database-based sessions, cache, and queues by default. Ensure your database is properly configured.
Generate application key
Generate a unique encryption key for your application:This creates a secure
APP_KEY in your .env file used for encrypting session data and other sensitive information.Create the database
Create a MySQL database for MyDiary:Or use your database management tool (phpMyAdmin, TablePlus, etc.).
Run database migrations
Execute migrations to create all required tables:This creates the following tables:
users- User accounts and authenticationentries- Diary entries with body, visibility, and creatorfriend_requests- Friend connections with status trackingentry_users- Pivot table for shared entriesimage_entries- Image attachments for entriesimage_users- Profile images for userslikes- User engagement on entriessessions- Session storagecache- Cache storagejobs- Queue jobs
Create storage symlink
Link the public storage directory for file uploads:This creates a symbolic link from
public/storage to storage/app/public, allowing uploaded images to be publicly accessible.Build frontend assets
Compile React and CSS assets:For development,
npm run dev starts Vite’s development server with hot module replacement (HMR).Quick start script
MyDiary includes a convenient development script that starts all services simultaneously:- PHP development server (
php artisan serve) - Queue listener for background jobs
- Laravel Pail for real-time logs
- Vite development server (
npm run dev)
Database schema overview
Understanding the database structure helps you work with MyDiary effectively.Entries table
Friend requests table
Relationships
MyDiary uses Eloquent relationships for clean database queries:Seeding test data (optional)
Populate your database with test data for development:EntrySeeder and DatabaseSeeder to create sample users and diary entries.
Production deployment
When deploying to production, follow these additional steps:Configure web server
Point your web server’s document root to the
public directory.Example Nginx configuration:Troubleshooting
Common issues and solutions
Class not found errors
Class not found errors
Run
composer dump-autoload to regenerate the autoload files.SQLSTATE[HY000] [2002] Connection refused
SQLSTATE[HY000] [2002] Connection refused
Check your database credentials in
.env and ensure MySQL is running.Vite manifest not found
Vite manifest not found
Ensure you’ve run
npm run dev or npm run build to generate frontend assets.419 Page Expired (CSRF token mismatch)
419 Page Expired (CSRF token mismatch)
Clear your browser cache and application cache:
Image uploads not working
Image uploads not working
Verify the storage symlink exists:Check that
storage/app/public directory has write permissions.Next steps
Your MyDiary installation is complete! Here’s what to do next:- Create your first user account at
/SingIn - Explore the codebase in
/appand/resources/js - Review the API reference for backend endpoints
- Read the development guide for contribution guidelines