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.mdCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM php:8.2-apache
# Install dependenciesRUN 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 modulesRUN a2enmod rewrite
# Install ComposerCOPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Set working directoryWORKDIR /var/www/html
# Clone S-CartRUN git clone https://github.com/s-cart/s-cart.git . && \ composer install --no-dev --optimize-autoloader
# Set permissionsRUN 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 ApacheRUN sed -i 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf
# Expose port 80EXPOSE 80
CMD ["apache2-foreground"]Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_Storevendor/node_modules/.envEnvironment Variables Reference
| Variable | Required | Description |
|---|---|---|
DB_HOST | Yes | MySQL server hostname |
DB_PORT | No | MySQL port (default: 3306) |
DB_DATABASE | Yes | Database name |
DB_USERNAME | Yes | Database username |
DB_PASSWORD | Yes | Database password |
APP_KEY | Yes | Laravel application key |
APP_URL | Yes | Full URL of your store |
MAIL_HOST | Yes | SMTP server hostname |
MAIL_PORT | Yes | SMTP port |
MAIL_USERNAME | Yes | SMTP username |
MAIL_PASSWORD | Yes | SMTP password |
MAIL_FROM_ADDRESS | Yes | From email for notifications |
Deploying S-Cart on Klutch.sh
Once your repository is prepared, follow these steps to deploy S-Cart:
- Select HTTP as the traffic type
- Set the internal port to 80
- Build the container image
- Install dependencies
- Attach the persistent volumes
- Start the Apache server
- Provision an HTTPS certificate
Generate Laravel App Key
Generate a secure application key:
php artisan key:generate --showOr generate a random key:
echo "base64:$(openssl rand -base64 32)"Push Your Repository to GitHub
Initialize your repository and push to GitHub:
git initgit add Dockerfile .dockerignore README.mdgit commit -m "Initial S-Cart deployment configuration"git remote add origin https://github.com/yourusername/scart-deploy.gitgit push -u origin mainCreate 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:
Set Environment Variables
In the environment variables section, add:
| Variable | Value |
|---|---|
APP_KEY | Your generated key |
APP_URL | https://your-app-name.klutch.sh |
DB_HOST | Your MySQL host |
DB_DATABASE | scart |
DB_USERNAME | Your database user |
DB_PASSWORD | Your database password |
MAIL_HOST | Your SMTP host |
MAIL_PORT | 587 |
MAIL_USERNAME | Your SMTP user |
MAIL_PASSWORD | Your SMTP password |
MAIL_FROM_ADDRESS | store@yourdomain.com |
Attach Persistent Volumes
Add volumes for data persistence:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/www/html/storage | 20 GB | Product images, uploads, logs |
/var/www/html/public/data | 10 GB | Public assets |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Run Database Migrations
After first deployment, run migrations and seed the database:
php artisan migratephp artisan db:seed --class=DataDefaultSeederAccess 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:
- Navigate to Configuration → Store Info
- Set store name, address, and contact information
- Configure currency and tax settings
- Set up shipping methods
Adding Products
Create your product catalog:
- Go to Catalog → Products
- Click Add New Product
- Fill in product details, pricing, and images
- Assign to categories
- Configure inventory and variants
Payment Gateway Setup
Configure payment processing:
- Navigate to Payment settings
- Enable desired payment methods
- Enter API credentials for gateways like Stripe or PayPal
- 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
- Database Backup: Regular MySQL dumps
- File Backup: Back up
/storagefor product images - 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
- Official S-Cart Website
- S-Cart GitHub Repository
- S-Cart Documentation
- S-Cart Plugins
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
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.