Lunar Livewire Starter Kit

repository·main·Indexed 42 days ago

https://github.com/lunarphp/livewire-starter-kit

A 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.

Tokens
1.2K
Snippets
2
Records
7
Agent score
53%

What's inside Lunar Livewire Starter Kit

  1. Access the Demo Store and Lunar Panel

    main

    Once 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
  2. Install the Lunar Livewire Starter Kit via Docker

    main

    To run the starter kit using Docker, ensure Docker is installed on your local machine. You need to copy the example Docker environment file to .env and then use docker-compose to 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 up
  3. Service overview for Docker deployment

    main

    The 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, and meilisearch have dependencies on mysql and/or meilisearch to ensure correct startup order.

  4. Register Service Providers and Class Aliases

    main

    The application uses providers and aliases arrays to bootstrap functionality:

    • Service Providers: Add your custom or package service providers to the providers array to ensure they are automatically loaded on every request. The starter kit includes default providers merged with App\Providers\AppServiceProvider, AuthServiceProvider, EventServiceProvider, and RouteServiceProvider.
    • Class Aliases: Register lazy-loaded class aliases in the aliases array to provide short names for long-form class paths.
  5. Configure Docker environment variables

    main

    The docker-compose.yml file uses several environment variables to configure the services. You must define these in your local .env file to ensure the containers start with the correct credentials and connectivity settings.

    Database Configuration

    • DB_PASSWORD: Sets both the MYSQL_ROOT_PASSWORD and the MYSQL_PASSWORD for the application user.
    • DB_USERNAME: Sets the MYSQL_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-fpm service:

    • ADMIN_FIRSTNAME
    • ADMIN_LASTNAME
    • ADMIN_EMAIL
    • ADMIN_PASSWORD

    Search (Meilisearch) Configuration

    • MEILISEARCH_KEY: Sets the MEILI_MASTER_KEY for 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=6379
  6. Configure core application settings in app.php

    main

    The config/app.php file defines the fundamental behavior of the application. Most settings are driven by environment variables defined in your .env file. Key configuration areas include:

    • Identity & Environment: name (application name), env (current environment, e.g., production), and debug (boolean to enable/disable detailed error traces).
    • Networking: url (the root URL used by Artisan for generating links) and asset_url (base URL for assets).
    • Localization: timezone (PHP date/time default), locale (default translation locale), fallback_locale (used when a translation is missing), and faker_locale (used for generating localized fake data in seeds).
    • Security: key (the encryption key used by the Illuminate encrypter) and cipher (the encryption algorithm, defaults to AES-256-CBC).
    • Maintenance: maintenance.driver (determines how maintenance mode status is managed; supported drivers are file and cache).