# Clear custom domain cache Source: https://docs.shardcloud.app/api-reference/apps/clear-custom-domain-cache api-reference/openapi.json delete /apps/{app_id}/domain/cache # Create a file in app Source: https://docs.shardcloud.app/api-reference/apps/create-a-file-in-app api-reference/openapi.json post /apps/{app_id}/files # Create a new app Source: https://docs.shardcloud.app/api-reference/apps/create-a-new-app api-reference/openapi.json post /apps # Delete a file or directory Source: https://docs.shardcloud.app/api-reference/apps/delete-a-file-or-directory api-reference/openapi.json delete /apps/{app_id}/files # Delete an app Source: https://docs.shardcloud.app/api-reference/apps/delete-an-app api-reference/openapi.json delete /apps/{app_id} # Delete custom domain Source: https://docs.shardcloud.app/api-reference/apps/delete-custom-domain api-reference/openapi.json delete /apps/{app_id}/domain # Delete deploy token Source: https://docs.shardcloud.app/api-reference/apps/delete-deploy-token api-reference/openapi.json delete /apps/{app_id}/deploy-token # Deploy token flow Source: https://docs.shardcloud.app/api-reference/apps/deploy-token-flow api-reference/openapi.json post /apps/{app_id}/deploy-token # Get all apps for authenticated user Source: https://docs.shardcloud.app/api-reference/apps/get-all-apps-for-authenticated-user api-reference/openapi.json get /apps # Get app deployments Source: https://docs.shardcloud.app/api-reference/apps/get-app-deployments api-reference/openapi.json get /apps/{app_id}/deploys # Get app metrics Source: https://docs.shardcloud.app/api-reference/apps/get-app-metrics api-reference/openapi.json get /apps/{app_id}/metrics # Get app status Source: https://docs.shardcloud.app/api-reference/apps/get-app-status api-reference/openapi.json get /apps/{app_id}/status # Get custom domain info Source: https://docs.shardcloud.app/api-reference/apps/get-custom-domain-info api-reference/openapi.json get /apps/{app_id}/domain # Get deploy token Source: https://docs.shardcloud.app/api-reference/apps/get-deploy-token api-reference/openapi.json get /apps/{app_id}/deploy-token # Get file content from app Source: https://docs.shardcloud.app/api-reference/apps/get-file-content-from-app api-reference/openapi.json get /apps/{app_id}/file/content # Get folder structure Source: https://docs.shardcloud.app/api-reference/apps/get-folder-structure api-reference/openapi.json get /apps/{app_id}/files # Get specific app details Source: https://docs.shardcloud.app/api-reference/apps/get-specific-app-details api-reference/openapi.json get /apps/{app_id} # Move a file Source: https://docs.shardcloud.app/api-reference/apps/move-a-file api-reference/openapi.json patch /apps/{app_id}/files # Stream app logs (Server-Sent Events) Source: https://docs.shardcloud.app/api-reference/apps/stream-app-logs-server-sent-events api-reference/openapi.json get /apps/{app_id}/logs # Update app code Source: https://docs.shardcloud.app/api-reference/apps/update-app-code api-reference/openapi.json put /apps/{app_id}/file # Update app resources Source: https://docs.shardcloud.app/api-reference/apps/update-app-resources api-reference/openapi.json put /apps/{app_id}/resources # Update app status (run/stop/restart) Source: https://docs.shardcloud.app/api-reference/apps/update-app-status-runstoprestart api-reference/openapi.json post /apps/{app_id}/status # Update custom domain Source: https://docs.shardcloud.app/api-reference/apps/update-custom-domain api-reference/openapi.json post /apps/{app_id}/domain # Change database password Source: https://docs.shardcloud.app/api-reference/databases/change-database-password api-reference/openapi.json put /databases/{database_id}/password # Create a new database Source: https://docs.shardcloud.app/api-reference/databases/create-a-new-database api-reference/openapi.json post /databases # Delete a database Source: https://docs.shardcloud.app/api-reference/databases/delete-a-database api-reference/openapi.json delete /databases/{database_id} # Get all databases for authenticated user Source: https://docs.shardcloud.app/api-reference/databases/get-all-databases-for-authenticated-user api-reference/openapi.json get /databases # Get database connection URL Source: https://docs.shardcloud.app/api-reference/databases/get-database-connection-url api-reference/openapi.json get /databases/{database_id}/connection-url # Get database metrics Source: https://docs.shardcloud.app/api-reference/databases/get-database-metrics api-reference/openapi.json get /databases/{database_id}/metrics # Get database replica status Source: https://docs.shardcloud.app/api-reference/databases/get-database-replica-status api-reference/openapi.json get /databases/{database_id}/status # Get specific database details Source: https://docs.shardcloud.app/api-reference/databases/get-specific-database-details api-reference/openapi.json get /databases/{database_id} # Initialize a stopped database Source: https://docs.shardcloud.app/api-reference/databases/initialize-a-stopped-database api-reference/openapi.json post /databases/{database_id}/initialize # Retry database setup Source: https://docs.shardcloud.app/api-reference/databases/retry-database-setup api-reference/openapi.json post /databases/{database_id}/retry-setup # Stop a database Source: https://docs.shardcloud.app/api-reference/databases/stop-a-database api-reference/openapi.json post /databases/{database_id}/stop # Update database resources Source: https://docs.shardcloud.app/api-reference/databases/update-database-resources api-reference/openapi.json put /databases/{database_id}/resources # Welcome Source: https://docs.shardcloud.app/api-reference/introduction Before getting started, you'll need to generate an API token. This can be done by accessing the dashboard, then navigating to Config> Integrations. ## Authorization All API endpoints are authenticated using Bearer tokens and picked up from the authorization header shown below: ```json theme={null} 'Authorization': 'Bearer {api_token}' ``` ## Full API Control With our API, you can programmatically interact with any application or database β€” including creating and deleting them β€” without ever needing to access the dashboard. All actions available on the dashboard are fully supported via the API, with the **same generous limits**. API Base URL: [https://shardcloud.app/api](https://shardcloud.app/api) # Applications Source: https://docs.shardcloud.app/apps ShardCloud provides a comprehensive hosting platform designed for modern web applications. Our infrastructure supports various deployment scenarios with enterprise-grade features accessible to developers of all levels. Integrate your own branded domain on our platform Get instant \*.shardweb.app domains for every app Automatic deployments from your repositories Intelligent application restart system ## Production-Optimized Containers Optimized containers for each supported language Security and performance optimizations built-in every app Our container environments are specifically designed and optimized for production workloads, ensuring your applications run efficiently and securely. **Container Features:** * **Minimal Base Images**: Reduced attack surface and faster startup times * **Multi-Stage Builds**: Optimized build processes for smaller final images * **Security Hardening**: Regular security updates and vulnerability patches * **Performance Tuning**: Language-specific optimizations and configurations * **Resource Limits**: Configurable CPU and memory limits ### Supported Languages: * [Node](/languages/javascript) * [Python](/languages/python) * [Golang](/languages/go) * [C#](/languages/csharp) * [Ruby](/languages/ruby) * [Elixir](/languages/elixir) * [Static html (nginx)](/languages/static) * [Php](/languages/php) * [Java](/languages/java) You can find examples of how to host your projects in each language under the **Languages** section. ## Custom Domains Our custom domain system allows you to maintain your brand identity while leveraging our robust hosting infrastructure. Simply point your DNS records to our servers, and we'll handle the rest. **Key Features:** * SSL certificates automatically provisioned and renewed * DNS management assistance * Subdomain support (www, api, staging, etc.) Navigate to your app network settings and add your custom domain Point your domain's CNAME to our provided endpoints Our system automatically verifies and provisions SSL certificates ## Free Subdomains Every application gets a free `xyz.shardweb.app` subdomain instantly upon creation. Our subdomain system provides immediate access to your applications without any setup required. Perfect for development, staging, or production environments. **Benefits:** * Instant availability upon app creation * No configuration required * SSL enabled by default * Easy to remember naming convention * Perfect for API endpoints and microservices ## GitHub Integration & Automatic Deployment Ensure your repository has the correct build configuration before connecting for optimal deployment experience. Our platform seamlessly integrates with GitHub repositories, enabling continuous deployment workflows that keep your applications up-to-date with every commit. **Deployment Features:** * **Automatic Builds**: Triggered on every push to your master/main branch * **Deploy history**: See the entire deploy history of your application * **Webhook Integration**: Custom webhooks for external integrations ## Auto Restart System Our intelligent restart system monitors your application health and automatically recovers from crashes. The auto-restart feature ensures maximum uptime for your applications through intelligent monitoring and recovery mechanisms. **How It Works:** 1. **Health Monitoring**: Continuous monitoring of application processes 2. **Automatic Recovery**: Up to 3 restart attempts within a short time period 3. **Circuit Breaker**: Applications stop after limit is reached to prevent resource waste 4. **Reset Timer**: Restart limits refresh automatically after cooldown period **Restart Triggers:** * Process crashes or exits unexpectedly * Memory limit exceeded * Health check failures ## Real-Time Metrics & Analytics CPU, Memory, and Network usage in real-time Our metrics dashboard provides comprehensive insights into your application's performance with beautiful, easy-to-understand graphics. **Available Metrics:** * **Resource Usage**: CPU, RAM, and disk utilization * **Network Traffic**: Incoming and outgoing bandwidth * **Uptime Statistics**: Historical uptime percentages ## Real-Time Logs Access your application logs instantly without SSH or complex setup procedures. Our logging system captures all application output in real-time, making debugging and monitoring effortless. **Log Features:** * **Live Tail**: Stream logs in real-time as they happen * **Search & Filter**: Find specific log entries quickly ### Crash & Restart Logging Every time your application crashes or restarts, we automatically create a snapshot of the current logs, preserving crucial debugging information that might otherwise be lost. ## Backup & Snapshot System Protect your application data with automated backups and instant recovery options. Our backup system ensures your application data is always safe with multiple recovery points available. **Backup Features:** * **Manual Backups**: Up to 10 backups per application * **Instant Recovery**: One-click restoration to any backup point * **Incremental Backups**: Efficient storage using delta compression Backups are created with only one click View all available backups with timestamps and size information Click to restore any backup point with zero downtime ## Integrated File Manager Access and manage your application files directly from your dashboard. **File Manager Capabilities:** * **Real-Time File Browsing**: Navigate your application directory structure * **Inline Editing**: Edit configuration files directly in the browser * **File Upload/Download**: Transfer files to and from your application * **File tools**: Rename/move files in real time ### Supported Operations * Create, rename, and delete files and directories * Copy and move files between directories * View file properties and metadata * Search for files and content within files ## Custom Dependency Manager Our dependency manager automatically detects your project type and suggests optimal configurations. Simplify dependency management with our intelligent system that understands your application's requirements. **Supported Package Managers:** * **Node.js**: npm, yarn, pnpm * **Python**: pip * **PHP**: composer * **Go**: go modules * **Java**: maven, gradle **Features:** * **Automatic Detection**: Recognizes package files and install them * **Cache Optimization**: Intelligent caching for faster startup times # Authentication Source: https://docs.shardcloud.app/cli/auth Learn how to authenticate with the Shard Cloud CLI. ## Get API Key First, you need to get an API key from the [dashboard](https://shardcloud.app/pt-br/dash) `-> config -> integrations.`You can use this API key to authenticate with the Shard Cloud CLI. ## Authenticate Authenticate with the Shard Cloud CLI using the following command: ```bash theme={null} shardcloud login ``` You will be prompted to enter your API key. ```bash theme={null} Your API Token: > Insert your shard cloud api token ``` After entering your API key, you will be authenticated with the Shard Cloud CLI. You can skip the prompt by passing your API key with the `--token` flag: ```bash theme={null} shardcloud login --token= ``` ## Creating your first app with the CLI See the [commands ](/cli/commands)section for more info about the commands and how to get started. # Shard Cloud CLI Source: https://docs.shardcloud.app/cli/cli This package provides a direct way to interact with the official ShardCloud API. ## Installation Repo: [https://github.com/shard-cloud/cli](https://github.com/shard-cloud/cli) To install the CLI, just run the following command in your terminal: macOS, Linux, and WSL: ```bash theme={null} curl -fsSL https://cli.shardcloud.app | bash ``` Windows | need [npm](https://www.npmjs.com/) installed: ```bash theme={null} npm install -g shard-cloud-cli ``` ## Authentication See [Authentication](/cli/auth) for more details. ## Update To update the CLI, just run the following command in your terminal: macOS, Linux, and WSL: ```bash theme={null} curl -fsSL https://cli.shardcloud.app | bash ``` Windows | need [npm](https://www.npmjs.com/) installed: ```bash theme={null} shardcloud update ``` ### Install a specific version (NPM only) ```bash theme={null} shardcloud install 1.0.0 ``` # Commands Source: https://docs.shardcloud.app/cli/commands List of all commands available ## Creating an app with ShardCloud CLI Make sure you are [authenticated](/cli/auth) before proceeding. First, in your app directory, create the [.shardcloud](config) file. 1. After creating the .shardcloud file, use the command `shardcloud create` 2. Done 3. Use `shardcloud commit` to commit your current changes to the app whenever you want to update ## Commands available | Command | Description | | ------- | ------------------------------------------------------- | | me | Print the current logged-in user | | backup | Manage app backups | | commit | Create a commit in the current application | | create | Create an application with the current .shardcloud file | | login | Log in to Shard Cloud | | logout | Log out | | logs | View the logs of your applications | | status | View the status of your applications | | delete | Delete your applications | | start | Start a stopped app | | stop | Stop a running app | | restart | Restart a running app | | restore | Restore a backup | # How to create your .shardcloud config file Source: https://docs.shardcloud.app/config Learn how to create your ShardCloud configuration file *** ## Our configuration File The configuration file is a simple text file that defines how your application should be deployed on Shard Cloud. It includes details like the app's main file, memory usage, programming language, and more. The file must be located in the root ## Creating the configuration file Just create a file named `.shardcloud` and include the parameters described below. ## Configuration parameters These are the supported configuration parameters: Name that will appear for your application. ```systemd theme={null} DISPLAY_NAME=My Cool App ``` Max 50 characters. A brief description of your application. ```systemd theme={null} DESCRIPTION=My First App with shard cloud! ``` Max 1024 characters. Entry file of your application (only required if `LANGUAGE` or `CUSTOM_COMMAND` are not defined). ```systemd theme={null} MAIN=src/index.js ``` Max 50 characters. This field is **ignored** if`CUSTOM_COMMAND` is present. Programming language of your application.\ This parameter is automatically detected when `MAIN` is provided. If `MAIN` is not set, you must explicitly define this parameter along with `CUSTOM_COMMAND`. ```systemd theme={null} LANGUAGE=node ``` Accepted values: `node`, `python`, `java`, `go`, `static`, `php` RAM allocated to your application in MB. ```systemd theme={null} MEMORY=512 ``` Must be a positive integer. Version to run your application with. ```systemd theme={null} VERSION=recommended ``` Accepted values: `recommended`, `latest` Subdomain for your web application. ```systemd theme={null} SUBDOMAIN=mycoolapp ``` Only alphanumeric characters. Max 100 characters.Website will be available at`mycoolapp.shardweb.app` Custom command to start your application (optional). ```systemd theme={null} CUSTOM_COMMAND=npm run build && npm run start ``` Max 250 characters. If `LANGUAGE` is set and `CUSTOM_COMMAND` is used, the `MAIN` parameter will be ignored. ## Configuration logic note 🧠 If **both** `LANGUAGE` and `CUSTOM_COMMAND` are provided, then the `MAIN` parameter will be **ignored**, even if specified. This gives you flexibility to fully customize startup behavior for more complex projects. ## Example configurations ```systemd Minimal config theme={null} DISPLAY_NAME=Basic Bot MAIN=index.js MEMORY=256 VERSION=recommended ``` ```systemd Full config with description and language theme={null} DISPLAY_NAME=My Super App DESCRIPTION=My app helps you organize everything. MAIN=main.py MEMORY=512 VERSION=latest LANGUAGE=python ``` ```systemd Config with custom startup theme={null} DISPLAY_NAME=Custom Starter DESCRIPTION=A Node.js app with a custom command LANGUAGE=node MEMORY=1024 VERSION=recommended CUSTOM_COMMAND=npm run build && npm run start ``` ```systemd Website config with subdomain theme={null} DISPLAY_NAME=My WebApp LANGUAGE=html MEMORY=512 VERSION=recommended SUBDOMAIN=mywebapp CUSTOM_COMMAND=npm run start ``` ## Parameter limits summary | Parameter | Max Length | | --------------- | ------------------------------------ | | DISPLAY\_NAME | 50 characters | | DESCRIPTION | 1024 characters | | MAIN | 50 characters | | CUSTOM\_COMMAND | 250 characters | | SUBDOMAIN | 100 characters | | LANGUAGE | 35 characters | | MEMORY | Must be a valid non-negative integer | | VERSION | 60 characters | # Database Services Source: https://docs.shardcloud.app/databases ShardCloud provides fully managed database services with high availability and built-in security. In-memory data store Relational database Document database Relational database ## Supported Databases ### Redis * **Use Cases**: Caching, sessions, real-time data ### PostgreSQL * **Use Cases**: Web apps, complex queries, ACID transactions ### MySQL * **Use Cases**: Web apps, complex queries, ACID transactions ### MongoDB * **Use Cases**: Document storage, flexible schemas, JSON data ## Database Visualizers Enable web-based database management with one click - no configuration needed. Redis management interface PostgreSQL admin tool MongoDB admin interface ### Features * **One-click enable**: Simple toggle switch activation * **Auto-configured**: Pre-configured with your database credentials * **Secure access**: Protected with your database password Toggle visualizer switch in database settings Click the provided URL Use your database credentials ## Security All database connections use SSL encryption only. ### SSL-Only Connections * TLS encryption for all database traffic * Automatic certificate management * No unencrypted connections allowed ### Password Management * Change passwords anytime * Visualizer passwords update automatically * Zero downtime password rotation ## Real-Time Metrics Monitor your database performance with live metrics: Ingress and egress traffic RAM and vCPU utilization **Available Metrics:** * Network ingress/egress * RAM usage * vCPU usage * Connection counts * Query performance ## Backups Create and restore backups with one click. ### Backup Features * **One-click creation**: Instant backup generation * **10 backups per database**: Automatic rotation * **Easy restoration**: One-click restore process * **Secure storage**: Encrypted backup storage ### Backup Process Click backup button in dashboard Backup saved automatically Select backup and click restore ## Getting Started Choose database type and configure Use provided connection strings Toggle visualizer for web management Create your first backup # Welcome to the ShardCloud Platform Source: https://docs.shardcloud.app/index Shard Cloud is a platform that provides user-friendly, reliable cloud hosting for your apps and databases. Get started in minutes. Learn how to deploy apps and databases quickly and efficiently. Step-by-step guides for frameworks, bots, and platform features. Explore our API documentation to manage and automate your services. AI-friendly plain text version of our docs for LLMs and AI tools. > βœ… Once you've signed up and selected [your plan](https://shardcloud.app/#pricing), you're ready to start deploying your applications and databases with Shard Cloud. *** ## What can you host with Shard Cloud? Shard Cloud was built to support a wide variety of modern workloadsβ€”from bots and web apps to managed databases. Here's a brief overview of what you can deploy: Host your bots with high availability and low latency. Ideal for platforms like Discord, Telegram, and others. Deploy static or dynamic websites with custom subdomains, custom domains with real time metrics. Launch fully managed PostgreSQL, MongoDB, or Redis instances with optional visual tools. Deploy virtual private servers with full root access and customizable configurations. *** ## What's next? Now that you understand what you can build on Shard Cloud, it's time to jump into action. Head over to our quick start guide to learn how to deploy your first project in just a few steps. Follow our quick start guide to deploy your app or database today. Explore tutorials for Next.js, Discord bots, Flask, and more. Join our community on [Discord](https://discord.gg/jjdYayFu5Q) to ask questions, connect with other developers, and stay updated on platform news. Chat with developers, ask questions, and share feedback in our community Discord server. Need help? Reach out to our discord server. # C# Hosting Guide Source: https://docs.shardcloud.app/languages/csharp Learn how to deploy C# (.NET) applications on ShardCloud platform. # Getting Started with C# Hosting Deploy your C# (.NET) applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports .NET applications with automatic build and execution via `dotnet run` or direct `.dll` execution. ## Prerequisites Before uploading your C# application, ensure you have the following project structure ready. Essential files for deployment Files to exclude before upload ## Required Files Your C# application must include these essential files: ### 1. Project or Entry Point File You can deploy using one of these options: | MAIN Value | Execution Command | Use Case | | --------------- | ----------------------------------- | -------------------------------------------- | | `MyApp.csproj` | `dotnet run --project MyApp.csproj` | Upload source code, platform builds and runs | | `MyApp.dll` | `dotnet MyApp.dll` | Upload pre-built DLL | | `auto` or empty | Auto-detect `.dll` in `bin/` folder | Let platform find your DLL | | *(omitted)* | `dotnet run` | Run from project root | ### 2. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory The `.shardcloud` file is required. Missing this file will prevent successful deployment. ## Deployment Options ### Option 1: Upload Source Code (Recommended) Upload your source code with the `.csproj` file and let ShardCloud build and run it automatically. **Required files:** * `*.cs` source files * `YourApp.csproj` * `.shardcloud` **Files to exclude:** * `bin/` * `obj/` * `.vs/` * `*.user` ### Option 2: Upload Pre-built DLL Upload your compiled application directly. **Required files:** * `YourApp.dll` (and dependencies) * `.shardcloud` ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example (Source Code) ```bash theme={null} DISPLAY_NAME=myfirstcsharpproject DESCRIPTION=a simple C# application MAIN=MyApp.csproj MEMORY=1024 VERSION=recommended ``` ### Configuration Example (Pre-built DLL) ```bash theme={null} DISPLAY_NAME=myfirstcsharpproject DESCRIPTION=a simple C# application MAIN=MyApp.dll MEMORY=1024 VERSION=recommended ``` .NET applications typically require more memory than interpreted languages. Choose appropriate memory allocation for your application's needs. ## Deployment Process Ensure your project compiles locally with `dotnet build` Create `.shardcloud` file with deployment settings Remove `bin/`, `obj/`, and `.vs/` folders (if uploading source) Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically builds (if needed) and runs ## Common Configuration Examples ### ASP.NET Core Web API ```bash theme={null} DISPLAY_NAME=aspnet-api DESCRIPTION=REST API with ASP.NET Core MAIN=MyApi.csproj MEMORY=1024 VERSION=recommended SUBDOMAIN=aspnetapi ``` ### Console Application ```bash theme={null} DISPLAY_NAME=dotnet-worker DESCRIPTION=Background worker service MAIN=Worker.csproj MEMORY=512 VERSION=recommended ``` ### Pre-built Application ```bash theme={null} DISPLAY_NAME=dotnet-app DESCRIPTION=Pre-compiled .NET application MAIN=MyApp.dll MEMORY=512 VERSION=recommended ``` # Elixir Hosting Guide Source: https://docs.shardcloud.app/languages/elixir Learn how to deploy Elixir applications on ShardCloud platform. # Getting Started with Elixir Hosting Deploy your Elixir applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports Elixir applications with automatic dependency management via Mix and OTP support. ## Prerequisites Before uploading your Elixir application, ensure you have the following project structure ready. Essential files for deployment Files to exclude before upload ## Required Files Your Elixir application must include these essential files: ### 1. Entry Point File * **File**: `lib/your_app.ex` or main module file * **Purpose**: Main application entry point * **Requirements**: Must contain your application's main module ### 2. Dependencies Configuration * **File**: `mix.exs` * **Purpose**: Defines project dependencies, configuration, and application metadata * **Requirements**: Valid Mix project file with all dependencies listed ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory All three files are mandatory. Missing any of these files will prevent successful deployment. ## Files to Exclude Remove these files/folders before creating your deployment archive: * `_build/` * `deps/` * `.elixir_ls/` * `*.beam` (compiled files) ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstelixirproject DESCRIPTION=a simple Elixir application MAIN=lib/my_app.ex MEMORY=512 VERSION=recommended ``` Elixir applications benefit from the BEAM VM's efficiency. Choose memory based on your application's concurrent workload. ## Deployment Process Ensure all required files are present and configured Confirm all dependencies are listed in your mix.exs file Remove `_build/`, `deps/`, and `.elixir_ls/` folders Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically builds dependencies and deploys ## Common Configuration Examples ### Phoenix Web Application ```bash theme={null} DISPLAY_NAME=phoenix-app DESCRIPTION=Web application with Phoenix Framework MAIN=mix.exs MEMORY=1024 VERSION=recommended SUBDOMAIN=phoenix CUSTOM_COMMAND=mix phx.server ``` ### GenServer Background Worker ```bash theme={null} DISPLAY_NAME=elixir-worker DESCRIPTION=Background worker with GenServer MAIN=lib/worker.ex MEMORY=256 VERSION=LATEST ``` # Go Hosting Guide Source: https://docs.shardcloud.app/languages/go Learn how to deploy Go applications on ShardCloud platform. # Getting Started with Go Hosting Deploy your Go applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports Go applications with automatic module resolution and dependency management. ## Prerequisites Before uploading your Go application, ensure you have the following project structure ready. Essential files for deployment Clean deployment process ## Required Files Your Go application must include these three essential files: ### 1. Entry Point File * **File**: `main.go` or your main Go file * **Purpose**: Main application entry point with main() function * **Requirements**: Must contain your application's main execution code ### 2. Module Configuration * **File**: `go.mod` * **Purpose**: Defines Go module and dependencies * **Requirements**: Valid Go module file with module name and dependency versions ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory All three files are mandatory. Missing any of these files will prevent successful deployment. ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstgoproject DESCRIPTION=a simple go application MAIN=main.go MEMORY=512 VERSION=LATEST ``` Go applications are typically memory-efficient. Choose the minimum required memory for optimal performance. ## Deployment Process Ensure go.mod is properly configured with all dependencies Verify your main Go file contains the main() function Create .shardcloud file with deployment settings Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically builds and deploys ## Common Configuration Examples ### Gin Web Server ```bash theme={null} DISPLAY_NAME=gin-api DESCRIPTION=REST API with Gin framework MAIN=server.go MEMORY=512 VERSION=LATEST SUBDOMAIN=ginapi ``` # Java Hosting Guide Source: https://docs.shardcloud.app/languages/java Learn how to deploy Java applications on ShardCloud platform. # Getting Started with Java Hosting Deploy your Java applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports Java applications with automatic JAR execution and dependency management. ## Prerequisites Before uploading your Java application, ensure you have the following project structure ready. Essential files for deployment Clean deployment process ## Required Files Your Java application must include these two essential files: ### 1. Entry Point File * **File**: `yourapp.jar` * **Purpose**: Compiled Java application JAR file * **Requirements**: Must be a valid executable JAR with main class defined ### 2. Manifest Configuration * **File**: `MANIFEST.MF` * **Purpose**: Defines JAR metadata and dependencies * **Requirements**: Valid manifest format with Main-Class and dependency information ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory .sharcloudd and the entrypoint file are required. ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstjavaproject DESCRIPTION=a simple java application MAIN=myapp.jar MEMORY=1024 VERSION=LATEST ``` Java applications typically require more memory than interpreted languages. Choose appropriate memory allocation for your application's needs. ## Deployment Process Compile your Java application into an executable JAR Ensure MANIFEST.MF contains correct Main-Class and dependencies Create .shardcloud file with deployment settings Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically deploys and runs your JAR ## Common Configuration Examples ### Spring Boot Application ```bash theme={null} DISPLAY_NAME=spring-api DESCRIPTION=REST API with Spring Boot MAIN=spring-app.jar MEMORY=1536 VERSION=LATEST SUBDOMAIN=springapi ``` # Node.js Hosting Guide Source: https://docs.shardcloud.app/languages/javascript Learn how to deploy Node.js applications on ShardCloud platform. # Getting Started with Node.js Hosting Deploy your Node.js applications on ShardWeb Cloud with minimal configuration and maximum performance. ShardCloud supports both JavaScript (.js) and TypeScript (.ts) Node.js applications out of the box. ## Prerequisites Before uploading your Node.js application, ensure you have the following project structure ready. Essential files for deployment Files to exclude before upload ## Required Files Your Node.js application must include these three essential files: ### 1. Entry Point File * **File**: `index.js` or `index.ts` * **Purpose**: Main application entry point * **Requirements**: Must export or start your server ### 2. Package Configuration * **File**: `package.json` * **Purpose**: Defines dependencies and project metadata * **Requirements**: Valid JSON with dependencies listed ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file All three files are mandatory. Missing any of these files will prevent successful deployment. ## Files to Exclude Remove these files/folders before creating your deployment archive: * node\_modules * package-lock.json ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstnodeproject DESCRIPTION=a simple node project MAIN=index.js MEMORY=799 VERSION=LATEST ``` Choose the minimum required for your application's needs. ## Deployment Process Ensure all required files are present and configured Remove `__pycache__/`, `venv/`, and `.pyc` files Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically builds and deploys # PHP Hosting Guide Source: https://docs.shardcloud.app/languages/php Learn how to deploy PHP applications on ShardCloud platform. # Getting Started with PHP Hosting Deploy your PHP applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports PHP applications with automatic dependency management via Composer and built-in web server. ## Prerequisites Before uploading your PHP application, ensure you have the following project structure ready. Essential files for deployment Enhanced functionality files ## Required Files Your PHP application must include these two essential files: ### 1. Entry Point File * **File**: `index.php` or your main PHP file * **Purpose**: Main application entry point * **Requirements**: Must contain your application's main execution code ### 2. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory Both files are mandatory. Missing any of these files will prevent successful deployment. ## Optional Files Enhance your PHP application with these optional configuration files: ### Composer Dependencies (Optional) * **File**: `composer.json` * **Purpose**: Defines PHP dependencies and project metadata * **Benefits**: Automatic dependency installation and autoloading * **Note**: If present, Composer will automatically install dependencies during deployment composer.json is optional but recommended for applications using external packages or frameworks. ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstphpproject DESCRIPTION=a simple php application MAIN=index.php MEMORY=512 VERSION=LATEST SUBDOMAIN=php ``` PHP applications have moderate memory requirements. Adjust based on your application's complexity and traffic. ## Deployment Process Ensure your main PHP file is ready and functional Optionally create composer.json for external packages Create .shardcloud file with deployment settings Zip or RAR your project Use[ ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically deploys with dependency installation # Python Hosting Guide Source: https://docs.shardcloud.app/languages/python Learn how to deploy Python applications on ShardCloud platform. # Getting Started with Python Hosting Deploy your Python applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports Python applications with automatic dependency management and virtual environment isolation. ## Prerequisites Before uploading your Python application, ensure you have the following project structure ready. Essential files for deployment Files to exclude before upload ## Required Files Your Python application must include these three essential files: ### 1. Entry Point File * **File**: `main.py` or `app.py` * **Purpose**: Main application entry point * **Requirements**: Must contain your application's main execution code ### 2. Dependencies Configuration * **File**: `requirements.txt` * **Purpose**: Defines Python dependencies and versions * **Requirements**: Valid pip requirements format with all dependencies listed ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory All three files are mandatory. Missing any of these files will prevent successful deployment. ## Files to Exclude Remove these files/folders before creating your deployment archive: * `__pycache__/` * `*.pyc` * `venv/` ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstpythonproject DESCRIPTION=a simple python project MAIN=main.py MEMORY=799 VERSION=LATEST ``` Choose the minimum required for your application's needs. ## Deployment Process Ensure all required files are present and configured Remove `__pycache__/`, `venv/`, and `.pyc` files Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically builds and deploys ## Common Configuration Examples ### Flask Application ```bash theme={null} DISPLAY_NAME=flask-api DESCRIPTION=RESTful API with Flask MAIN=app.py MEMORY=512 VERSION=LATEST SUBDOMAIN=flask ``` # Ruby Hosting Guide Source: https://docs.shardcloud.app/languages/ruby Learn how to deploy Ruby applications on ShardCloud platform. # Getting Started with Ruby Hosting Deploy your Ruby applications on ShardCloud with minimal configuration and maximum performance. ShardCloud supports Ruby applications with automatic dependency management via Bundler. ## Prerequisites Before uploading your Ruby application, ensure you have the following project structure ready. Essential files for deployment Files to exclude before upload ## Required Files Your Ruby application must include these essential files: ### 1. Entry Point File * **File**: `app.rb` or `main.rb` * **Purpose**: Main application entry point * **Requirements**: Must contain your application's main execution code ### 2. Dependencies Configuration * **File**: `Gemfile` * **Purpose**: Defines Ruby gem dependencies * **Requirements**: Valid Bundler format with all dependencies listed ### 3. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory All three files are mandatory. Missing any of these files will prevent successful deployment. ## Files to Exclude Remove these files/folders before creating your deployment archive: * `vendor/bundle/` * `.bundle/` * `Gemfile.lock` (optional, can include for version locking) * `tmp/` * `log/` ## ShardCloud Configuration The [.shardcloud](/config) file configures your application deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=myfirstrubyproject DESCRIPTION=a simple Ruby application MAIN=app.rb MEMORY=512 VERSION=recommended ``` Choose memory based on your application's requirements. Web frameworks may need more memory. ## Deployment Process Ensure all required files are present and configured Confirm all dependencies are listed in your Gemfile Remove `vendor/bundle/`, `.bundle/`, and cache folders Zip or RAR your project Use [ShardCloud dashboard](https://shardcloud.app/dash) to upload your archive Application automatically installs gems and deploys ## Common Configuration Examples ### Rails Web Application ```bash theme={null} DISPLAY_NAME=rails-app DESCRIPTION=Web application with Ruby on Rails MAIN=Gemfile MEMORY=1024 VERSION=recommended SUBDOMAIN=rails CUSTOM_COMMAND=chmod +x bin/rails && bin/rails server -b 0.0.0.0 ``` ### Sinatra API ```bash theme={null} DISPLAY_NAME=sinatra-api DESCRIPTION=REST API with Sinatra MAIN=app.rb MEMORY=256 VERSION=LATEST SUBDOMAIN=sinatra ``` ### Sidekiq Background Worker ```bash theme={null} DISPLAY_NAME=sidekiq-worker DESCRIPTION=Background job processor MAIN=worker.rb MEMORY=512 VERSION=LATEST ``` # Static HTML Hosting Guide Source: https://docs.shardcloud.app/languages/static Learn how to deploy static HTML websites on ShardCloud platform. # Getting Started with Static HTML Hosting Deploy your static HTML websites on ShardCloud with minimal configuration and maximum performance. Under the hood, we run a production-configured NGINX server to serve all your static files. ShardCloud supports static HTML websites with fast CDN delivery and automatic optimization. ## Prerequisites Before uploading your static website, ensure you have the following project structure ready. Essential files for deployment ## Required Files Your static HTML website must include these two essential files: ### 1. Entry Point File * **File**: `index.html` or your main HTML file * **Purpose**: Main website entry point * **Requirements**: Valid HTML document that serves as your homepage ### 2. ShardCloud Configuration * **File**: `.shardcloud` * **Purpose**: Platform-specific deployment settings * **Requirements**: Plain text configuration file in root directory Both files are mandatory. Missing any of these files will prevent successful deployment. ity! ## ShardCloud Configuration The [.shardcloud](/config) file configures your website deployment settings. ### Configuration Example ```bash theme={null} DISPLAY_NAME=mystaticwebsite DESCRIPTION=a simple static html website MAIN=index.html MEMORY=128 VERSION=LATEST SUBDOMAIN=static ``` Static websites require minimal memory since they're served directly without server-side processing. ## Deployment Process Ensure your index.html and supporting files are ready Create .shardcloud file with deployment settings Zip or RAR your project Use[ ShardCloud dashboard ](https://shardcloud.app/dash)to upload your archive Website immediately becomes available via CDN ## Common Configuration Examples ### Personal Portfolio ```bash theme={null} DISPLAY_NAME=portfolio-site DESCRIPTION=Personal portfolio website MAIN=index.html MEMORY=128 VERSION=LATEST SUBDOMAIN=portfolio ``` # Info, Limits and Restrictions of shard cloud Source: https://docs.shardcloud.app/limits On this page, you will find more details and the limits of our platform. ## Minimum Resource Requirements Every project hosted on the Shard Cloud Platform has specific minimum resource requirements to ensure optimal performance: * **Normal apps:** A minimum of **256MB** of RAM is required for hosting * **Websites:** A minimum of **512MB** of RAM is required to ensure proper functionality * **Databases:** * **MongoDB:** 1024MB of RAM * **PostgreSQL:** 1024MB of RAM * **Redis:** 512MB of RAM * **MySQL:** 1024MB of RAM The **maximum RAM allocation** for any **application is 32GB** (subject to change in future updates). ## Service Limits Shard Cloud enforces resource boundaries to maintain optimal platform performance and ensure equitable access for all users. These protective measures include: ### OUT\_OF\_RAM If a project exceeds the allocated RAM limit specified in its [.shardcloud](/config) file (or defined in the configuration for databases), it will be flagged for violating OUT\_OF\_RAM and automatically shut down to preserve system stability and protect all users. ### CPU Throttling If a project exceeds its allocated processing capacity, it will be automatically throttled rather than terminated. The application will continue running but receive reduced CPU cycles to maintain system performance. ### Network limit Every project has a network bandwidth limit based on its allocated RAM over **5 days**. This generous limit exists solely to prevent abuse from malicious users. If your application reaches this limit, it will be automatically stopped and blocked from restarting for 24 hours. ### Bandwidth limit Every project is limited to an egress/ingress bandwidth limit based on its allocated RAM. The calculation is as follows: **30 + (RAM\_MB/256) Γ— 50**. This means if an application has 512MB of RAM, it will have **130** Mbps for both egress and ingress traffic.\ \ For virtual machines, the limit is calculated using the formula **25 + (RAM\_MB/256) Γ— 45.** For example, a virtual machine with 4GB of allocated RAM will have **745** Mbps for both egress and ingress traffic. ### Storage limit **Applications:** All applications have a flat storage limit of **10GB**. **Databases:** Storage limits depend on the allocated RAM using the following formula: **6 + (RAM\_MB/512)**. For example, a database with 2GB of allocated RAM will have 10GB of storage space.\ \ **Virtual machines:** Storage limits depend on the allocated RAM using the following formula: **RAM\_MB/50** . For example, a vps with 4GB of allocated RAM will have 81GB of storage space. ### Max number of database connections This limit applies only to databases (not applications). The maximum number of simultaneous connections to a database hosted on Shard Cloud is based on its allocated RAM and follows the formula: **RAM\_MB/8**. For example, a database with 2048MB of RAM would support **256** simultaneous connections. ### Http requests limit This limit applies only to applications (not databases or virtual machines). Like the network limit, its main purpose is to prevent malicious users from making a large number of HTTP requests in a short period, which could result in our IPs being banned by external services. The monitoring window for this limit is **10 minutes**, and if exceeded, your application will be stopped and blocked from restarting for one hour. ## Vcpu allocation method The system employs an intelligent CPU allocation mechanism that balances resource efficiency with application requirements. The strategy reduces the standard CPU allocation by dividing it by three, fostering optimal resource distribution across the infrastructure. ### **Allocation Rules** The CPU allocation follows specific conditional logic based on system characteristics: **Base CPU Protection**: When the application's standard CPU allocation equals 1000 mCPU (1 vCPU), the allocation remains at 1000 mCPU unchanged to maintain minimum performance guarantees. **Memory-Based Scaling**: * **High Memory Applications** (RAM β‰₯ 2048 MB): CPU allocation stays at full capacity without reduction * **Low Memory Applications** (RAM ≀ 1024 MB): CPU is reduced to one-third of the original allocation, with a floor value of 1000 mCPU to prevent performance degradation * **Medium Memory Applications** (1024 MB \< RAM \< 2048 MB): CPU allocation is consistently reduced to one-third of the standard allocation # Getting Started Source: https://docs.shardcloud.app/quickstart Get your projects live in minutes with Shard Cloud. This guide walks you through deploying your apps and databases on our platform with ease. ## Shard Cloud Services Shard Cloud was built to empower developers by offering a reliable and modern infrastructure. Whether you're deploying bots, web apps, or databases, we provide everything you need to run your software with confidence. Deploy your bots to Shard Cloud and enjoy a premium hosting experience. Our infrastructure is optimized for fast response times and global availability on platforms like Discord and Telegram. Bring your websites to life with Shard Cloud. We provide powerful web hosting with integrated DNS, Cloudflare protection, and optimized performance out of the box. Easily spin up production-ready databases with Shard Cloud. Choose from PostgreSQL, MongoDB, or Redis and get instant access, with optional web-based visualizers for simplified management. > Before you begin: Make sure your project is ready for deployment and compatible with the supported languages (see below). ## Upload your application Deploying your project to Shard Cloud is fast and simple. Just follow the steps below: Shard Cloud supports most popular programming languages, including Node.js, Python, Go, Java, and PHP. This example uses **JavaScript (Node.js)**. Once you're logged into the dashboard, create a `.shardcloud` config file in your project’s root directory.\ Read more about our config file [here](/config) Example for a bot: ``` DISPLAY_NAME=Gotham Bot ENTRYPOINT=index.js MEMORY=1524 VERSION=recommended DESCRIPTION=A vigilant bot protecting the streets. ``` Example for a web app (hosted at `knight.shardweb.app`): ``` DISPLAY_NAME=Gotham Website ENTRYPOINT=index.js MEMORY=1524 VERSION=recommended SUBDOMAIN=knight START=npm run build && npm run start DESCRIPTION=A sleek dark-themed website for heroes. ``` After setting up your config file, zip the entire project directory. ``` 1. Locate the file or folder that you want to compress. 2. Press and hold (or right-click) the file or folder, select (or point to) Send to, and then select Compressed (zipped or rar) folder. 3. A new zipped folder with the same name is created in the same location. To rename it, press and hold (or right-click) the folder, select Rename, and then type the new name. ``` Go to your [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and click **β€œNew app”** to upload your zipped project and deploy it in seconds. *** ## Deploying a Database Want to deploy a PostgreSQL, MongoDB, or Redis instance? Shard Cloud makes it incredibly easy: Go to [https://shardcloud.app/dash/databases](https://shardcloud.app/dash/databases) and log in to your account. Click on the **β€œNew Database”** button. You’ll be prompted to: * Choose your database type: **PostgreSQL**, **MongoDB, MySQL**, or **Redis** * Select the amount of RAM * Decide whether to enable a **Visualizer**, which is a hosted GUI tool to manage your data: * **PgWeb** for PostgreSQL * **Compass Web UI** for MongoDB * **Redis Commander** for Redis > The visualizer will be accessible through a secure URL, allowing you to manage your database easily via the web, without installing any tools locally. Once your database is deployed, connection details will be available on your dashboard. Use them to connect from your application and start building! # How Shard Cloud platform works Source: https://docs.shardcloud.app/shardcloud-overview ## How it is designed? Our platform is designed to make it as easy as possible for developers to host applications and databases. We offer prices far below market standards, along with an extensive IPv4 network β€” ensuring your app always gets a reliable IP. ### Robust and Secure Infrastructure Our data center, strategically located in **Ashburn, Virginia**, delivers a high-performance and secure environment designed to keep your applications online and protected at all times. This strategic location offers the lowest possible ping times, ensuring optimal performance and responsiveness for your critical applications. *** #### Blazing-Fast Network and Connectivity * **25 Gbps Dedicated Bandwidth per Server**\ Experience ultra-fast data transfers with minimal latency. * **Advanced DDoS Mitigation**\ Multi-layer defense systems protect your apps from malicious traffic and downtime. * **Exclusive IPv4 Allocation**\ A large pool of shared IPv4 addresses dedicated to your applications. * **Cloudflare Speed Boost**\ We integrate advanced **Cloudflare** optimizations to ensure your website loads insanely fast worldwide. *** #### Physical Security and Infrastructure Redundancy * **Access Control**\ Secured facilities designed to protect dedicated server infrastructure. * **Disaster-Ready Architecture**\ Built to endure extreme weather conditions and other external risks without interruption. * **Power Redundancy**\ Equipped with backup generators and redundant power feeds to guarantee uninterrupted uptime. * **Network Infrastructure**\ Multi-homed bandwidth connections providing network redundancy and reliability. *** # How to Host Django Applications Source: https://docs.shardcloud.app/tutorials/api/django Learn how to create and deploy Django applications on Shard Cloud. ## Introduction This guide covers deploying Django applications on Shard Cloud. Django is a high-level Python web framework for rapid development. ## Creating Your Project Ensure you have **Python** and **pip** installed. ### Installing Django ```bash theme={null} pip install django gunicorn ``` ### Creating a New Project ```bash theme={null} django-admin startproject myproject cd myproject ``` ### Basic Django Application Create a simple view in `myproject/views.py`: ```python myproject/views.py theme={null} from django.http import HttpResponse def index(request): return HttpResponse("Hello from Django!") ``` Update `myproject/urls.py`: ```python myproject/urls.py theme={null} from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name='index'), ] ``` ### Settings Configuration Update `myproject/settings.py`: ```python theme={null} ALLOWED_HOSTS = ['*'] DEBUG = False ``` ### Requirements File Create a `requirements.txt`: ```txt requirements.txt theme={null} django gunicorn ``` ## Production Server with Gunicorn Django's built-in server is not suitable for production. Always use Gunicorn. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Django App DESCRIPTION=Python Django Application LANGUAGE=python MEMORY=512 VERSION=recommended SUBDOMAIN=my-django-app CUSTOM_COMMAND=gunicorn --bind 0.0.0.0:80 --workers 2 myproject.wsgi:application ``` Run migrations locally before deploying: `python manage.py migrate` ## Deploying ```bash python manage.py migrate python manage.py collectstatic --noinput theme={null} ``` Ensure you have: - Your Django project folder - `requirements.txt` - `.shardcloud` - `db.sqlite3` (if using SQLite) Remove: `__pycache__/`, `venv/`, `*.pyc` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Django documentation](https://docs.djangoproject.com/) for more information. ## Troubleshooting Add your domain to `ALLOWED_HOSTS` in `settings.py` or use `['*']`. Run `python manage.py collectstatic` before deploying. # How to Host Express Applications Source: https://docs.shardcloud.app/tutorials/api/express Learn how to create and deploy Express.js applications on Shard Cloud. ## Introduction This guide covers deploying Express.js applications on Shard Cloud, from initial setup to production deployment. ## Creating Your Project Before starting, ensure you have **Node.js** and **npm** installed. Download from the [official Node.js website](https://nodejs.org/). ### Installing Express ```bash theme={null} npm init -y npm install express ``` ### Basic Express Application Create an `index.js` file: ```javascript index.js theme={null} import express from "express"; const app = express(); const port = 80; app.get("/", (req, res) => { res.send("Hello World!"); }); app.listen(port, () => { console.log(`Express app listening on port ${port}`); }); ``` Port 80 is required for web applications on Shard Cloud. ### Package.json Configuration ```json package.json theme={null} { "name": "my-express-app", "version": "1.0.0", "type": "module", "main": "index.js", "scripts": { "start": "node index.js" }, "dependencies": { "express": "^4.18.0" } } ``` ## Shard Cloud Configuration Create a `.shardcloud` file in your project root: ```systemd .shardcloud theme={null} DISPLAY_NAME=My Express API DESCRIPTION=Express.js REST API MAIN=index.js MEMORY=512 VERSION=recommended SUBDOMAIN=my-express-api ``` ## Deploying Ensure you have: - `index.js` (or your entry file) - `package.json` - `.shardcloud` Remove before zipping: - `node_modules/` - `package-lock.json` Compress your project folder into a `.zip` file. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and click **"New app"** to upload your project. ## Additional Resources For more information about Express, visit the [official Express documentation](https://expressjs.com/). ## Troubleshooting * Verify your `MAIN` file path is correct - Check that port 80 is used for web applications - Ensure all dependencies are in `package.json` * Confirm `SUBDOMAIN` is set in `.shardcloud` - Wait a few moments after deployment for DNS propagation # How to Host Fastify Applications Source: https://docs.shardcloud.app/tutorials/api/fastify Learn how to create and deploy Fastify applications on Shard Cloud. ## Introduction This guide covers deploying Fastify applications on Shard Cloud. Fastify is a high-performance web framework for Node.js. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. Download from [nodejs.org](https://nodejs.org/). ### Installing Fastify ```bash theme={null} npm init -y npm install fastify ``` ### Basic Fastify Application Create an `index.js` file: ```javascript index.js theme={null} import Fastify from "fastify"; const fastify = Fastify({ logger: true }); fastify.get("/", async (request, reply) => { return { message: "Hello World!" }; }); fastify .listen({ port: 80, host: "0.0.0.0" }) .then((address) => { fastify.log.info(`Server listening at ${address}`); }) .catch((err) => { fastify.log.error(err); process.exit(1); }); ``` Always use `host: '0.0.0.0'` to ensure the server is accessible externally. ### Package.json Configuration ```json package.json theme={null} { "name": "my-fastify-app", "version": "1.0.0", "type": "module", "main": "index.js", "scripts": { "start": "node index.js" }, "dependencies": { "fastify": "^4.0.0" } } ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Fastify API DESCRIPTION=High-performance Fastify API MAIN=index.js MEMORY=512 VERSION=recommended SUBDOMAIN=my-fastify-api ``` ## Deploying Ensure you have: - `index.js` - `package.json` - `.shardcloud` Remove: `node_modules/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload your project. ## Additional Resources Visit the [official Fastify documentation](https://fastify.dev/) for more information. ## Troubleshooting Ensure you're binding to `0.0.0.0` instead of `localhost` or `127.0.0.1`. Check your logs in the dashboard for detailed error messages. # How to Host Flask Applications Source: https://docs.shardcloud.app/tutorials/api/flask Learn how to create and deploy Flask applications on Shard Cloud. ## Introduction This guide covers deploying Flask applications on Shard Cloud. Flask is a lightweight WSGI web framework for Python. ## Creating Your Project Ensure you have **Python** and **pip** installed. Download from [python.org](https://www.python.org/). ### Installing Flask ```bash theme={null} pip install flask gunicorn ``` ### Basic Flask Application Create an `app.py` file: ```python app.py theme={null} from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' if __name__ == '__main__': app.run(host='0.0.0.0', port=80) ``` ### Requirements File Create a `requirements.txt`: ```txt requirements.txt theme={null} flask gunicorn ``` ## Production Server with Gunicorn Flask's built-in server is not suitable for production. Always use Gunicorn. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Flask API DESCRIPTION=Python Flask Application MAIN=app.py MEMORY=512 VERSION=recommended SUBDOMAIN=my-flask-api ``` For production with Gunicorn: ```systemd .shardcloud theme={null} DISPLAY_NAME=Flask API DESCRIPTION=Python Flask Application LANGUAGE=python MEMORY=512 VERSION=recommended SUBDOMAIN=my-flask-api CUSTOM_COMMAND=gunicorn --bind 0.0.0.0:80 --workers 2 app:app ``` ## Deploying Ensure you have: - `app.py` - `requirements.txt` - `.shardcloud` Remove: `__pycache__/`, `venv/`, `*.pyc` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Flask documentation](https://flask.palletsprojects.com/) for more information. ## Troubleshooting Ensure all dependencies are listed in `requirements.txt`. Verify you're binding to `0.0.0.0` and port `80`. # How to Host Gin Applications Source: https://docs.shardcloud.app/tutorials/api/gin Learn how to create and deploy Gin applications on Shard Cloud. ## Introduction This guide covers deploying Gin applications on Shard Cloud. Gin is a high-performance HTTP web framework for Go. ## Creating Your Project Ensure you have **Go** installed. Download from [go.dev](https://go.dev/dl/). ### Initialize Project ```bash theme={null} mkdir my-gin-app cd my-gin-app go mod init my-gin-app go get -u github.com/gin-gonic/gin ``` ### Basic Gin Application Create a `main.go` file: ```go main.go theme={null} package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { r := gin.Default() r.GET("/", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "message": "Hello World!", }) }) r.GET("/ping", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{ "message": "pong", }) }) r.Run(":80") } ``` Gin listens on port 80 which is required for web applications on Shard Cloud. ## Building Your Application Go applications must be compiled before deployment: ```bash theme={null} # For Linux (Shard Cloud environment) GOOS=linux GOARCH=amd64 go build -o app main.go ``` This creates a binary named `app` that can run on Shard Cloud. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Gin API DESCRIPTION=High-performance Go Gin API MAIN=app MEMORY=256 VERSION=recommended SUBDOMAIN=my-gin-api ``` Go applications are memory-efficient. 256MB is often sufficient for simple APIs. ## Deploying Run `GOOS=linux GOARCH=amd64 go build -o app main.go` to create the Linux binary. Ensure you have: * `app` (compiled binary) * `.shardcloud` Compress your files into a `.zip` file. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload your project. ## Advanced Example: REST API with Routes ```go main.go theme={null} package main import ( "github.com/gin-gonic/gin" "net/http" ) type User struct { ID string `json:"id"` Name string `json:"name"` } var users = []User{ {ID: "1", Name: "John"}, {ID: "2", Name: "Jane"}, } func main() { r := gin.Default() // API routes api := r.Group("/api") { api.GET("/users", getUsers) api.GET("/users/:id", getUser) api.POST("/users", createUser) } r.Run(":80") } func getUsers(c *gin.Context) { c.JSON(http.StatusOK, users) } func getUser(c *gin.Context) { id := c.Param("id") for _, user := range users { if user.ID == id { c.JSON(http.StatusOK, user) return } } c.JSON(http.StatusNotFound, gin.H{"error": "User not found"}) } func createUser(c *gin.Context) { var newUser User if err := c.ShouldBindJSON(&newUser); err != nil { c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) return } users = append(users, newUser) c.JSON(http.StatusCreated, newUser) } ``` ## Additional Resources Visit the [official Gin documentation](https://gin-gonic.com/docs/) for more information. ## Troubleshooting Ensure you compiled with `GOOS=linux GOARCH=amd64` for the Shard Cloud environment. Make sure your application uses port 80. # How to Host Discord Bots Source: https://docs.shardcloud.app/tutorials/bots/discord Learn how to create and host Discord bots on Shard Cloud with Node.js and Python examples. ## Introduction This guide covers creating and deploying Discord bots on Shard Cloud with examples in both Node.js and Python. ## Creating a Discord Bot Application Go to the [Discord Developer Portal](https://discord.com/developers/applications) and click **"New Application"**. Give your bot a name and create it. Navigate to the **"Bot"** tab and click **"Reset Token"** to generate your bot token. **Copy and save it securely**. In the **"Bot"** tab, scroll to **"Privileged Gateway Intents"** and enable: * Presence Intent * Server Members Intent * Message Content Intent **Security**: Never share your bot token publicly. It grants full control over your bot. ## Creating Your Bot ### Setup ```bash theme={null} npm init -y npm install discord.js ``` ### Basic Bot Code ```javascript index.js theme={null} const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], }); client.on('ready', () => { console.log(`Logged in as ${client.user.tag}!`); }); client.on('messageCreate', (message) => { if (message.content === '!ping') { message.reply('Pong!'); } }); client.login('YOUR_BOT_TOKEN'); ``` ### Package.json ```json package.json theme={null} { "name": "discord-bot", "version": "1.0.0", "main": "index.js", "dependencies": { "discord.js": "^14.0.0" } } ``` ### Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=Discord Bot DESCRIPTION=My Discord Bot MAIN=index.js MEMORY=512 VERSION=recommended ``` ### Setup ```bash theme={null} pip install discord.py ``` ### Basic Bot Code ```python main.py theme={null} import discord from discord.ext import commands intents = discord.Intents.default() intents.message_content = True bot = commands.Bot(command_prefix='!', intents=intents) @bot.event async def on_ready(): print(f'{bot.user} is now running!') @bot.command() async def ping(ctx): await ctx.reply('Pong!') bot.run('YOUR_BOT_TOKEN') ``` ### Requirements.txt ```txt requirements.txt theme={null} discord.py ``` ### Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=Discord Bot DESCRIPTION=My Discord Bot MAIN=main.py MEMORY=512 VERSION=recommended ``` ## Inviting Your Bot 1. Go to the [Developer Portal](https://discord.com/developers/applications) 2. Select your bot β†’ **OAuth2** β†’ **URL Generator** 3. Check **"bot"** scope 4. Select required permissions 5. Copy and open the generated URL to invite your bot ## Deploying Ensure you have: * Your bot code file * `package.json` (Node.js) or `requirements.txt` (Python) * `.shardcloud` Remove: `node_modules/`, `__pycache__/`, `venv/` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Testing After deployment, test your bot by sending `!ping` in a server where your bot is present. It should reply with "Pong!". ## Additional Resources * [Discord.js Guide](https://discordjs.guide/) * [Discord.py Documentation](https://discordpy.readthedocs.io/) ## Troubleshooting * Verify your bot token is correct * Check that intents are enabled in Developer Portal * Review logs in the Shard Cloud dashboard Re-invite your bot with the necessary permissions enabled. # How to Host Slack Bots Source: https://docs.shardcloud.app/tutorials/bots/slack Learn how to create and host Slack bots on Shard Cloud with Node.js and Python examples. ## Introduction This guide covers creating and deploying Slack bots on Shard Cloud. ## Creating a Slack App Go to [Slack API - Your Apps](https://api.slack.com/apps) and click **"Create New App"**. Select **"From scratch"**, name your app, and select your workspace. In **"Basic Information"**, note your **Signing Secret**. In **"OAuth & Permissions"**, add scopes like `chat:write`, `app_mentions:read`, `commands`. Click **"Install to Workspace"** and copy the **Bot Token** (starts with `xoxb-`). **Security**: Never expose your Signing Secret or Bot Token publicly. ## Creating Your Bot ### Setup ```bash theme={null} npm init -y npm install @slack/bolt ``` ### Basic Bot Code ```javascript index.js theme={null} const { App } = require('@slack/bolt'); const app = new App({ signingSecret: process.env.SLACK_SIGNING_SECRET, token: process.env.SLACK_BOT_TOKEN, }); // Respond to mentions app.event('app_mention', async ({ event, say }) => { await say(`<@${event.user}> Thanks for mentioning me!`); }); // Slash command app.command('/ping', async ({ ack, respond }) => { await ack(); await respond('Pong!'); }); (async () => { await app.start(process.env.PORT || 80); console.log('⚑️ Slack bot is running!'); })(); ``` ### Package.json ```json package.json theme={null} { "name": "slack-bot", "version": "1.0.0", "main": "index.js", "dependencies": { "@slack/bolt": "^3.0.0" } } ``` ### Setup ```bash theme={null} pip install slack_bolt ``` ### Basic Bot Code ```python main.py theme={null} import os from slack_bolt import App app = App( signing_secret=os.environ.get('SLACK_SIGNING_SECRET'), token=os.environ.get('SLACK_BOT_TOKEN') ) @app.event('app_mention') def handle_mention(event, say): user = event.get('user') say(f'<@{user}> Thanks for mentioning me!') @app.command('/ping') def ping_command(ack, respond): ack() respond('Pong!') if __name__ == '__main__': app.start(port=int(os.environ.get('PORT', 80))) ``` ### Requirements.txt ```txt requirements.txt theme={null} slack_bolt ``` ## Environment Variables Set these in the Shard Cloud dashboard: * `SLACK_SIGNING_SECRET`: Your app's signing secret * `SLACK_BOT_TOKEN`: Your bot's OAuth token ## Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=Slack Bot DESCRIPTION=My Slack Bot MAIN=index.js MEMORY=512 VERSION=recommended SUBDOMAIN=my-slack-bot ``` The `SUBDOMAIN` is required for Slack to send events to your bot via webhooks. ## Configuring Slack Events After deployment, configure your Request URLs in Slack: 1. **Event Subscriptions**: Enable and set URL to `https://my-slack-bot.shardweb.app/slack/events` 2. **Slash Commands**: Set URL to `https://my-slack-bot.shardweb.app/slack/events` ## Deploying Ensure you have: - Your bot code file - `package.json` or `requirements.txt` * `.shardcloud` Configure `SLACK_SIGNING_SECRET` and `SLACK_BOT_TOKEN` in the dashboard. Compress your project folder (excluding `node_modules/`). Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. Update Event Subscriptions and Slash Command URLs in your Slack app settings. ## Additional Resources * [Bolt for JavaScript](https://docs.slack.dev/tools/bolt-js/) * [Bolt for Python](https://docs.slack.dev/tools/bolt-python/) ## Troubleshooting * Verify your Request URL is correct - Ensure your app is running and accessible - Check that the signing secret matches Make sure your bot is running before verifying the URL in Slack. # How to Host Telegram Bots Source: https://docs.shardcloud.app/tutorials/bots/telegram Learn how to create and host Telegram bots on Shard Cloud with Node.js and Python examples. ## Introduction This guide covers creating and deploying Telegram bots on Shard Cloud. ## Creating a Telegram Bot Open Telegram and search for [@BotFather](https://t.me/botfather). Send `/newbot` and follow the prompts to name your bot. BotFather will provide your bot token. **Save it securely**. **Security**: Keep your bot token secret. Anyone with it can control your bot. ## Creating Your Bot ### Setup ```bash theme={null} npm init -y npm install node-telegram-bot-api ``` ### Basic Bot Code ```javascript index.js theme={null} const TelegramBot = require('node-telegram-bot-api'); const token = 'YOUR_BOT_TOKEN'; const bot = new TelegramBot(token, { polling: true }); bot.on('message', (msg) => { const chatId = msg.chat.id; if (msg.text === '/start') { bot.sendMessage(chatId, 'Hello! I am your bot.'); } else if (msg.text === '/ping') { bot.sendMessage(chatId, 'Pong!'); } }); console.log('Bot is running...'); ``` ### Package.json ```json package.json theme={null} { "name": "telegram-bot", "version": "1.0.0", "main": "index.js", "dependencies": { "node-telegram-bot-api": "^0.64.0" } } ``` ### Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=Telegram Bot DESCRIPTION=My Telegram Bot MAIN=index.js MEMORY=256 VERSION=recommended ``` ### Setup ```bash theme={null} pip install python-telegram-bot ``` ### Basic Bot Code ```python main.py theme={null} from telegram import Update from telegram.ext import Application, CommandHandler, ContextTypes TOKEN = 'YOUR_BOT_TOKEN' async def start(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text('Hello! I am your bot.') async def ping(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text('Pong!') def main(): app = Application.builder().token(TOKEN).build() app.add_handler(CommandHandler('start', start)) app.add_handler(CommandHandler('ping', ping)) print('Bot is running...') app.run_polling() if __name__ == '__main__': main() ``` ### Requirements.txt ```txt requirements.txt theme={null} python-telegram-bot ``` ### Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=Telegram Bot DESCRIPTION=My Telegram Bot MAIN=main.py MEMORY=256 VERSION=recommended ``` ## Deploying Ensure you have: * Your bot code file * `package.json` (Node.js) or `requirements.txt` (Python) * `.shardcloud` Remove: `node_modules/`, `__pycache__/`, `venv/` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Testing After deployment, open Telegram, find your bot, and send `/ping`. It should reply with "Pong!". ## Additional Resources * [Telegram Bot API](https://core.telegram.org/bots/api) * [python-telegram-bot Docs](https://docs.python-telegram-bot.org/) ## Troubleshooting * Verify your bot token is correct * Check that polling is enabled * Review logs in the dashboard Only one instance of your bot can use polling at a time. Stop other instances. # How to Host WhatsApp Bots Source: https://docs.shardcloud.app/tutorials/bots/whatsapp Learn how to create and host WhatsApp bots on Shard Cloud using whatsapp-web.js. ## Introduction This guide covers creating and deploying WhatsApp bots on Shard Cloud using the whatsapp-web.js library. WhatsApp bots work by connecting to WhatsApp Web. Your phone must stay connected to the internet for the bot to work. ## Creating Your Bot ### Setup ```bash theme={null} npm init -y npm install whatsapp-web.js qrcode ``` ### Basic Bot Code ```javascript index.js theme={null} const { Client, LocalAuth } = require('whatsapp-web.js'); const qrcode = require('qrcode'); const client = new Client({ authStrategy: new LocalAuth(), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-setuid-sandbox', ], }, }); client.on('qr', async (qr) => { try { await qrcode.toFile('./qrcode.png', qr); console.log('QR Code saved as qrcode.png'); } catch (err) { console.error('Error generating QR:', err); } }); client.on('ready', () => { console.log('WhatsApp client is ready!'); }); client.on('message', async (msg) => { if (msg.body === '!ping') { await msg.reply('Pong!'); } }); client.initialize(); ``` ### Package.json ```json package.json theme={null} { "name": "whatsapp-bot", "version": "1.0.0", "main": "index.js", "dependencies": { "whatsapp-web.js": "^1.23.0", "qrcode": "^1.5.0" } } ``` ## Authentication When you first run the bot, it will generate a QR code (`qrcode.png`). You need to: 1. Download the QR code from Shard Cloud's file manager 2. Scan it with WhatsApp on your phone (Settings β†’ Linked Devices β†’ Link a Device) 3. Once authenticated, the session is saved and you won't need to scan again The `LocalAuth` strategy saves the session in a `.wwebjs_auth` folder. This persists between restarts. ## Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=WhatsApp Bot DESCRIPTION=WhatsApp Bot with whatsapp-web.js MAIN=index.js MEMORY=1024 VERSION=recommended ``` WhatsApp bots require more memory due to Puppeteer. Use at least 512MB-1024MB. ## Deploying Ensure you have: * `index.js` * `package.json` * `.shardcloud` Remove: `node_modules/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. After first start, download the QR code from the file manager and scan with WhatsApp. ## Additional Resources Visit the [whatsapp-web.js documentation](https://wwebjs.dev/) for more information. ## Troubleshooting * Ensure Puppeteer has enough memory (1024MB+) * Check logs for Chromium errors * Ensure your phone stays connected to the internet * Keep the WhatsApp app open on your phone Make sure you're using the `--no-sandbox` and `--disable-setuid-sandbox` flags. # How to Host X (Twitter) Bots Source: https://docs.shardcloud.app/tutorials/bots/x-twitter Learn how to create and host X (Twitter) bots on Shard Cloud. ## Introduction This guide covers creating and deploying X (Twitter) bots on Shard Cloud. ## Creating an X App Go to [X Developer Portal](https://developer.x.com/en/portal/dashboard) and log in. Click **"Create Project"**, choose a name, and select your use case. Create an app within your project. In **"Keys and tokens"**, generate: - API Key (Consumer Key) - API Secret Key (Consumer Secret) - Access Token - Access Token Secret Go to **"App permissions"** and select **"Read and write"**. **Security**: Store all credentials securely. Never commit them to version control. ## Creating Your Bot ### Setup ```bash theme={null} npm init -y npm install twitter-api-v2 ``` ### Basic Bot Code ```javascript index.js theme={null} const { TwitterApi } = require("twitter-api-v2"); const client = new TwitterApi({ appKey: process.env.API_KEY, appSecret: process.env.API_SECRET_KEY, accessToken: process.env.ACCESS_TOKEN, accessSecret: process.env.ACCESS_TOKEN_SECRET, }); const rwClient = client.readWrite; async function verifyBot() { try { const user = await rwClient.currentUser(); console.log(`Bot initialized! User: @${user.screen_name}`); return true; } catch (error) { console.error("Error verifying bot:", error); return false; } } async function postTweet(text) { try { const tweet = await rwClient.v2.tweet(text); console.log(`Tweet posted! ID: ${tweet.data.id}`); return tweet; } catch (error) { console.error("Error posting tweet:", error); throw error; } } async function runBot() { console.log("Starting X bot..."); const botOk = await verifyBot(); if (!botOk) { console.error("Bot initialization failed"); return; } // Keep the bot running setInterval(() => { console.log("Bot is alive..."); }, 60000); } runBot(); ``` ### Package.json ```json package.json theme={null} { "name": "x-twitter-bot", "version": "1.0.0", "main": "index.js", "dependencies": { "twitter-api-v2": "^1.15.0" } } ``` ## Environment Variables Set these in the Shard Cloud dashboard: * `API_KEY`: Your X API key * `API_SECRET_KEY`: Your X API secret * `ACCESS_TOKEN`: Your access token * `ACCESS_TOKEN_SECRET`: Your access token secret ## Shard Cloud Configuration ```systemd .shardcloud theme={null} DISPLAY_NAME=X Twitter Bot DESCRIPTION=X/Twitter Automation Bot MAIN=index.js MEMORY=256 VERSION=recommended ``` ## Deploying Ensure you have: - `index.js` - `package.json` - `.shardcloud` Configure all API credentials in the dashboard. Compress your project folder (excluding `node_modules/`). Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources * [X API Documentation](https://docs.x.com/overview) * [twitter-api-v2 Library](https://github.com/PLhery/node-twitter-api-v2) ## Troubleshooting * Verify all four credentials are correct - Check that permissions are set to "Read and write" - Regenerate tokens if needed Implement rate limiting and reduce request frequency. # Welcome to Shard Cloud Tutorials Source: https://docs.shardcloud.app/tutorials/introduction Explore comprehensive tutorials for deploying your applications on Shard Cloud. From web frameworks to bots, we've got you covered. ## Available Tutorials Configure your own domain with SSL. Set up automatic deployments from GitHub. Host your own Lavalink music server. Run Puppeteer browser automation. Run Selenium automation scripts. Build and deploy Express.js REST APIs. Deploy high-performance Fastify applications. Host high-performance Go Gin APIs. Deploy Python Flask web applications. Host full-stack Django applications. Deploy React-based Next.js applications. Host React single-page applications. Deploy Vue.js applications. Host Vue-based Nuxt applications. Deploy Vite-powered applications. Host Angular applications. Deploy Astro static sites. Host Remix full-stack applications. Create and host Discord bots. Deploy Telegram bots. Host WhatsApp bots. Deploy Slack bots. Create X/Twitter bots. *** ## Getting Help Join our community on Discord to get help from other developers and share your experiences. Chat with developers, ask questions, and share feedback in our community Discord server. # How to Set Up Your Custom Domain Source: https://docs.shardcloud.app/tutorials/platform/custom-domain Learn how to configure a custom domain for your Shard Cloud application. ## Introduction Configure your own custom domain on Shard Cloud to give your application a professional appearance. We recommend using **Cloudflare** as your DNS provider for the best compatibility. ## Registering a Domain To use a custom domain, you must own a domain registered through a trusted registrar like: * Cloudflare Registrar * Namecheap * GoDaddy * Google Domains * Any other accredited registrar ## Setting Up DNS with Cloudflare We recommend using Cloudflare for DNS management due to its reliability and features. Go to [Cloudflare](https://cloudflare.com/), navigate to **Sites**, and click **"Add a site"**. After adding your domain, Cloudflare will provide nameservers. Update your domain registrar's nameserver settings to use Cloudflare's nameservers. DNS changes can take up to 24-48 hours to propagate, though it's usually much faster. ## Configuring Your Domain on Shard Cloud Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications), select your application, and go to **Settings**. Find the custom domain section and enter your domain (e.g., `example.com` or `app.example.com`). Save your changes. Shard Cloud will provide you with DNS records to configure. ## Configuring DNS Records In Cloudflare, add the following DNS records: ### CNAME Record | Type | Name | Target | | ----- | -------------- | -------------------- | | CNAME | @ or subdomain | `cname.shardweb.app` | ### TXT Record (Verification) | Type | Name | Value | | ---- | -------------- | ------------------------- | | TXT | @ or subdomain | (provided by Shard Cloud) | If using a subdomain like `app.example.com`, use `app` as the name instead of `@`. ## Redirecting www to Your Domain To redirect `www.example.com` to `example.com`: Add an **A record** with: - Name: `www` - IP: `192.0.2.1` (Cloudflare's placeholder IP) In Cloudflare, go to **Rules** β†’ **Page Rules** and create: - URL: `www.example.com/*` - Setting: **Forwarding URL** (301 - Permanent Redirect) * Destination: `https://example.com/$1` ## SSL/HTTPS Shard Cloud automatically provisions SSL certificates for your custom domain. HTTPS will be available shortly after DNS verification. ## Troubleshooting * Clear your browser cache - Wait 60 seconds and try again - Verify DNS records are correct in Cloudflare Your domain is not configured correctly. Double-check that: - CNAME record points to `cname.shardweb.app` - TXT record for verification is added - DNS has propagated (use [dnschecker.org](https://dnschecker.org)) Wait up to 24 hours for SSL certificate provisioning. If issues persist, contact support. ## Need Help? If you continue having problems, [contact our support team](https://discord.gg/jjdYayFu5Q). # How to Set Up Git Integration Source: https://docs.shardcloud.app/tutorials/platform/git-integration Configure automatic deployments from GitHub to Shard Cloud. ## Introduction Git integration allows you to automatically deploy your application whenever you push changes to your GitHub repository. Shard Cloud offers two methods to set this up. *** ## Method 1: GitHub Integration (Recommended) This is the easiest and preferred method. Connect your GitHub account once and select repositories for each app. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash) and navigate to **Config** β†’ **Integrations**. Click **"Connect with GitHub"** and authorize Shard Cloud to access your repositories. Go to your application in the dashboard and navigate to the **Deploys** section. Select the repository you want to connect and choose the branch to deploy from. Everything else is handled automatically by our backend. Push to your connected branch and your app will redeploy. This method is simpler because you don't need to manage tokens or webhooks manually. Shard Cloud handles everything for you. *** ## Method 2: Manual Webhook Setup If you prefer more control or need to use a personal access token, you can set up webhooks manually. Go to [GitHub Personal Access Tokens](https://github.com/settings/tokens) and click **"Generate new token (classic)"**. Configure the following: - **Note**: Give it a descriptive name (e.g., "Shard Cloud Deploy") - **Expiration**: Set to "No expiration" to avoid interruptions - **Scopes**: Select only **"repo"** (full control of private repositories) Click **"Generate token"** and **copy it immediately** (you won't see it again). Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and select your application. Navigate to the **Deploy** section, paste your GitHub token, and click **Save**. A **webhook URL** will be generated. **Copy this URL** for the next step. Go to your repository on GitHub and navigate to **Settings** β†’ **Webhooks**. Click **"Add webhook"** and configure: - **Payload URL**: Paste the webhook URL from Shard Cloud - **Content type**: `application/json` - **Events**: Select "Just the push event" Click **"Add webhook"**. Make a change to your code, commit, and push to the `main` or `master` branch. Your application should automatically redeploy. Automatic deployments only trigger on pushes to the `main` or `master` branch. *** ## Monitoring Deployments After each push: 1. Go to your application in the Shard Cloud dashboard 2. Check the **Deployments** or **Logs** section 3. Verify the deployment completed successfully ## Best Practices Deploy from a stable branch like `main` or `master`. Always test changes locally before pushing. Use environment variables for sensitive data. Check deployment logs after each push. ## Troubleshooting Ensure you've authorized Shard Cloud to access your repositories. Try disconnecting and reconnecting your GitHub account. Check that the repository is not private without proper permissions. Check that the webhook URL is correct. Verify the GitHub token has the correct permissions. Look at webhook delivery logs in GitHub (Settings β†’ Webhooks β†’ Recent Deliveries). Check the deployment logs in Shard Cloud. Ensure your `.shardcloud` config is valid. Verify all required files are in the repository. Generate a new token and update it in Shard Cloud. Consider using tokens without expiration. # How to Host a Lavalink Server Source: https://docs.shardcloud.app/tutorials/platform/lavalink Learn how to create and host your own Lavalink music server on Shard Cloud. ## Introduction Lavalink is a standalone audio sending node for Discord bots. It allows you to stream high-quality music to Discord without consuming your bot's resources. ## Downloading Lavalink Download the latest Lavalink release from the [official GitHub releases](https://github.com/lavalink-devs/Lavalink/releases). Download the `Lavalink.jar` file. Create an `application.yml` file with your Lavalink configuration. ## Configuration File Create an `application.yml` file: ```yaml application.yml theme={null} server: port: 80 address: 0.0.0.0 lavalink: server: password: "your-secure-password-here" sources: youtube: true bandcamp: true soundcloud: true twitch: true vimeo: true http: true local: false bufferDurationMs: 400 frameBufferDurationMs: 5000 youtubePlaylistLoadLimit: 6 playerUpdateInterval: 5 youtubeSearchEnabled: true soundcloudSearchEnabled: true gc-warnings: true logging: file: path: ./logs/ level: root: INFO lavalink: INFO ``` **Important**: Set the `port` to `80` for Shard Cloud hosting. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Lavalink Server DESCRIPTION=Lavalink Audio Server MAIN=Lavalink.jar MEMORY=1024 VERSION=recommended SUBDOMAIN=my-lavalink ``` The `SUBDOMAIN` gives you a URL like `my-lavalink.shardweb.app` to connect your bot. ## Deploying Create a folder with: - `Lavalink.jar` - `application.yml` - `.shardcloud` Compress the folder into a `.zip` file. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload your ZIP file. ## Connecting Your Bot When connecting to your Lavalink server from your Discord bot: * **Host**: `my-lavalink.shardweb.app` * **Port**: `443` (SSL/HTTPS) * **Password**: Your configured password * **Secure**: `true` ### Example Connection (discord.js + Shoukaku) ```javascript theme={null} const { Shoukaku, Connectors } = require("shoukaku"); const nodes = [ { name: "main", url: "my-lavalink.shardweb.app:443", auth: "your-secure-password-here", secure: true, }, ]; const shoukaku = new Shoukaku(new Connectors.DiscordJS(client), nodes); ``` ### Example Connection (discord.py + wavelink) ```python theme={null} import wavelink node = wavelink.Node( uri='https://my-lavalink.shardweb.app:443', password='your-secure-password-here' ) ``` Always use port **443** and `secure: true` when connecting to your Lavalink on Shard Cloud. ## Additional Resources * [Lavalink GitHub](https://github.com/lavalink-devs/Lavalink) * [Lavalink Documentation](https://lavalink.dev/) ## Troubleshooting * Verify the password matches - Use port 443 with secure/SSL enabled - Check that your Lavalink server is running Increase the `MEMORY` value in your `.shardcloud` config (minimum 512MB recommended). Check your `application.yml` to ensure the required sources are enabled. # How to Host Puppeteer Applications Source: https://docs.shardcloud.app/tutorials/platform/puppeteer Learn how to run Puppeteer browser automation scripts on Shard Cloud. ## Introduction Puppeteer is a Node.js library that provides a high-level API to control Chrome/Chromium. This guide covers deploying Puppeteer scripts on Shard Cloud. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Installing Dependencies ```bash theme={null} npm init -y npm install puppeteer ``` ### Basic Puppeteer Script Create an `index.js` file: ```javascript index.js theme={null} const puppeteer = require('puppeteer'); async function run() { const browser = await puppeteer.launch({ headless: 'new', args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-gpu' ] }); const page = await browser.newPage(); await page.setViewport({ width: 1920, height: 1080 }); try { // Navigate to a page await page.goto('https://example.com'); console.log('Page title:', await page.title()); // Take a screenshot await page.screenshot({ path: 'screenshot.png' }); console.log('Screenshot saved!'); } catch (error) { console.error('Error:', error); } finally { await browser.close(); } } run(); ``` The `--no-sandbox` and `--disable-setuid-sandbox` flags are required for Puppeteer to work in containerized environments. ### Package.json Configuration ```json package.json theme={null} { "name": "puppeteer-app", "version": "1.0.0", "main": "index.js", "scripts": { "start": "node index.js" }, "dependencies": { "puppeteer": "^21.0.0" } } ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Puppeteer Bot DESCRIPTION=Browser Automation with Puppeteer MAIN=index.js MEMORY=1024 VERSION=recommended ``` Puppeteer applications require at least 512MB-1024MB of memory due to the browser overhead. ## Continuous Screenshot Example ```javascript index.js theme={null} const puppeteer = require('puppeteer'); async function continuousScreenshots() { const browser = await puppeteer.launch({ headless: 'new', args: [ '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage' ] }); const page = await browser.newPage(); await page.setViewport({ width: 1920, height: 1080 }); await page.goto('https://example.com'); // Take screenshots every minute setInterval(async () => { try { await page.screenshot({ path: 'latest.png' }); console.log('Screenshot updated at', new Date().toISOString()); } catch (error) { console.error('Screenshot error:', error); } }, 60000); console.log('Puppeteer running...'); } continuousScreenshots(); ``` ## Web Scraping Example ```javascript scraper.js theme={null} const puppeteer = require('puppeteer'); async function scrape(url) { const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); try { await page.goto(url, { waitUntil: 'networkidle2' }); // Extract data const data = await page.evaluate(() => { return { title: document.title, heading: document.querySelector('h1')?.textContent, links: Array.from(document.querySelectorAll('a')).map(a => a.href).slice(0, 10) }; }); console.log('Scraped data:', data); return data; } catch (error) { console.error('Scraping error:', error); } finally { await browser.close(); } } scrape('https://example.com'); ``` ## PDF Generation Example ```javascript pdf.js theme={null} const puppeteer = require('puppeteer'); async function generatePDF(url, outputPath) { const browser = await puppeteer.launch({ headless: 'new', args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); await page.goto(url, { waitUntil: 'networkidle2' }); await page.pdf({ path: outputPath, format: 'A4', printBackground: true }); console.log('PDF saved to', outputPath); await browser.close(); } generatePDF('https://example.com', 'page.pdf'); ``` ## Deploying Ensure you have: * `index.js` (or your script) * `package.json` * `.shardcloud` Remove: `node_modules/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Accessing Output Files Screenshots and PDFs saved by your script can be downloaded from Shard Cloud's file manager in the dashboard. ## Additional Resources * [Puppeteer Documentation](https://pptr.dev/) * [Puppeteer API Reference](https://pptr.dev/api) ## Troubleshooting * Ensure headless mode is enabled * Add all required flags (`--no-sandbox`, `--disable-setuid-sandbox`, `--disable-dev-shm-usage`) * Increase memory allocation to at least 1024MB * Increase the timeout in `page.goto()` options * Use `waitUntil: 'networkidle2'` for dynamic pages * Close browser instances after each task * Increase `MEMORY` in your config * Avoid keeping multiple pages open # How to Host Selenium Applications Source: https://docs.shardcloud.app/tutorials/platform/selenium Learn how to run Selenium browser automation scripts on Shard Cloud. ## Introduction Selenium is a powerful tool for automating web browsers. This guide covers deploying Selenium scripts on Shard Cloud using Python. ## Creating Your Project Ensure you have **Python** and **pip** installed. ### Installing Dependencies ```bash theme={null} pip install selenium ``` ### Basic Selenium Script Create a `main.py` file: ```python main.py theme={null} import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options # Chrome options for headless operation options = Options() options.add_argument("--headless") options.add_argument("--no-sandbox") options.add_argument("--disable-dev-shm-usage") options.add_argument("--disable-gpu") # Initialize the driver service = Service('/usr/bin/chromedriver') driver = webdriver.Chrome(service=service, options=options) # Set window size driver.set_window_size(1920, 1080) try: # Navigate to a page driver.get('https://www.google.com') print(f"Page title: {driver.title}") # Take a screenshot driver.save_screenshot('screenshot.png') print("Screenshot saved!") # Keep running and take screenshots periodically while True: driver.save_screenshot('page.png') print("Screenshot updated") time.sleep(60) except Exception as e: print(f"Error: {e}") finally: driver.quit() ``` ### Requirements File Create a `requirements.txt`: ```txt requirements.txt theme={null} selenium ``` The Chrome options `--no-sandbox` and `--disable-dev-shm-usage` are required for Selenium to work in containerized environments. ## Chrome/Chromium Path On Shard Cloud, Chromium is installed at `/usr/bin/chromium` and ChromeDriver at `/usr/bin/chromedriver`. The WebDriver can locate these automatically. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Selenium Bot DESCRIPTION=Browser Automation Script MAIN=main.py MEMORY=1024 VERSION=recommended ``` Selenium applications typically require at least 512MB-1024MB of memory due to the browser overhead. ## Advanced Example: Web Scraping ```python scraper.py theme={null} import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC def setup_driver(): options = Options() options.add_argument("--headless") options.add_argument("--no-sandbox") options.add_argument("--disable-dev-shm-usage") options.add_argument("--disable-gpu") options.add_argument("--window-size=1920,1080") service = Service('/usr/bin/chromedriver') return webdriver.Chrome(service=service, options=options) def scrape_page(url): driver = setup_driver() try: driver.get(url) # Wait for an element to load wait = WebDriverWait(driver, 10) element = wait.until( EC.presence_of_element_located((By.TAG_NAME, "body")) ) # Get page content title = driver.title content = driver.page_source print(f"Title: {title}") print(f"Content length: {len(content)} characters") return content except Exception as e: print(f"Error: {e}") return None finally: driver.quit() if __name__ == "__main__": url = "https://example.com" result = scrape_page(url) ``` ## Deploying Ensure you have: - `main.py` (or your script) - `requirements.txt` - `.shardcloud` Remove: `__pycache__/`, `venv/`, `*.pyc` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Accessing Screenshots Screenshots saved by your script can be downloaded from Shard Cloud's file manager in the dashboard. ## Additional Resources * [Selenium Documentation](https://www.selenium.dev/documentation/) * [Selenium Python Bindings](https://selenium-python.readthedocs.io/) ## Troubleshooting * Ensure you're using headless mode - Add `--disable-dev-shm-usage` flag - Increase memory allocation * Use WebDriverWait for dynamic content - Verify the selector is correct - Take a screenshot to debug the page state Close the driver after each task and increase the `MEMORY` value in your config. # How to Host Angular Applications Source: https://docs.shardcloud.app/tutorials/website/angular Learn how to deploy Angular applications on Shard Cloud. ## Introduction This guide covers deploying Angular applications on Shard Cloud. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Installing Angular CLI ```bash theme={null} npm install -g @angular/cli ``` ### Creating a New Project ```bash theme={null} ng new my-angular-app cd my-angular-app ``` ## Building Your Project Build the production output: ```bash theme={null} ng build --configuration production ``` This creates a `dist/` folder with optimized files. ## Serving Your Angular App Angular apps are static files that need a server: ### Using serve ```bash theme={null} npm install serve ``` ### Using Express Create a `server.js` file: ```javascript server.js theme={null} const express = require('express'); const path = require('path'); const app = express(); const distPath = path.join(__dirname, 'dist', 'my-angular-app', 'browser'); app.use(express.static(distPath)); app.get('*', (req, res) => { res.sendFile(path.join(distPath, 'index.html')); }); app.listen(80, () => { console.log('Server running on port 80'); }); ``` Replace `my-angular-app` with your actual project name in the path. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Angular App DESCRIPTION=Angular Application LANGUAGE=node MEMORY=1024 VERSION=recommended SUBDOMAIN=my-angular-app CUSTOM_COMMAND=npm run build && npx serve -s dist/my-angular-app/browser -l 80 ``` ## Deploying Run `ng build --configuration production`. Ensure you have: * Source files * `package.json` * `.shardcloud` * `angular.json` Remove: `node_modules/`, `dist/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Angular documentation](https://angular.dev/) for more information. ## Troubleshooting Increase `MEMORY` to at least 1024MB for Angular builds. Ensure your server serves `index.html` for all routes. # How to Host Astro Applications Source: https://docs.shardcloud.app/tutorials/website/astro Learn how to deploy Astro applications on Shard Cloud. ## Introduction This guide covers deploying Astro applications on Shard Cloud. Astro is a modern static site generator with optional server-side rendering. ## Creating Your Project Ensure you have **Node.js** (16+) and **npm** installed. ### Creating a New Astro Project ```bash theme={null} npm create astro@latest cd my-astro-site npm install ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates a `dist/` folder with static files. ## Serving Your Astro Site ### Static Sites (Default) For static Astro sites, use serve: ```systemd .shardcloud theme={null} DISPLAY_NAME=Astro Site DESCRIPTION=Astro Static Site LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-astro-site CUSTOM_COMMAND=npm run build && npx serve -s dist -l 80 ``` ### SSR Mode For server-side rendering with Node.js adapter: 1. Install the Node adapter: ```bash theme={null} npx astro add node ``` 2. Configure `astro.config.mjs`: ```javascript astro.config.mjs theme={null} import { defineConfig } from 'astro/config'; import node from '@astrojs/node'; export default defineConfig({ output: 'server', adapter: node({ mode: 'standalone' }), server: { port: 80, host: true } }); ``` 3. Shard Cloud config: ```systemd .shardcloud theme={null} DISPLAY_NAME=Astro SSR Site DESCRIPTION=Astro Server-Rendered Site LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-astro-ssr CUSTOM_COMMAND=npm run build && node dist/server/entry.mjs ``` ## Deploying Run `npm run build`. Ensure you have: * `src/` folder * `package.json` * `.shardcloud` * `astro.config.mjs` Remove: `node_modules/`, `dist/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Astro documentation](https://docs.astro.build/) for more information. ## Troubleshooting Check for component syntax errors and ensure all dependencies are installed. Verify the Node adapter is properly configured and the output mode is set to 'server'. # How to Host Next.js Applications Source: https://docs.shardcloud.app/tutorials/website/nextjs Learn how to deploy Next.js applications on Shard Cloud. ## Introduction This guide covers deploying Next.js applications on Shard Cloud. Next.js is a React framework for production-grade applications with server-side rendering and static site generation. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Creating a New Next.js Project ```bash theme={null} npx create-next-app@latest my-next-app cd my-next-app ``` ### Configuring Port 80 Update `package.json` to use port 80: ```json package.json theme={null} { "name": "my-next-app", "version": "0.1.0", "scripts": { "dev": "next dev", "build": "next build", "start": "next start -p 80", "lint": "next lint" }, "dependencies": { "next": "14.0.0", "react": "^18", "react-dom": "^18" } } ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates the `.next` folder with optimized production files. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Next.js Website DESCRIPTION=React-based Next.js Application MAIN=package.json MEMORY=1024 VERSION=recommended SUBDOMAIN=my-nextjs-site CUSTOM_COMMAND=npm run build && npm run start ``` Next.js applications typically require at least 512MB-1024MB of memory for the build process. ## Deploying Run `npm run build` to verify your build works. Ensure you have: * All source files (`pages/`, `app/`, `components/`, etc.) * `package.json` * `.shardcloud` * `next.config.js` (if applicable) Remove: * `node_modules/` * `.next/cache/` * `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Next.js documentation](https://nextjs.org/docs) for more information. ## Troubleshooting Increase `MEMORY` in your `.shardcloud` configuration to at least 1024MB. * Verify your pages are in the correct directory (`pages/` or `app/`) * Check that dynamic routes are properly configured Ensure API routes are in `pages/api/` or `app/api/` directory. # How to Host Nuxt Applications Source: https://docs.shardcloud.app/tutorials/website/nuxt Learn how to deploy Nuxt applications on Shard Cloud. ## Introduction This guide covers deploying Nuxt applications on Shard Cloud. Nuxt is a Vue.js framework for server-side rendering and static site generation. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Creating a New Nuxt Project ```bash theme={null} npx nuxi init my-nuxt-app cd my-nuxt-app npm install ``` ### Development Server ```bash theme={null} npm run dev ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates the `.output` folder with the server and static files. ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Nuxt App DESCRIPTION=Nuxt.js Application MAIN=.output/server/index.mjs MEMORY=512 VERSION=recommended SUBDOMAIN=my-nuxt-app ``` The main file for Nuxt 3 is `.output/server/index.mjs` after building. ## Deploying Run `npm run build` to generate the `.output` folder. Ensure you have: * `.output/` folder (after build) * `package.json` * `.shardcloud` Remove: `node_modules/`, `.nuxt/`, `package-lock.json` Compress your project folder including the `.output` folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Alternative: Build on Deploy If you prefer to build on the server: ```systemd .shardcloud theme={null} DISPLAY_NAME=Nuxt App DESCRIPTION=Nuxt.js Application LANGUAGE=node MEMORY=1024 VERSION=recommended SUBDOMAIN=my-nuxt-app CUSTOM_COMMAND=npm run build && node .output/server/index.mjs ``` Building on deploy requires more memory. Use at least 1024MB. ## Additional Resources Visit the [official Nuxt documentation](https://nuxt.com/docs) for more information. ## Troubleshooting * Ensure all dependencies are in `package.json` * Check for TypeScript errors * Increase memory if needed Verify the `.output` folder was created and contains `server/index.mjs`. # How to Host Phoenix Applications Source: https://docs.shardcloud.app/tutorials/website/phoenix Learn how to deploy Elixir Phoenix applications on Shard Cloud. ## Introduction This guide covers deploying Phoenix applications on Shard Cloud. Phoenix is a web framework for Elixir that delivers fast, fault-tolerant applications with real-time capabilities. ## Creating Your Project Ensure you have **Elixir** and **Phoenix** installed. ### Creating a New Phoenix Project ```bash theme={null} mix phx.new my_phoenix_app cd my_phoenix_app ``` ### Basic Application Structure Your Phoenix application should have this structure: ``` my_phoenix_app/ β”œβ”€β”€ lib/ β”‚ β”œβ”€β”€ my_phoenix_app/ β”‚ └── my_phoenix_app_web/ β”œβ”€β”€ config/ β”œβ”€β”€ priv/ β”œβ”€β”€ assets/ β”œβ”€β”€ mix.exs └── .shardcloud ``` ### Configuring Port 80 Update `config/runtime.exs` to use port 80: ```elixir config/runtime.exs theme={null} config :my_phoenix_app, MyPhoenixAppWeb.Endpoint, http: [ip: {0, 0, 0, 0}, port: 80], server: true ``` Or configure via environment variable: ```elixir config/runtime.exs theme={null} config :my_phoenix_app, MyPhoenixAppWeb.Endpoint, http: [ip: {0, 0, 0, 0}, port: String.to_integer(System.get_env("PORT") || "80")], server: true ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Phoenix Website DESCRIPTION=Elixir Phoenix Application MAIN=mix.exs MEMORY=512 VERSION=recommended SUBDOMAIN=my-phoenix-site CUSTOM_COMMAND=mix phx.server ``` The `CUSTOM_COMMAND=mix phx.server` is required to start Phoenix in server mode. ## Deploying Run `mix phx.server` to verify your application works locally. Ensure you have: * All source files (`lib/`, `config/`, `priv/`) * `mix.exs` * `.shardcloud` * `assets/` folder (if using frontend assets) Remove: * `_build/` * `deps/` * `.elixir_ls/` * `node_modules/` (if present in assets) Zip the entire Phoenix application folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Database Configuration If your Phoenix app uses a database, configure it in `config/runtime.exs`: ```elixir config/runtime.exs theme={null} config :my_phoenix_app, MyPhoenixApp.Repo, url: System.get_env("DATABASE_URL"), pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10") ``` Set the `DATABASE_URL` environment variable in your Shard Cloud dashboard. ## Additional Resources Visit the [official Phoenix documentation](https://hexdocs.pm/phoenix/overview.html) for more information. ## Troubleshooting * Ensure `CUSTOM_COMMAND=mix phx.server` is set in `.shardcloud` * Verify port 80 is configured in `config/runtime.exs` * Check that `server: true` is set in your endpoint config * Make sure `mix.exs` includes all required dependencies * Remove `deps/` folder before uploading (Shard Cloud will fetch them) * Ensure `assets/` folder is included in your ZIP * Run `mix assets.deploy` locally before uploading for production assets * Verify `DATABASE_URL` environment variable is set in dashboard * Check database credentials and connection string format # How to Host Ruby on Rails Applications Source: https://docs.shardcloud.app/tutorials/website/rails Learn how to deploy Ruby on Rails applications on Shard Cloud. ## Introduction This guide covers deploying Ruby on Rails applications on Shard Cloud. Rails is a full-stack web framework for Ruby that emphasizes convention over configuration and rapid development. ## Creating Your Project Ensure you have **Ruby** and **Rails** installed. ### Creating a New Rails Project ```bash theme={null} rails new my_rails_app cd my_rails_app ``` ### Basic Application Structure Your Rails application should have this structure: ``` my_rails_app/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ controllers/ β”‚ β”œβ”€β”€ models/ β”‚ └── views/ β”œβ”€β”€ bin/ β”œβ”€β”€ config/ β”œβ”€β”€ db/ β”œβ”€β”€ lib/ β”œβ”€β”€ public/ β”œβ”€β”€ Gemfile └── .shardcloud ``` ### Configuring Port 80 Update `config/puma.rb` to use port 80: ```ruby config/puma.rb theme={null} port ENV.fetch("PORT") { 80 } ``` Or bind to all interfaces: ```ruby config/puma.rb theme={null} bind "tcp://0.0.0.0:#{ENV.fetch('PORT') { 80 }}" ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Rails Website DESCRIPTION=Ruby on Rails Application MAIN=Gemfile MEMORY=512 VERSION=recommended SUBDOMAIN=my-rails-site CUSTOM_COMMAND=chmod +x bin/rails && bin/rails server -b 0.0.0.0 ``` The `CUSTOM_COMMAND` makes the Rails binary executable and starts the server bound to all interfaces. ## Deploying Run `bin/rails server` to verify your application works locally. Ensure you have: * All source files (`app/`, `config/`, `db/`, `lib/`, `public/`) * `bin/` folder (contains Rails executables) * `Gemfile` * `.shardcloud` Remove: * `vendor/bundle/` * `.bundle/` * `tmp/` * `log/` * `node_modules/` (if present) Zip the entire Rails application folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Database Configuration If your Rails app uses a database, configure it in `config/database.yml`: ```yaml config/database.yml theme={null} production: adapter: postgresql url: <%= ENV['DATABASE_URL'] %> pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> ``` Set the `DATABASE_URL` environment variable in your Shard Cloud dashboard. ### Running Migrations You can run migrations by updating your custom command: ```systemd .shardcloud theme={null} CUSTOM_COMMAND=chmod +x bin/rails && bin/rails db:migrate && bin/rails server -b 0.0.0.0 ``` ## Additional Resources Visit the [official Rails documentation](https://guides.rubyonrails.org/) for more information. ## Troubleshooting The `chmod +x bin/rails` in CUSTOM\_COMMAND should fix this. Make sure the `bin/` folder is included in your ZIP. * Make sure `Gemfile` includes all required gems * Remove `vendor/bundle/` folder before uploading (Shard Cloud will install gems) * Precompile assets before uploading: `bin/rails assets:precompile` * Or add to CUSTOM\_COMMAND: `bin/rails assets:precompile && bin/rails server -b 0.0.0.0` * Verify `DATABASE_URL` environment variable is set in dashboard * Ensure `config/database.yml` reads from environment variables * Ensure `-b 0.0.0.0` is included to bind to all interfaces * Check that port 80 is configured in `config/puma.rb` # How to Host React Applications Source: https://docs.shardcloud.app/tutorials/website/react Learn how to deploy React applications on Shard Cloud. ## Introduction This guide covers deploying React single-page applications (SPAs) on Shard Cloud. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Creating a New React Project ```bash theme={null} npx create-react-app my-react-app cd my-react-app ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates a `build/` folder with optimized static files. ## Serving Your React App React apps are static files that need a server. You can use the `serve` package: ### Option 1: Using serve Install serve: ```bash theme={null} npm install serve ``` Update `package.json`: ```json package.json theme={null} { "scripts": { "start": "serve -s build -l 80" } } ``` ### Option 2: Using Express Create a `server.js` file: ```javascript server.js theme={null} const express = require('express'); const path = require('path'); const app = express(); app.use(express.static(path.join(__dirname, 'build'))); app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); app.listen(80, () => { console.log('Server running on port 80'); }); ``` Add express to dependencies: ```bash theme={null} npm install express ``` ## Shard Cloud Configuration Create a `.shardcloud` file: **Using serve:** ```systemd .shardcloud theme={null} DISPLAY_NAME=React App DESCRIPTION=React Single Page Application LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-react-app CUSTOM_COMMAND=npm run build && npx serve -s build -l 80 ``` **Using Express:** ```systemd .shardcloud theme={null} DISPLAY_NAME=React App DESCRIPTION=React Single Page Application MAIN=server.js MEMORY=512 VERSION=recommended SUBDOMAIN=my-react-app CUSTOM_COMMAND=npm run build && node server.js ``` ## Deploying Run `npm run build` locally to test. Ensure you have: * `src/` folder * `public/` folder * `package.json` * `.shardcloud` * `server.js` (if using Express) Remove: `node_modules/`, `build/` (will be rebuilt), `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official React documentation](https://react.dev/) for more information. ## Troubleshooting * Check that `homepage` in `package.json` is set correctly or removed * Verify the build folder is being served correctly Ensure your server is configured to serve `index.html` for all routes (SPA routing). # How to Host Remix Applications Source: https://docs.shardcloud.app/tutorials/website/remix Learn how to deploy Remix applications on Shard Cloud. ## Introduction This guide covers deploying Remix applications on Shard Cloud. Remix is a full-stack React framework with server-side rendering. ## Creating Your Project Ensure you have **Node.js** (18+) and **npm** installed. ### Creating a New Remix Project ```bash theme={null} npx create-remix@latest my-remix-app cd my-remix-app npm install ``` Select the **Node.js server** deployment target for Shard Cloud. ### Basic Route Example Create a route in `app/routes/_index.tsx`: ```tsx app/routes/_index.tsx theme={null} export default function Index() { return

