EN
Getting started

Deployment

This page walks you through moving your theme application to a server, step by step.

Quick example

Once the code is on the server, run these in the application folder:

composer install --no-dev --optimize-autoloader
cp .env.example .env          # first time only; then edit .env
php artisan key:generate      # first time only
npm ci && npm run build
php artisan migrate --force
php artisan storage:link      # if you use file uploads, once
php artisan optimize

The web server's document root must be the public/ folder. On later deployments, skip the cp, key:generate and storage:link lines; if you run a queue worker, add php artisan queue:restart at the end.

Requirements

  • PHP 8.3 or later and the extensions on the Dependencies page. The full version needs the pdo_sqlite extension.
  • Composer 2.2 or later.
  • Node.js 20.19 or 22.12 and later; only if you build on the server.
  • MySQL, PostgreSQL or SQLite for the starter kit and your own project. The full version needs no database.
  • Nginx or Apache.

Step by step

  1. Move the code to the server. The packages/acun-ui folder must go too; Composer and the build take the Acun UI packages from there. Don't move .env, vendor/, node_modules/, or public/hot.

    If you deploy with Git, packages/acun-ui must be in the repository. public/build is in .gitignore, so build it on the server.

  2. Install the PHP packages. --no-dev leaves out the test and development tools:

    composer install --no-dev --optimize-autoloader
    
  3. Edit the .env file for production:

    APP_ENV=production
    APP_DEBUG=false
    APP_URL=https://panel.example.com
    APP_LOCALE=tr
    
    Variable Used for
    APP_ENV=production Runs Laravel with production rules.
    APP_DEBUG=false Hides error details from visitors.
    APP_URL Links and file URLs are built with this address.
    APP_LOCALE The language of console and queue jobs; Acun UI picks the language of pages.

    Fill in the database, mail and session settings too. If SESSION_DRIVER, CACHE_STORE or QUEUE_CONNECTION is database, the migrations create their tables.

  4. On the first deployment, generate the application key:

    php artisan key:generate
    

    Warning

    Don't generate the key again on later deployments. Sessions end and encrypted data can no longer be read.

  5. Build the CSS and JavaScript:

    npm ci
    npm run build
    

    Run this step after composer install; the build reads the PRO CSS and JavaScript from vendor/acunsoft/. Don't use npm ci --omit=dev, because Vite and Tailwind are development dependencies. The fonts are downloaded from Bunny Fonts during the build, so the server needs internet access.

    If the server has no Node.js, build on your own computer and upload the whole public/build folder. manifest.json and fonts-manifest.json are in this folder too. Laravel finds the built files and the fonts through these two files.

  6. Create the database tables. --force runs without asking for confirmation in production:

    php artisan migrate --force
    

    The full version has no such step; its sample data is read from JSON files.

  7. If uploaded files are saved to the public disk, create the public/storage link once:

    php artisan storage:link
    

    PHP's upload_max_filesize and post_max_size must be larger than the biggest file.

  8. Cache the configuration, routes and views:

    php artisan optimize
    

    Repeat it after every deployment and whenever .env changes. To clear the cache, run php artisan optimize:clear.

  9. Point the web server's document root at the public/ folder. In Nginx:

    root /var/www/my-app/public;
    
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    

    In Apache, public/.htaccess is ready; mod_rewrite must be on. Acun UI's theme script (/acun-ui/acun-ui-boot.js) is served through PHP, like Livewire's script. If you wrote a separate rule for .js files, let these URLs reach index.php too.

  10. Make the storage and bootstrap/cache folders writable by the web server's user. On Ubuntu this user is usually www-data:

    sudo chown -R www-data:www-data storage bootstrap/cache
    sudo chmod -R ug+rw storage bootstrap/cache
    

Queue and scheduler

You need this section only if you use the queue. The PRO DataTable builds exports of more than 5,000 rows in the queue (exports.queue_threshold). If QUEUE_CONNECTION isn't sync, run a queue worker:

php artisan queue:work

Keep the worker running with Supervisor or your platform's worker feature. After every deployment, run php artisan queue:restart so it picks up the new code. The web server and the worker must use the same cache (array won't work). On several servers, choose a shared disk for exports.disk, such as S3.

To delete expired export files, schedule the command in routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('acun-ui:prune-exports')->hourly();

For the scheduler, add a cron line that runs every minute on the server:

* * * * * cd /var/www/my-app && php artisan schedule:run >> /dev/null 2>&1

Hosting types

  • Laravel Cloud: You connect the Git repository; the platform sets the document root. Put composer install --no-dev --optimize-autoloader and npm ci && npm run build in the build commands, and php artisan migrate --force in the deploy commands. The server's disk isn't permanent; use an S3-compatible storage disk for uploaded files and exports.
  • Forge or your own server: The Nginx site's root is public/. If the deploy script has no npm ci && npm run build, add it after the composer install line. Add the queue worker and the scheduler too.
  • Shared hosting: There's usually no Node.js; build on your own computer and upload the public/build folder. The Acun UI packages are linked into vendor/acunsoft/ with symbolic links, so run composer install on the server over SSH. If the control panel doesn't let you change the document root, put the application outside public_html and link public_html to the application's public/ folder.

Checklist

  • PHP 8.3 or later and the required extensions are installed.
  • The packages/acun-ui folder is on the server.
  • composer install --no-dev --optimize-autoloader has run.
  • .env has APP_ENV=production, APP_DEBUG=false, and the right APP_URL.
  • APP_KEY was generated once and never changes.
  • public/build is up to date, including manifest.json and fonts-manifest.json. There's no public/hot file.
  • php artisan migrate --force has run (not needed for the full version).
  • If files are uploaded to the public disk, php artisan storage:link has run.
  • php artisan optimize has run.
  • The document root is the public/ folder.
  • storage and bootstrap/cache are writable.
  • If exports use the queue, the queue worker and the cron line are running.
  • A panel page opens and the browser console shows no error starting with [Acun UI].

Learn more

Acun UIDesigned for people.