Advanced Topics

Configuration

Configuration Management

Manage application settings and services in Stellify using JSON-based configuration profiles.

Overview

Stellify uses a profile-based configuration system that maps to Laravel config files. Instead of editing PHP config files, you manage settings through the web interface or API.

Benefits:

  • Visual configuration editor
  • Version-controlled settings
  • Environment-specific configs
  • Export to PHP config files

Configuration Profiles

Built-in Profiles

Stellify includes profiles for common Laravel configs:

  • database - Database connections
  • filesystems - File storage (S3, local, etc.)
  • mail - Email configuration
  • services - Third-party service APIs
  • custom - Your own config files

Database Configuration

Setting Up Database

  1. Navigate to SettingsDatabase
  2. Choose database type:
    • MySQL
    • PostgreSQL
    • SQLite
  3. Enter connection details
  4. Test connection
  5. Save

Database Profile Structure

{
  "driver": {
    "key": "driver",
    "path": "database.connections.mysql2.driver",
    "type": "select",
    "label": "Database Driver",
    "options": ["mysql", "pgsql", "sqlite"],
    "default": "mysql"
  },
  "host": {
    "key": "host",
    "path": "database.connections.mysql2.host",
    "type": "text",
    "label": "Database Host",
    "default": "127.0.0.1"
  },
  "port": {
    "key": "port",
    "path": "database.connections.mysql2.port",
    "type": "number",
    "label": "Database Port",
    "default": 3306
  },
  "database": {
    "key": "database",
    "path": "database.connections.mysql2.database",
    "type": "text",
    "label": "Database Name"
  },
  "username": {
    "key": "username",
    "path": "database.connections.mysql2.username",
    "type": "text",
    "label": "Database Username"
  },
  "password": {
    "key": "password",
    "path": "database.connections.mysql2.password",
    "type": "password",
    "label": "Database Password"
  }
}

MySQL Configuration

In Stellify:

Database Type: MySQL
Host: 127.0.0.1
Port: 3306
Database: my_database
Username: root
Password: ********

Exports to config/database.php:

'connections' => [
    'mysql2' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', 3306),
        'database' => env('DB_DATABASE', 'my_database'),
        'username' => env('DB_USERNAME', 'root'),
        'password' => env('DB_PASSWORD', ''),
    ],
],

PostgreSQL Configuration

In Stellify:

Database Type: PostgreSQL
Host: localhost
Port: 5432
Database: my_database
Username: postgres
Password: ********
SSL Mode: prefer

Exports to:

'connections' => [
    'pgsql2' => [
        'driver' => 'pgsql',
        'host' => env('DB_HOST', 'localhost'),
        'port' => env('DB_PORT', 5432),
        'database' => env('DB_DATABASE', 'my_database'),
        'username' => env('DB_USERNAME', 'postgres'),
        'password' => env('DB_PASSWORD', ''),
        'sslmode' => 'prefer',
    ],
],

Filesystem Configuration

S3 Storage Setup

  1. Navigate to SettingsFilesystems
  2. Select S3 disk
  3. Enter AWS credentials
  4. Save configuration

Filesystems Profile Structure

{
  "driver": {
    "key": "driver",
    "path": "filesystems.disks.s3.driver",
    "type": "select",
    "label": "Driver",
    "options": ["s3", "local", "spaces", "r2"],
    "default": "s3"
  },
  "region": {
    "key": "region",
    "path": "filesystems.disks.s3.region",
    "type": "text",
    "label": "AWS Region",
    "default": "us-east-1"
  },
  "bucket": {
    "key": "bucket",
    "path": "filesystems.disks.s3.bucket",
    "type": "text",
    "label": "S3 Bucket Name"
  },
  "key": {
    "key": "key",
    "path": "filesystems.disks.s3.key",
    "type": "text",
    "label": "AWS Access Key ID"
  },
  "secret": {
    "key": "secret",
    "path": "filesystems.disks.s3.secret",
    "type": "password",
    "label": "AWS Secret Access Key"
  },
  "url": {
    "key": "url",
    "path": "filesystems.disks.s3.url",
    "type": "text",
    "label": "CDN URL (optional)"
  },
  "endpoint": {
    "key": "endpoint",
    "path": "filesystems.disks.s3.endpoint",
    "type": "text",
    "label": "Custom Endpoint",
    "description": "For S3-compatible services like DigitalOcean Spaces or Cloudflare R2"
  }
}

S3 Configuration Example

