A space-themed social platform where users write blog entries, build custom planets, follow other explorers, and chat in a global community space.
- User authentication with bcrypt password hashing
- Captain's Log blog system with image uploads and infinite scroll
- Interactive planet builder with live canvas rendering
- Galaxy gallery with likes and lazy-loaded infinite scroll
- Global chat with replies, mentions, custom emojis, and live updates
- Stories system with 24-hour expiry
- Follow system with private account support and requests
- Notifications with unread badge and favicon indicator
- User profiles with avatars, bios, and activity stats
- Online status and last seen tracking
- Responsive mobile-first design
- PNG and GIF export for planets
- PHP 8.2
- MySQL / MariaDB
- Vanilla JavaScript
- HTML5 Canvas API
- CSS3 with custom properties
- Font Awesome 6
- gif.js for GIF encoding
- XAMPP (or any LAMP/WAMP stack)
- PHP 8.0 or higher
- MySQL 5.7 or higher
- Node.js and npm (for local libraries)
- Clone the repository into your web server root:
git clone <repository-url> CosmicDiary
- Navigate to the project directory:
cd CosmicDiary
- Install Node dependencies:
npm install
- Create the database and import the schema:
mysql -u root -p cosmic_diary < database.sql
Tip
The database is exported as schema only. Register a new account to begin.
- Configure database credentials in
includes/config.php:
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'cosmic_diary');
define('BASE_URL', 'http://localhost/CosmicDiary/');- Ensure the following directories exist and are writable:
uploads/
uploads/avatars/
uploads/stories/
- Start your Apache and MySQL servers and visit:
http://localhost/CosmicDiary
CosmicDiary/
├── api/ Backend endpoints (JSON responses)
│ ├── auth/ Authentication handlers
│ ├── blog/ Blog CRUD operations
│ ├── chat/ Chat messaging and updates
│ ├── cron/ Activity simulation and maintenance
│ ├── planet/ Planet CRUD and likes
│ ├── stories/ Story creation and viewing
│ └── user/ User profiles, follows, notifications
├── assets/
│ ├── css/ Stylesheets
│ ├── fonts/ Local font files
│ ├── images/ Logos, icons, emojis
│ └── js/ Client-side scripts
├── includes/ Shared PHP (config, header, footer, functions)
├── pages/ User-facing pages
├── uploads/ User-generated content (excluded from git)
├── database.sql Full database schema
├── package.json Node dependencies
└── README.md
- Passwords are hashed using bcrypt via
password_hash() - All database queries use prepared statements
- Session-based authentication with cookie path scoping
- Input sanitization on all user-submitted data
- File uploads restricted to image types
This project is licensed under the MIT License. See the LICENSE file for details.