Lunar Livewire Starter Kit
repository·main·Indexed 42 days ago
https://github.com/lunarphp/livewire-starter-kitA reference implementation for building a classic e-commerce store using the Lunar Laravel E-Commerce package and Livewire. Includes a Docker-based deployment setup featuring MySQL, Caddy, Meilisearch, Redis, and Mailhog.
What's inside Lunar Livewire Starter Kit
- The starter kit is a reference implementation for the Lunar Laravel E-Commerce package. For full, detailed installation instructions for the core package, refer to the official Lunar documentation at https://docs.lunarphp.com/.
Access the Demo Store and Lunar Panel
mainOnce the Docker containers are running, the application is accessible at the following locations:
- Demo Store:
http://localhost - Lunar Admin Panel:
http://localhost/lunar
To access the Lunar admin panel, use the following default credentials:
- Username:
admin@lunarphp.io - Password:
password
- Demo Store:
Install the Lunar Livewire Starter Kit via Docker
mainTo run the starter kit using Docker, ensure Docker is installed on your local machine. You need to copy the example Docker environment file to
.envand then usedocker-composeto build and start the containers.Note that the initial build and container initialization time depends on your hardware and internet connection.
cp .env.docker.example .env docker-compose upService overview for Docker deployment
mainThe project uses a multi-container Docker setup. The following services are orchestrated via
docker-compose.yml:- mysql: The database engine (MySQL 8.0).
- caddy: The web server handling HTTP/HTTPS traffic (ports 80 and 443).
- php-fpm: The core application runtime, built from a specific target.
- meilisearch: The search engine service.
- meilisearch-ui: A web interface for managing Meilisearch.
- redis: Used for caching or session management.
- mailhog: A tool for testing email delivery (accessible via ports 1025 and 8025).
Note that
caddy,php-fpm, andmeilisearchhave dependencies onmysqland/ormeilisearchto ensure correct startup order.Register Service Providers and Class Aliases
mainThe application uses
providersandaliasesarrays to bootstrap functionality:- Service Providers: Add your custom or package service providers to the
providersarray to ensure they are automatically loaded on every request. The starter kit includes default providers merged withApp\Providers\AppServiceProvider,AuthServiceProvider,EventServiceProvider, andRouteServiceProvider. - Class Aliases: Register lazy-loaded class aliases in the
aliasesarray to provide short names for long-form class paths.
- Service Providers: Add your custom or package service providers to the
Configure Docker environment variables
mainThe
docker-compose.ymlfile uses several environment variables to configure the services. You must define these in your local.envfile to ensure the containers start with the correct credentials and connectivity settings.Database Configuration
DB_PASSWORD: Sets both theMYSQL_ROOT_PASSWORDand theMYSQL_PASSWORDfor the application user.DB_USERNAME: Sets theMYSQL_USER.DB_DATABASE: Sets the name of the database created on startup.
Admin User Configuration
These variables define the initial administrator account created in the
php-fpmservice:ADMIN_FIRSTNAMEADMIN_LASTNAMEADMIN_EMAILADMIN_PASSWORD
Search (Meilisearch) Configuration
MEILISEARCH_KEY: Sets theMEILI_MASTER_KEYfor securing the Meilisearch instance.MEILISEARCH_PORT: The port used to expose the Meilisearch service.MEILISEARCH_UI_PORT: The port used to expose the Meilisearch UI service.
Cache and Mail Configuration
REDIS_PORT: The port used to expose the Redis service.
# Example .env entries required by docker-compose.yml DB_PASSWORD=secret DB_USERNAME=lunar DB_DATABASE=lunar_db ADMIN_FIRSTNAME=Admin ADMIN_LASTNAME=User ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=password MEILISEARCH_KEY=masterKey MEILISEARCH_PORT=7700 MEILISEARCH_UI_PORT=24900 REDIS_PORT=6379Configure core application settings in app.php
mainThe
config/app.phpfile defines the fundamental behavior of the application. Most settings are driven by environment variables defined in your.envfile. Key configuration areas include:- Identity & Environment:
name(application name),env(current environment, e.g.,production), anddebug(boolean to enable/disable detailed error traces). - Networking:
url(the root URL used by Artisan for generating links) andasset_url(base URL for assets). - Localization:
timezone(PHP date/time default),locale(default translation locale),fallback_locale(used when a translation is missing), andfaker_locale(used for generating localized fake data in seeds). - Security:
key(the encryption key used by theIlluminateencrypter) andcipher(the encryption algorithm, defaults toAES-256-CBC). - Maintenance:
maintenance.driver(determines how maintenance mode status is managed; supported drivers arefileandcache).
- Identity & Environment: