This project synchronizes Star Wars planets and their related entities from the public API
https://swapi.dev into a local MySQL database using Laravel 12,
and displays the data through a Vue 3 frontend powered by Vite.
- π Sync planets, films, residents and related entities from SWAPI
- π MySQL relational database structure
- βοΈ Artisan command for scheduled/manual synchronization
- π Laravel Horizon for queue monitoring
- π§΅ Supervisor support for production queues
- β‘ Vue 3 frontend with Vite bundler
- π Paginated planet listing UI
app/
βββ Console/Commands/ # swapi:sync command
βββ Models/ # Planet, Film, Person models
βββ Services/Swapi/ # Synchronization service
database/
βββ migrations/ # DB schema
βββ seeders/
resources/
βββ js/
β βββ app.js # Vite entry
β βββ bootstrap.js
β βββ vue/
β βββ App.vue
β βββ components/
β βββ PlanetList.vue
βββ views/
βββ app.blade.php # Vue mounting point
routes/
βββ web.php
vite.config.js
- PHP 8.2+
- Laravel 12
- MySQL 8+
- Composer
- Redis (for queues)
- Ubuntu package:
sudo apt install php-curl
- Node.js 18+
- NPM or Yarn
git clone https://github.com/elivol-git/star-wars-data-explorer.git
cd star-wars-data-explorercomposer installcp .env.example .env
php artisan key:generateEdit .env:
DB_DATABASE=planets
DB_USERNAME=planets_user
DB_PASSWORD=your_strong_password
QUEUE_CONNECTION=redisCREATE DATABASE planets CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'planets_user'@'localhost'
IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON planets.*
TO 'planets_user'@'localhost';
FLUSH PRIVILEGES;php artisan migratephp artisan swapi:syncThis command can also be scheduled via Laravel Scheduler.
npm installor
yarn installnpm run devVite will start at:
http://localhost:5173
Laravel will load assets automatically via Vite.
npm run buildCompiled files will be placed in:
public/build
vite.config.js:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: ['resources/js/app.js'],
refresh: true,
}),
vue(),
],
});composer require laravel/horizon
php artisan horizon:install
php artisan migratehttp://your-domain.test/horizon
[program:horizon]
process_name=%(program_name)s
command=php /var/www/planets/artisan horizon
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/www/planets/storage/logs/horizon.log
stopwaitsecs=3600sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start horizonphp artisan serveOpen:
http://127.0.0.1:8000
| Action | Command |
|---|---|
| Migrate DB | php artisan migrate |
| Sync SWAPI | php artisan swapi:sync |
| Clear cache | php artisan optimize:clear |
| Horizon | php artisan horizon |
| Queue worker | php artisan queue:work |
sudo chown -R $USER:www-data storage bootstrap/cache
sudo chmod -R 775 storage bootstrap/cachesudo chmod -R 775 storage/logssudo apt install redis-server
sudo systemctl enable redis
sudo systemctl start redisOpen-source.
Free to use, modify, and distribute.
β¨ May the Force be with your code.