Hello from Remix!

; } ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Remix App DESCRIPTION=Remix Full-Stack Application LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-remix-app CUSTOM_COMMAND=npm run build && npm run start ``` Make sure your `package.json` has the start script configured for port 80: ```json package.json theme={null} { "scripts": { "build": "remix vite:build", "start": "PORT=80 remix-serve build/server/index.js" } } ``` Or configure the port in the start command: ```systemd .shardcloud theme={null} CUSTOM_COMMAND=npm run build && PORT=80 npx remix-serve build/server/index.js ``` ## Deploying Run `npm run build` to verify the build works. Ensure you have: * `app/` folder * `package.json` * `.shardcloud` * `vite.config.ts` or `remix.config.js` Remove: `node_modules/`, `build/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Remix documentation](https://remix.run/docs) for more information. ## Troubleshooting * Check for TypeScript errors * Verify all route files are valid Ensure you're using port 80 as specified in the configuration. # How to Host Vite Applications Source: https://docs.shardcloud.app/tutorials/website/vite Learn how to deploy Vite applications on Shard Cloud. ## Introduction This guide covers deploying Vite-powered applications on Shard Cloud. Vite is a fast build tool that supports React, Vue, Svelte, and vanilla JavaScript. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Creating a New Vite Project ```bash theme={null} npm create vite@latest my-vite-app cd my-vite-app npm install ``` Choose your preferred template: `vanilla`, `vue`, `react`, `svelte`, etc. ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates a `dist/` folder with optimized static files. ## Serving Your Vite App Vite outputs static files that need a server: ### Using serve ```bash theme={null} npm install serve ``` Update `package.json`: ```json package.json theme={null} { "scripts": { "build": "vite build", "preview": "vite preview", "serve": "serve -s dist -l 80" } } ``` ### Using Express Create a `server.js` file: ```javascript server.js theme={null} const express = require('express'); const path = require('path'); const app = express(); app.use(express.static(path.join(__dirname, 'dist'))); app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'dist', 'index.html')); }); app.listen(80, () => { console.log('Server running on port 80'); }); ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Vite App DESCRIPTION=Vite-powered Application LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-vite-app CUSTOM_COMMAND=npm run build && npx serve -s dist -l 80 ``` ## Deploying Run `npm run build` to generate the `dist` folder. Ensure you have: * Source files * `package.json` * `.shardcloud` * `vite.config.js` Remove: `node_modules/`, `dist/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Vite documentation](https://vitejs.dev/) for more information. ## Troubleshooting * Check for syntax errors in your code * Verify all imports are correct Check your `base` configuration in `vite.config.js` if using a subdirectory. # How to Host Vue Applications Source: https://docs.shardcloud.app/tutorials/website/vue Learn how to deploy Vue.js applications on Shard Cloud. ## Introduction This guide covers deploying Vue.js applications on Shard Cloud. ## Creating Your Project Ensure you have **Node.js** and **npm** installed. ### Creating a New Vue Project ```bash theme={null} npm create vue@latest cd my-vue-app npm install ``` ## Building Your Project Build the production output: ```bash theme={null} npm run build ``` This creates a `dist/` folder with optimized static files. ## Serving Your Vue App Vue apps are static files that need a server: ### Using serve Update `package.json`: ```json package.json theme={null} { "scripts": { "build": "vite build", "serve": "serve -s dist -l 80" }, "dependencies": { "serve": "^14.0.0" } } ``` ### Using Express Create a `server.js` file: ```javascript server.js theme={null} const express = require('express'); const path = require('path'); const app = express(); app.use(express.static(path.join(__dirname, 'dist'))); app.get('*', (req, res) => { res.sendFile(path.join(__dirname, 'dist', 'index.html')); }); app.listen(80, () => { console.log('Server running on port 80'); }); ``` ## Shard Cloud Configuration Create a `.shardcloud` file: ```systemd .shardcloud theme={null} DISPLAY_NAME=Vue App DESCRIPTION=Vue.js Application LANGUAGE=node MEMORY=512 VERSION=recommended SUBDOMAIN=my-vue-app CUSTOM_COMMAND=npm run build && npx serve -s dist -l 80 ``` ## Deploying Run `npm run build` locally to test. Ensure you have: * `src/` folder * `public/` folder * `package.json` * `.shardcloud` * `vite.config.js` Remove: `node_modules/`, `dist/`, `package-lock.json` Compress your project folder. Go to [Shard Cloud Dashboard](https://shardcloud.app/dash/applications) and upload. ## Additional Resources Visit the [official Vue documentation](https://vuejs.org/) for more information. ## Troubleshooting * Check for TypeScript or ESLint errors * Verify all dependencies are installed Configure Vue Router to use history mode and ensure server serves `index.html` for all routes. # VPS Services Source: https://docs.shardcloud.app/vps ShardCloud provides fully managed Virtual Private Servers with SSH access, automated backups, and real-time monitoring. ## Supported Linux Distributions Choose from our pre-configured Linux distributions optimized for performance and security. Latest LTS releases Stable and testing RHEL-compatible Enterprise-grade Linux ### Distribution Details * **Ubuntu**: Popular choice for web applications and development * **Debian**: Rock-solid stability for production environments * **AlmaLinux**: Community-driven RHEL alternative * **Rocky Linux**: Enterprise-level support and long-term stability ## SSH Access All VPS instances are accessible via SSH only for maximum security. ### Secure Connection * **Dedicated IP**: Each VPS receives a unique dedicated IP address * **Root access**: Full control over your server * **Password authentication**: Secure password provided at creation * **Custom port support**: Change SSH port as needed ### Connection Process Receive root credentials upon creation Use SSH client with provided credentials Change your root password after first login ```bash theme={null} # Example SSH connection ssh root@your-vps-ip ``` ## Real-Time Metrics Monitor your VPS performance with live metrics displayed in your dashboard: RX/TX and total traffic RAM and vCPU utilization **Available Metrics:** * vCPU usage * RAM usage * Network RX (received) * Network TX (transmitted) * Total network RX * Total network TX ## Backups Create and restore full system backups with one click. ### Backup Features * **One-click creation**: Instant full system backup * **2 free backups per VPS**: Automatic rotation of oldest backups * **Easy restoration**: One-click restore process * **Secure storage**: Encrypted backup storage * **Zero downtime**: Create backups without stopping your VPS ### Backup Process Click backup button in dashboard Full system image saved automatically Select backup and click restore Restoring a backup will replace all current data on your VPS. Ensure you have recent backups before making major changes. ## Security ### Built-in Security Features * **SSH-only access**: No web-based access panels * **Dedicated IP**: Isolated network access * **Password protection**: Secure root password provided ### Best Practices * Change your root password after first login * Keep your password secure * Regularly update your system packages * Create regular backups before system changes ## Getting Started Choose distribution, resources, and configuration Get your root password SSH into your new VPS Set up your applications and services Create your first backup ## Resource Plans Choose the right resources for your workload: * **vCPU**: 1-12 cores * **RAM**: 4GB-32GB * **Storage**: 20GB-500GB SSD ## Support Need help with your VPS? We're here to assist: * 24/7 technical support * Comprehensive documentation * Community forums * Migration assistance