Skip to content

Deploying S-Cart

Introduction

S-Cart is a free, open-source e-commerce platform built on Laravel, designed to help merchants create online stores quickly and easily. With its modular architecture and extensive plugin system, S-Cart provides everything needed to run a professional online store without the licensing fees of proprietary solutions.

Built with the popular Laravel PHP framework, S-Cart inherits Laravel’s elegant syntax and robust ecosystem. The platform supports multiple languages, multiple currencies, and multiple vendors, making it suitable for stores of all sizes and markets.

Key highlights of S-Cart:

  • Laravel Foundation: Built on Laravel for reliability and developer-friendly code
  • Multi-Vendor Support: Create marketplace-style stores with multiple sellers
  • Multi-Language: Built-in internationalization for global reach
  • Multi-Currency: Support multiple currencies with automatic conversion
  • Plugin System: Extend functionality with plugins and themes
  • SEO Optimized: Built-in SEO features for better search visibility
  • Responsive Design: Mobile-friendly storefront out of the box
  • Order Management: Comprehensive order processing and fulfillment
  • Product Variants: Support for product options and variations
  • Discount Codes: Coupon and promotion management
  • Shipping Methods: Configurable shipping options and rates
  • Payment Gateways: Multiple payment integration options
  • Admin Dashboard: Intuitive backend for store management
  • Open Source: MIT licensed with active community

This guide walks through deploying S-Cart on Klutch.sh using Docker, configuring the store, and setting up for production e-commerce.

Why Deploy S-Cart on Klutch.sh

Deploying S-Cart on Klutch.sh provides several advantages for e-commerce:

Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds S-Cart without complex orchestration. Push to GitHub, and your store deploys automatically.

Persistent Storage: Attach persistent volumes for your database, product images, and uploads. Your store data survives container restarts.

HTTPS by Default: Klutch.sh provides automatic SSL certificates, essential for secure e-commerce transactions.

GitHub Integration: Connect your configuration repository directly from GitHub. Updates trigger automatic redeployments.

Scalable Resources: Allocate resources based on your store traffic. Scale for sales events and promotions.

Environment Variable Management: Securely store database credentials, payment API keys, and other secrets through Klutch.sh’s environment variable system.

Custom Domains: Use your own domain for a professional, branded shopping experience.

Always-On Availability: Your store runs 24/7 for customers worldwide.

Prerequisites

Before deploying S-Cart on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your S-Cart configuration
  • Basic familiarity with Docker and Laravel concepts
  • A MySQL database (can be provisioned through Klutch.sh)
  • SMTP credentials for order notifications
  • (Optional) Payment gateway credentials (Stripe, PayPal, etc.)
  • (Optional) A custom domain for your store

Understanding S-Cart Architecture

S-Cart follows the Laravel architecture:

Laravel Application: The core application handles HTTP requests, business logic, and database operations using Laravel’s MVC pattern.

MySQL Database: Stores all store data including products, orders, customers, and configuration.

File Storage: Product images and uploads are stored on the filesystem.

Queue Workers: Background jobs handle email sending and other async tasks.

Cache Layer: Laravel caching improves performance for frequently accessed data.

Preparing Your Repository

To deploy S-Cart on Klutch.sh, create a GitHub repository with your deployment configuration.

Repository Structure

scart-deploy/
├── Dockerfile
├── .dockerignore
└── README.md

Creating the Dockerfile

Create a Dockerfile in the root of your repository:

FROM php:8.2-apache
# Install dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
libpng-dev \
libonig-dev \
libxml2-dev \
zip \
unzip \
nodejs \
npm \
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
# Enable Apache modules
RUN a2enmod rewrite
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www/html
# Clone S-Cart
RUN git clone https://github.com/s-cart/s-cart.git . && \
composer install --no-dev --optimize-autoloader
# Set permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html/storage \
&& chmod -R 755 /var/www/html/bootstrap/cache
# Configure Apache
RUN sed -i 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf
# Expose port 80
EXPOSE 80
CMD ["apache2-foreground"]

Creating the .dockerignore File

Create a .dockerignore file:

.git
.github
*.md
LICENSE
.gitignore
*.log
.DS_Store
vendor/
node_modules/
.env

Environment Variables Reference

VariableRequiredDescription
DB_HOSTYesMySQL server hostname
DB_PORTNoMySQL port (default: 3306)
DB_DATABASEYesDatabase name
DB_USERNAMEYesDatabase username
DB_PASSWORDYesDatabase password
APP_KEYYesLaravel application key
APP_URLYesFull URL of your store
MAIL_HOSTYesSMTP server hostname
MAIL_PORTYesSMTP port
MAIL_USERNAMEYesSMTP username
MAIL_PASSWORDYesSMTP password
MAIL_FROM_ADDRESSYesFrom email for notifications

Deploying S-Cart on Klutch.sh