In Stellify:

Driver: s3
Region: us-west-2
Bucket: my-app-bucket
Access Key: AKIAIOSFODNN7EXAMPLE
Secret Key: ********
URL: https://cdn.myapp.com

Exports to config/filesystems.php:

'disks' => [
    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION', 'us-west-2'),
        'bucket' => env('AWS_BUCKET', 'my-app-bucket'),
        'url' => env('AWS_URL', 'https://cdn.myapp.com'),
    ],
],

Other Storage Providers

DigitalOcean Spaces:

Driver: s3
Region: nyc3
Bucket: my-space
Endpoint: https://nyc3.digitaloceanspaces.com

Cloudflare R2:

Driver: s3
Endpoint: https://<account-id>.r2.cloudflarestorage.com
Bucket: my-r2-bucket

Local Storage:

Driver: local
Root: storage/app/public
Visibility: public

Custom Configuration

Creating Custom Profiles

For your own config needs:

  1. Navigate to SettingsConfiguration
  2. Click New Profile
  3. Name it (e.g., "payment", "api", "features")
  4. Define fields:
    • Key (internal name)
    • Path (dot notation to Laravel config)
    • Type (text, select, boolean, number)
    • Label (display name)
    • Default value

Example: Payment Configuration

Profile definition:

{
  "name": "payment",
  "fields": [
    {
      "key": "provider",
      "path": "payment.default_provider",
      "type": "select",
      "label": "Payment Provider",
      "options": ["stripe", "paypal", "square"],
      "default": "stripe"
    },
    {
      "key": "stripe_key",
      "path": "payment.stripe.key",
      "type": "text",
      "label": "Stripe Publishable Key"
    },
    {
      "key": "stripe_secret",
      "path": "payment.stripe.secret",
      "type": "password",
      "label": "Stripe Secret Key"
    },
    {
      "key": "test_mode",
      "path": "payment.test_mode",
      "type": "boolean",
      "label": "Test Mode",
      "default": true
    }
  ]
}

Exports to config/payment.php:

<?php

return [
    'default_provider' => env('PAYMENT_PROVIDER', 'stripe'),

    'stripe' => [
        'key' => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],

    'test_mode' => env('PAYMENT_TEST_MODE', true),
];

Using Configuration in Code

Accessing Config Values

In your controllers and models:

// Get database connection
$connection = config('database.connections.mysql2');

// Get S3 configuration
$bucket = config('filesystems.disks.s3.bucket');

// Get custom config
$paymentProvider = config('payment.default_provider');
$stripeKey = config('payment.stripe.key');

Runtime Configuration

Stellify applies your saved settings at runtime when executing code in the platform:

public function store(Request $request)
{
    // Upload to configured S3 bucket
    $path = $request->file('avatar')->store('avatars', 's3');

    // Use configured database
    User::create([
        'name' => $request->name,
        'avatar' => $path
    ]);
}

The middleware automatically merges your Stellify configuration with Laravel's config.

Exporting Configuration

Export as PHP Files

When you export your code, configuration is included:

my-project/
└── config/
    ├── database.php
    ├── filesystems.php
    ├── payment.php  (custom)
    └── ...

Export as .env

Generate .env.example with your config:

# Database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=my_database
DB_USERNAME=root
DB_PASSWORD=

# AWS S3
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-west-2
AWS_BUCKET=my-app-bucket
AWS_URL=

# Payment
PAYMENT_PROVIDER=stripe
STRIPE_KEY=
STRIPE_SECRET=
PAYMENT_TEST_MODE=true

Users fill in actual values in .env.

Best Practices

Security

  1. Never expose secrets - Use password field type
  2. Use environment variables - Don't hardcode values
  3. Rotate credentials - Change API keys regularly
  4. Limit access - Only admins can edit config

Organization

  1. Group related settings - Use profiles for logical grouping
  2. Clear labels - Make fields self-explanatory
  3. Add descriptions - Help text for complex options
  4. Set defaults - Provide sensible default values

Testing

  1. Test connections - Verify database/API connectivity
  2. Use test mode - Enable for development
  3. Validate inputs - Ensure config values are correct

Migration from PHP Config

If you have existing Laravel config files, Stellify can import them:

  1. Use Laravel Importer
  2. Config files are parsed
  3. Values populate Stellify profiles
  4. Edit visually in platform

Next Steps


Need help? Check the main documentation or contact support.

Please be aware that our documentation is under construction.