Once your repository is prepared, follow these steps to deploy S-Cart:

    Generate Laravel App Key

    Generate a secure application key:

    Terminal window
    php artisan key:generate --show

    Or generate a random key:

    Terminal window
    echo "base64:$(openssl rand -base64 32)"

    Push Your Repository to GitHub

    Initialize your repository and push to GitHub:

    Terminal window
    git init
    git add Dockerfile .dockerignore README.md
    git commit -m "Initial S-Cart deployment configuration"
    git remote add origin https://github.com/yourusername/scart-deploy.git
    git push -u origin main

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “s-cart” or “online-store”.

    Provision MySQL Database

    Before deploying S-Cart, ensure you have a MySQL database. This can be provisioned through Klutch.sh or an external provider.

    Create a New App

    Within your project, create a new app. Connect your GitHub account and select the repository containing your S-Cart Dockerfile.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Set Environment Variables

    In the environment variables section, add:

    VariableValue
    APP_KEYYour generated key
    APP_URLhttps://your-app-name.klutch.sh
    DB_HOSTYour MySQL host
    DB_DATABASEscart
    DB_USERNAMEYour database user
    DB_PASSWORDYour database password
    MAIL_HOSTYour SMTP host
    MAIL_PORT587
    MAIL_USERNAMEYour SMTP user
    MAIL_PASSWORDYour SMTP password
    MAIL_FROM_ADDRESSstore@yourdomain.com

    Attach Persistent Volumes

    Add volumes for data persistence:

    Mount PathRecommended SizePurpose
    /var/www/html/storage20 GBProduct images, uploads, logs
    /var/www/html/public/data10 GBPublic assets

    Deploy Your Application

    Click Deploy to start the build process. Klutch.sh will:

    • Build the container image
    • Install dependencies
    • Attach the persistent volumes
    • Start the Apache server
    • Provision an HTTPS certificate

    Run Database Migrations

    After first deployment, run migrations and seed the database:

    Terminal window
    php artisan migrate
    php artisan db:seed --class=DataDefaultSeeder

    Access S-Cart

    Visit https://your-app-name.klutch.sh for the storefront and https://your-app-name.klutch.sh/sc_admin for the admin panel.

Initial Setup and Configuration

Admin Panel Access

Access the admin panel at /sc_admin:

  • Default username: admin@s-cart.org
  • Default password: admin

Change these immediately after first login!

Store Configuration

Configure your store settings:

  1. Navigate to ConfigurationStore Info
  2. Set store name, address, and contact information
  3. Configure currency and tax settings
  4. Set up shipping methods

Adding Products

Create your product catalog:

  1. Go to CatalogProducts
  2. Click Add New Product
  3. Fill in product details, pricing, and images
  4. Assign to categories
  5. Configure inventory and variants

Payment Gateway Setup

Configure payment processing:

  1. Navigate to Payment settings
  2. Enable desired payment methods
  3. Enter API credentials for gateways like Stripe or PayPal
  4. Test payment flow before going live

Production Best Practices

Security Recommendations

  • Change Default Credentials: Immediately change admin login
  • SSL/HTTPS: Always use HTTPS (provided by Klutch.sh)
  • Payment Security: Use established payment gateways with PCI compliance
  • Regular Updates: Keep S-Cart and plugins updated
  • Input Validation: S-Cart handles this, but monitor for issues

Performance Optimization

  • Caching: Enable Laravel caching for better performance
  • Image Optimization: Optimize product images before upload
  • Database Indexing: Ensure proper indexes for large catalogs
  • CDN: Consider CDN for static assets

Backup Strategy

  1. Database Backup: Regular MySQL dumps
  2. File Backup: Back up /storage for product images
  3. Configuration Export: Document store settings

Troubleshooting Common Issues

Product Images Not Showing

Symptoms: Product images display as broken.

Solutions:

  • Verify storage volume is properly mounted
  • Check file permissions
  • Ensure APP_URL is correctly configured

Payment Processing Errors

Symptoms: Payments fail or return errors.

Solutions:

  • Verify payment gateway credentials
  • Check gateway is in live mode (not sandbox)
  • Review gateway dashboard for error details

Email Not Sending

Symptoms: Order confirmations don’t arrive.

Solutions:

  • Verify SMTP credentials
  • Check spam folders
  • Test with mail configuration command

Additional Resources

Conclusion

Deploying S-Cart on Klutch.sh gives you a full-featured, self-hosted e-commerce platform with automatic builds, persistent storage, and secure HTTPS access. The combination of S-Cart’s comprehensive features and Klutch.sh’s deployment simplicity means you can focus on selling products rather than managing infrastructure.

With multi-vendor support, internationalization, and extensive plugin options, S-Cart handles everything from simple stores to complex marketplaces. The Laravel foundation ensures maintainable code and a strong ecosystem of tools and resources.

Whether you’re launching your first online store or migrating from a proprietary platform, S-Cart on Klutch.sh provides the reliable foundation for professional e-commerce.