# Attach a custom domain
Source: https://docs.shardcloud.app/api-reference/apps/attach-a-custom-domain
/api-reference/openapi.json post /apps/{app_id}/domains
Domain must already be pointed at the platform (CNAME to the platform's edge).
# Change the app's language runtime version
Source: https://docs.shardcloud.app/api-reference/apps/change-the-apps-language-runtime-version
/api-reference/openapi.json put /apps/{app_id}/version
# Create an app from a Custom Docker Image
Source: https://docs.shardcloud.app/api-reference/apps/create-an-app-from-a-custom-docker-image
/api-reference/openapi.json post /apps/custom-image
JSON counterpart of POST /apps for apps deployed straight from an already-built Custom Docker Image — no file upload. The image's own ENTRYPOINT/CMD runs; language/version/entrypoint/custom_command don't apply.
# Create an app from an uploaded project
Source: https://docs.shardcloud.app/api-reference/apps/create-an-app-from-an-uploaded-project
/api-reference/openapi.json post /apps
# Create or overwrite a file
Source: https://docs.shardcloud.app/api-reference/apps/create-or-overwrite-a-file
/api-reference/openapi.json post /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}
Owner-only (workspace members with lesser roles cannot delete).
# Delete file(s) or a directory
Source: https://docs.shardcloud.app/api-reference/apps/delete-files-or-a-directory
/api-reference/openapi.json delete /apps/{app_id}/files
# Disable public web access
Source: https://docs.shardcloud.app/api-reference/apps/disable-public-web-access
/api-reference/openapi.json delete /apps/{app_id}/web
# Enable public web access
Source: https://docs.shardcloud.app/api-reference/apps/enable-public-web-access
/api-reference/openapi.json post /apps/{app_id}/web
Promotes the app to a public web app (requires 512 MB min RAM) and assigns it a subdomain.
# Get a file's raw content
Source: https://docs.shardcloud.app/api-reference/apps/get-a-files-raw-content
/api-reference/openapi.json get /apps/{app_id}/file/content
# Get app details
Source: https://docs.shardcloud.app/api-reference/apps/get-app-details
/api-reference/openapi.json get /apps/{app_id}
# Get app resource metrics
Source: https://docs.shardcloud.app/api-reference/apps/get-app-resource-metrics
/api-reference/openapi.json get /apps/{app_id}/metrics
# Get app run status
Source: https://docs.shardcloud.app/api-reference/apps/get-app-run-status
/api-reference/openapi.json get /apps/{app_id}/status
# Get environment variables
Source: https://docs.shardcloud.app/api-reference/apps/get-environment-variables
/api-reference/openapi.json get /apps/{app_id}/envs
# Get HTTP traffic dashboard data
Source: https://docs.shardcloud.app/api-reference/apps/get-http-traffic-dashboard-data
/api-reference/openapi.json get /apps/{app_id}/dashboard-data
Requires the app to have analytics enabled (PATCH /apps/{app_id}/analytics).
# Get raw HTTP request logs
Source: https://docs.shardcloud.app/api-reference/apps/get-raw-http-request-logs
/api-reference/openapi.json get /apps/{app_id}/http-logs
# List a directory
Source: https://docs.shardcloud.app/api-reference/apps/list-a-directory
/api-reference/openapi.json get /apps/{app_id}/files
# List app deployments
Source: https://docs.shardcloud.app/api-reference/apps/list-app-deployments
/api-reference/openapi.json get /apps/{app_id}/deploys
# List available language/runtime versions
Source: https://docs.shardcloud.app/api-reference/apps/list-available-languageruntime-versions
/api-reference/openapi.json get /apps/versions
# List your apps
Source: https://docs.shardcloud.app/api-reference/apps/list-your-apps
/api-reference/openapi.json get /apps
# Move or rename file(s)
Source: https://docs.shardcloud.app/api-reference/apps/move-or-rename-files
/api-reference/openapi.json patch /apps/{app_id}/files
Body can be a single MoveFileRequest object or an array of them to move several files in one call.
# Redeploy a previous deployment
Source: https://docs.shardcloud.app/api-reference/apps/redeploy-a-previous-deployment
/api-reference/openapi.json post /apps/{app_id}/deploys/{deploy_id}/restore
Rebuilds and redeploys the app from a past deploy's source snapshot.
# Redeploy app code
Source: https://docs.shardcloud.app/api-reference/apps/redeploy-app-code
/api-reference/openapi.json put /apps/{app_id}/file
Uploads a new project ZIP and redeploys the app in place (equivalent to a git push deploy).
# Remove a custom domain
Source: https://docs.shardcloud.app/api-reference/apps/remove-a-custom-domain
/api-reference/openapi.json delete /apps/{app_id}/domains/{domain}
# Remove the custom error page
Source: https://docs.shardcloud.app/api-reference/apps/remove-the-custom-error-page
/api-reference/openapi.json delete /apps/{app_id}/error-page
# Replace environment variables
Source: https://docs.shardcloud.app/api-reference/apps/replace-environment-variables
/api-reference/openapi.json put /apps/{app_id}/envs
Owner-only. Replaces the full env var set — not a partial merge.
# Run a shell command in the app's container
Source: https://docs.shardcloud.app/api-reference/apps/run-a-shell-command-in-the-apps-container
/api-reference/openapi.json post /apps/{app_id}/exec
Server-Sent Events stream of command output. Heartbeat comment every 10s.
# Run, stop, or restart the app
Source: https://docs.shardcloud.app/api-reference/apps/run-stop-or-restart-the-app
/api-reference/openapi.json post /apps/{app_id}/status
# Search file contents
Source: https://docs.shardcloud.app/api-reference/apps/search-file-contents
/api-reference/openapi.json get /apps/{app_id}/files/search/content
# Search file names
Source: https://docs.shardcloud.app/api-reference/apps/search-file-names
/api-reference/openapi.json get /apps/{app_id}/files/search/name
# Set a custom error page
Source: https://docs.shardcloud.app/api-reference/apps/set-a-custom-error-page
/api-reference/openapi.json put /apps/{app_id}/error-page
Served (from the CDN) whenever the app is stopped or unreachable.
# Stream app logs
Source: https://docs.shardcloud.app/api-reference/apps/stream-app-logs
/api-reference/openapi.json get /apps/{app_id}/logs
Server-Sent Events stream of live container logs. At most 2 concurrent streams per app — a 3rd blocks until one frees up. Heartbeat comment every 5s.
# Update app config and resources
Source: https://docs.shardcloud.app/api-reference/apps/update-app-config-and-resources
/api-reference/openapi.json put /apps/{app_id}/resources
# Build a Custom Docker Image
Source: https://docs.shardcloud.app/api-reference/custom-images/build-a-custom-docker-image
/api-reference/openapi.json post /custom-images
Uploads a build context (a ZIP with a Dockerfile at its root) and builds it into a registry-hosted image. Poll GET /custom-images/{image_id} or stream GET /custom-images/{image_id}/logs to watch the build.
# Delete a Custom Docker Image
Source: https://docs.shardcloud.app/api-reference/custom-images/delete-a-custom-docker-image
/api-reference/openapi.json delete /custom-images/{image_id}
# Get a Custom Docker Image
Source: https://docs.shardcloud.app/api-reference/custom-images/get-a-custom-docker-image
/api-reference/openapi.json get /custom-images/{image_id}
# List your Custom Docker Images
Source: https://docs.shardcloud.app/api-reference/custom-images/list-your-custom-docker-images
/api-reference/openapi.json get /custom-images
# Rebuild a Custom Docker Image
Source: https://docs.shardcloud.app/api-reference/custom-images/rebuild-a-custom-docker-image
/api-reference/openapi.json put /custom-images/{image_id}
Uploads a new build context and rebuilds the image in place; apps deployed from it keep the same image ID.
# Stream a Custom Docker Image's build logs
Source: https://docs.shardcloud.app/api-reference/custom-images/stream-a-custom-docker-images-build-logs
/api-reference/openapi.json get /custom-images/{image_id}/logs
Server-Sent Events stream — replays build history so far, then streams live lines while a build is running, or the last completed build's log if nothing is currently building. At most 2 concurrent streams per image. Heartbeat comment every 5s.
# 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 database
Source: https://docs.shardcloud.app/api-reference/databases/create-a-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}
Owner-only (workspace members with lesser roles cannot delete).
# Enable the database's visualizer UI
Source: https://docs.shardcloud.app/api-reference/databases/enable-the-databases-visualizer-ui
/api-reference/openapi.json post /databases/{database_id}/visualizer
One-way — there is no endpoint to disable it once enabled. Adds RAM overhead (+512 MB) to the database's resource plan.
# 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 details
Source: https://docs.shardcloud.app/api-reference/databases/get-database-details
/api-reference/openapi.json get /databases/{database_id}
# 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 database resource metrics
Source: https://docs.shardcloud.app/api-reference/databases/get-database-resource-metrics
/api-reference/openapi.json get /databases/{database_id}/metrics
# List your databases
Source: https://docs.shardcloud.app/api-reference/databases/list-your-databases
/api-reference/openapi.json get /databases
# Restart a stopped database
Source: https://docs.shardcloud.app/api-reference/databases/restart-a-stopped-database
/api-reference/openapi.json post /databases/{database_id}/initialize
# 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 RAM/vCPU
Source: https://docs.shardcloud.app/api-reference/databases/update-database-ramvcpu
/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 app, database, or VM — including creating and deleting them, building Custom Docker Images, and managing project alerts and backups — 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)
# Create a resource alert
Source: https://docs.shardcloud.app/api-reference/project/create-a-resource-alert
/api-reference/openapi.json post /project/{project_id}/alerts
Fires (an email/Discord notification) when the metric stays over threshold for alert_minutes minutes straight.
# Create an on-demand backup
Source: https://docs.shardcloud.app/api-reference/project/create-an-on-demand-backup
/api-reference/openapi.json post /project/{project_id}/backups
For a Database project, target_database (the logical database to back up) is required in the body. Omit the body entirely for App/VM projects.
# Delete a backup
Source: https://docs.shardcloud.app/api-reference/project/delete-a-backup
/api-reference/openapi.json delete /project/{project_id}/backups/{backup_id}
Backups can only be deleted after a minimum retention age — deleting too early returns 403.
# Delete a resource alert
Source: https://docs.shardcloud.app/api-reference/project/delete-a-resource-alert
/api-reference/openapi.json delete /project/{project_id}/alerts/{alert_id}
# Get a signed download URL for a backup
Source: https://docs.shardcloud.app/api-reference/project/get-a-signed-download-url-for-a-backup
/api-reference/openapi.json get /project/{project_id}/backups/{backup_id}/download
# List a project's backups
Source: https://docs.shardcloud.app/api-reference/project/list-a-projects-backups
/api-reference/openapi.json get /project/{project_id}/backups
# List resource alerts for a project
Source: https://docs.shardcloud.app/api-reference/project/list-resource-alerts-for-a-project
/api-reference/openapi.json get /project/{project_id}/alerts
Works for any project type (App, Database, or VM) — :project_id is that resource's id.
# Restore a backup
Source: https://docs.shardcloud.app/api-reference/project/restore-a-backup
/api-reference/openapi.json post /project/{project_id}/backups/{backup_id}/restore
For a Database project, target_database is required in the body. This drops and replaces the current data — destructive.
# Change the VM's root password
Source: https://docs.shardcloud.app/api-reference/vms/change-the-vms-root-password
/api-reference/openapi.json put /vms/{vm_id}/password
# Create a VM
Source: https://docs.shardcloud.app/api-reference/vms/create-a-vm
/api-reference/openapi.json post /vms
Either template or (distro + ram) must be provided — a template supplies its own ram and distro.
# Delete a VM
Source: https://docs.shardcloud.app/api-reference/vms/delete-a-vm
/api-reference/openapi.json delete /vms/{vm_id}
# Get VM details
Source: https://docs.shardcloud.app/api-reference/vms/get-vm-details
/api-reference/openapi.json get /vms/{vm_id}
# Get VM resource metrics
Source: https://docs.shardcloud.app/api-reference/vms/get-vm-resource-metrics
/api-reference/openapi.json get /vms/{vm_id}/timeseries
# List available Linux distros
Source: https://docs.shardcloud.app/api-reference/vms/list-available-linux-distros
/api-reference/openapi.json get /vms/distros
# List your VMs
Source: https://docs.shardcloud.app/api-reference/vms/list-your-vms
/api-reference/openapi.json get /vms
# Reinstall the VM's OS
Source: https://docs.shardcloud.app/api-reference/vms/reinstall-the-vms-os
/api-reference/openapi.json post /vms/{vm_id}/reinstall
Wipes the VM's disk and reinstalls its distro from scratch with a new root password.
# Run shell commands inside the VM
Source: https://docs.shardcloud.app/api-reference/vms/run-shell-commands-inside-the-vm
/api-reference/openapi.json post /vms/{vm_id}/exec
Server-Sent Events stream of command output, one or more commands run in order (up to 50 per request). Heartbeat comment every 10s.
# Start the VM
Source: https://docs.shardcloud.app/api-reference/vms/start-the-vm
/api-reference/openapi.json post /vms/{vm_id}/start
# Stop the VM
Source: https://docs.shardcloud.app/api-reference/vms/stop-the-vm
/api-reference/openapi.json post /vms/{vm_id}/stop
# Update VM RAM
Source: https://docs.shardcloud.app/api-reference/vms/update-vm-ram
/api-reference/openapi.json put /vms/{vm_id}/resources
# 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
Response times, status codes, RPS, and geographic distribution
Our metrics dashboard provides comprehensive insights into your application's performance with beautiful, easy-to-understand visualizations.
**Resource Metrics:**
* **CPU & RAM**: Real-time utilization tracking
* **Network Traffic**: Incoming and outgoing bandwidth
* **Uptime Statistics**: Historical uptime percentages
### HTTP Metrics
Every application with an exposed endpoint gets detailed HTTP analytics out of the box — no SDK or instrumentation required.
**Available HTTP Metrics:**
* **Response Time**: Average, minimum, and maximum response times over time
* **Status Codes**: Distribution of 2xx, 4xx, and 5xx responses
* **Requests Per Second (RPS)**: Live request rate tracking
* **Requests Per Route**: Traffic breakdown by individual endpoint
* **Requests Per Browser**: User-agent and device type distribution across your traffic
* **Requests By Country/Region**: Geographic map showing where your traffic originates
### HTTP Request Logs
Every incoming HTTP request is automatically logged — no custom logging middleware needed. Each log entry captures the route, status code, response time, and client information, giving you full visibility into your traffic without writing a single line of logging code.
## 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
# Authorization
Source: https://docs.shardcloud.app/cdn/authorization
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 CDN endpoints are authenticated using Bearer tokens and picked up from the authorization header shown below:
```json theme={null}
'Authorization': 'Bearer {api_token}'
```
## Managed File Delivery
With the Shard Cloud CDN, you can programmatically upload, list, retrieve, and delete files — all served through a global edge network with caching and compression handled automatically.
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)
# Delete a CDN file
Source: https://docs.shardcloud.app/cdn/cdn/delete-a-cdn-file
/cdn/openapi.json delete /cdn/files
Deletes a file from the CDN. The fileName query parameter is validated for ownership via middleware before the handler executes.
# Delete a CDN folder
Source: https://docs.shardcloud.app/cdn/cdn/delete-a-cdn-folder
/cdn/openapi.json delete /cdn/folder
Deletes files from a folder, frees the space they used from your CDN quota, and clears the folder's cache. This cannot be undone. Only the folder's own files are affected: deleting `img` does not touch `img2`. The reserved folder `error-pages` cannot be deleted. To only clear the cache without deleting files, use `DELETE /cdn/cache/folder`.
Each call deletes at most **3,000 files**. When the response has `remaining: true`, the folder still has files: call the endpoint again until `remaining` is `false`. If the storage provider is slow and a call stops part-way, it returns `409`; call it again to continue where it left off.
# Delete multiple CDN files
Source: https://docs.shardcloud.app/cdn/cdn/delete-multiple-cdn-files
/cdn/openapi.json post /cdn/files/delete
Deletes up to 30 files in one request. Each file is handled independently: the response lists which files were deleted and which failed, so one missing file does not stop the rest. A large upload that has not been finalized yet is discarded and its reserved quota released, like a single delete. To delete a whole folder instead, use `DELETE /cdn/folder`.
# Finish a large file upload
Source: https://docs.shardcloud.app/cdn/cdn/finish-a-large-file-upload
/cdn/openapi.json post /cdn/files/multipart/{upload_id}/finalize
Completes an upload started with `POST /cdn/files/multipart` after every part has been sent. The parts are checked against the size declared at start, the file is assembled, its content is validated against the MIME type, and the file becomes available at its CDN `url`. Safe to call again: repeating it after a success returns the same file.
# Get a single CDN file
Source: https://docs.shardcloud.app/cdn/cdn/get-a-single-cdn-file
/cdn/openapi.json get /cdn/files/get
Retrieves metadata for a specific CDN file. The fileName query parameter is validated for ownership via middleware before the handler executes.
# Get CDN usage stats
Source: https://docs.shardcloud.app/cdn/cdn/get-cdn-usage-stats
/cdn/openapi.json get /cdn/stats
Returns CDN storage statistics for the authenticated user (limit, usage, file count).
# List CDN files
Source: https://docs.shardcloud.app/cdn/cdn/list-cdn-files
/cdn/openapi.json get /cdn/files
Lists CDN files for the authenticated user. Supports cursor-based pagination (100 items per page), optional filtering to a single folder, and optional search filtering by filename. `folder` and `search` can be combined. Large uploads that are not finished yet are included with `status` set to `pending`.
# Purge a CDN folder cache
Source: https://docs.shardcloud.app/cdn/cdn/purge-a-cdn-folder-cache
/cdn/openapi.json delete /cdn/cache/folder
Purges all cached files in a folder (or all files if folder is omitted) for the authenticated user. This only clears the cache; the files are kept. To delete the files, use `DELETE /cdn/folder`.
# Start a large file upload
Source: https://docs.shardcloud.app/cdn/cdn/start-a-large-file-upload
/cdn/openapi.json post /cdn/files/multipart
Starts an upload for files too large for a single `POST /cdn/files` request (which is limited to 100 MB). Reserves the file name and the storage quota, and returns one upload URL per 64 MiB part. Send each part with `PUT` to its URL, then call the finalize endpoint. Requires a valid subscription. The file is not publicly available until it is finalized.
# Upload a CDN file
Source: https://docs.shardcloud.app/cdn/cdn/upload-a-cdn-file
/cdn/openapi.json post /cdn/files
Uploads a file to the CDN. Requires a valid subscription. File must be between 2KB and 100MB. An optional folder, mime_type, and expire_at can be provided.
# Shard Cloud CDN
Source: https://docs.shardcloud.app/cdn/introduction
Upload your files and let us handle the rest — edge caching, image compression, and global delivery out of the box.
## Overview
Shard Cloud CDN is a fully managed file delivery network — think **S3 + CloudFront in one step**. Upload your images, videos, documents, or any supported file, and we automatically serve them through a global edge network with caching, compression, and expiration handling built in.
The goal is simple: **upload a file and get a URL**. No infrastructure to configure, no cache rules to write, no CDN invalidation to think about.
Every plan includes a free CDN storage quota. You can check the CDN quota included in each plan on the [pricing page](https://shardcloud.app/pricing).
## Built-in Features
Files are cached at edge locations worldwide. Your users get the fastest possible response times regardless of where they are.
Images are automatically compressed and optimized on delivery without quality loss. No extra configuration needed.
Set an optional `expire_at` timestamp on any file. Expired files are automatically cleaned up — great for temporary assets, signed URLs, or time-limited content.
Organize files into folders using the optional `folder` parameter. Purge an entire folder's cache, or delete a whole folder, in a single API call.
## File Size Limits
| Constraint | Value |
| ----------------------------------------------------------- | -------------------------------------------------------- |
| Minimum file size | **2 KB** |
| Maximum file size, single request (`POST /cdn/files`) | **100 MB** |
| Maximum file size, [large file upload](#large-file-uploads) | **10 GB** (and never more than your remaining CDN quota) |
## File Names
| Constraint | Value |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| Allowed characters | Letters (`a-z`, `A-Z`), numbers, underscores (`_`), and hyphens (`-`) |
| Length | 1–64 characters (same rules for `folder`) |
| Extension | **Do not include one** — it is added automatically from the file's MIME type (e.g. `photo` + `image/png` → `photo.png`) |
The folder name `error-pages` is reserved.
## Supported File Types
The CDN validates files by their MIME type and magic bytes. We support images, videos, audio, documents (PDF), archives, fonts, and text formats (JSON, CSV, CSS, plain text). For the full list of accepted MIME types, see the [Supported File Types](/cdn/supported-file-types) page.
## Quick Start
**Upload a file:**
```bash theme={null}
curl -X POST https://shardcloud.app/api/cdn/files \
-H "Authorization: Bearer {api_token}" \
-F "file=@photo.png" \
-F "filename=photo" \
-F "folder=avatars"
```
The response includes a `url` field — that's your globally cached CDN link, ready to use.
**List your files:**
```bash theme={null}
curl https://shardcloud.app/api/cdn/files \
-H "Authorization: Bearer {api_token}"
```
**List the files of one folder:**
```bash theme={null}
curl "https://shardcloud.app/api/cdn/files?folder=avatars" \
-H "Authorization: Bearer {api_token}"
```
Results come 100 per page; pass the returned `cursor` back as `?cursor=` to get the next page. `folder` can be combined with `search` to filter by name inside the folder.
**Delete several files at once** (up to 30 per request):
```bash theme={null}
curl -X POST https://shardcloud.app/api/cdn/files/delete \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
-d '{"filenames": ["avatars/logo.png", "notes.txt"]}'
```
The response lists what was deleted and what failed, per file — a missing file doesn't stop the others:
```json theme={null}
{ "deleted": ["avatars/logo.png"], "failed": [{ "filename": "notes.txt", "error": "file not found" }] }
```
**Check your usage:**
```bash theme={null}
curl https://shardcloud.app/api/cdn/stats \
-H "Authorization: Bearer {api_token}"
```
## Large File Uploads
A single `POST /cdn/files` request is limited to 100 MB. For bigger files (up to 10 GB), upload in parts with two extra endpoints:
1. `POST /cdn/files/multipart` — starts the upload and returns one upload URL per part.
2. `POST /cdn/files/multipart/{upload_id}/finalize` — assembles the parts once they are all sent.
Between the two calls you `PUT` each part's bytes to its URL. Those URLs need no `Authorization` header — each one is a private credential, so don't share them.
### How it works
**1. Start the upload** with the exact size of the file in bytes:
```bash theme={null}
curl -X POST https://shardcloud.app/api/cdn/files/multipart \
-H "Authorization: Bearer {api_token}" \
-H "Content-Type: application/json" \
-d '{"filename": "backup", "folder": "videos", "mime_type": "video/mp4", "size": 1073741824}'
```
```json theme={null}
{
"id": "0192b7a4-3c1e-7f2a-9d55-6a1f0c2e8b10",
"filename": "videos/backup.mp4",
"parts": [
{ "part_number": 1, "url": "https://shardcloud.app/api/cdn/upload/...", "size": 67108864 },
{ "part_number": 2, "url": "https://shardcloud.app/api/cdn/upload/...", "size": 67108864 }
],
"expires_at": "2026-09-26T07:45:00Z"
}
```
The file name and the storage quota are reserved at this point, so a file that doesn't fit your quota is refused immediately.
**2. Upload every part.** Every part is exactly **64 MiB** (67,108,864 bytes) except the last, which holds the remainder — each part's `size` tells you how many bytes to send. `PUT` the bytes of part *n* (bytes `(n-1) × 64 MiB` onward) to that part's `url`:
```bash theme={null}
# split -b 67108864 backup.mp4 part_ → part_aa, part_ab, ...
curl -X PUT "{part_1_url}" --data-binary @part_aa
curl -X PUT "{part_2_url}" --data-binary @part_ab
```
The `Content-Length` must match the part's `size` exactly, otherwise the request is rejected with `403`. Parts can be sent in any order, in parallel, and a failed part can simply be sent again. A successful upload answers `200`.
**3. Finalize:**
```bash theme={null}
curl -X POST https://shardcloud.app/api/cdn/files/multipart/{id}/finalize \
-H "Authorization: Bearer {api_token}"
```
It returns the file with its CDN `url`, exactly like a normal upload. Calling finalize again after it succeeded returns the same file, so it is safe to retry if a response gets lost.
### Good to know
* **Time limit:** the part URLs and finalize work for **3 hours 50 minutes** after you start. After that the reservation is released and you need to start again. If you set `expire_at`, it must be later than that window.
* **Not public until finalized:** the file shows up in `GET /cdn/files` with `"status": "pending"` and has no `url` until finalize succeeds.
* **Validation:** finalize checks that every part was uploaded with the right size, that the total matches the `size` you declared, and that the file's content matches its MIME type. If the content check fails, the upload is discarded and the quota is released.
* **Cancelling:** `DELETE /cdn/files?fileName={filename}` on a pending upload discards the uploaded parts and releases the reserved quota.
* **Same rules as normal uploads:** valid subscription, [supported file types](/cdn/supported-file-types), file name rules, and the file count limit all apply.
## CDN API Reference
For the full list of endpoints, request/response schemas, and parameters, see the CDN API Reference section in the sidebar.
# Supported File Types
Source: https://docs.shardcloud.app/cdn/supported-file-types
Full list of MIME types accepted by the Shard Cloud CDN.
The CDN validates every upload by its MIME type and magic bytes. Only the file types listed below are accepted.
## Images
| MIME Type | Format |
| --------------- | --------------------------------- |
| `image/jpeg` | JPEG |
| `image/png` | PNG |
| `image/gif` | GIF (87a & 89a) |
| `image/webp` | WebP |
| `image/bmp` | BMP |
| `image/tiff` | TIFF (little-endian & big-endian) |
| `image/svg+xml` | SVG |
| `image/x-icon` | ICO |
| `image/heif` | HEIF |
| `image/avif` | AVIF |
## Videos
| MIME Type | Format |
| ----------------- | ------ |
| `video/mp4` | MP4 |
| `video/x-msvideo` | AVI |
| `video/webm` | WebM |
## Audio
| MIME Type | Format |
| ------------ | ---------------- |
| `audio/mpeg` | MP3 (MPEG / ID3) |
| `audio/wav` | WAV |
| `audio/mp4` | M4A |
| `audio/ogg` | OGG |
## Documents
| MIME Type | Format |
| ----------------- | ------ |
| `application/pdf` | PDF |
## Archives
| MIME Type | Format |
| ------------------------------ | ------------- |
| `application/zip` | ZIP |
| `application/x-rar-compressed` | RAR (v4 & v5) |
| `application/gzip` | GZIP |
## Fonts
| MIME Type | Format |
| ------------ | -------- |
| `font/woff2` | WOFF2 |
| `font/woff` | WOFF |
| `font/ttf` | TrueType |
| `font/otf` | OpenType |
## Text Formats
| MIME Type | Format |
| ------------------ | ------------------- |
| `application/json` | JSON |
| `text/csv` | CSV |
| `text/css` | CSS |
| `text/plain` | Plain text (`.txt`) |
# Authentication
Source: https://docs.shardcloud.app/cli/auth
Learn how to authenticate with the ShardCloud 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 CLI.
## Log In
Authenticate with the CLI using `shardcloud auth login`:
```bash theme={null}
shardcloud auth login
```
You'll be prompted to paste your API token:
```bash theme={null}
? Enter your ShardCloud API token:
```
You can skip the prompt by passing your token with `--token`:
```bash theme={null}
shardcloud auth login --token
```
Either way, the CLI verifies the token against the API before saving it — an invalid token is rejected immediately with `invalid token: ...` rather than being written to disk.
## Profiles
The CLI supports multiple named auth profiles (e.g. one per ShardCloud account, or a separate profile for CI), stored in a single config file on disk. `shardcloud auth login` always writes into whichever profile is active, unless you pass `--profile`.
```bash theme={null}
# Create an empty profile — it holds no token until you log into it
shardcloud config profile add work
# Log into that profile specifically
shardcloud auth login --profile work --token
# List all profiles and see which is active
shardcloud config profile list
# Switch the active profile
shardcloud config profile use work
# Remove a profile (you can't remove the currently active one)
shardcloud config profile remove work
```
`shardcloud config profile add ` only creates an empty, logged-out profile
— it does not take a `--token` flag. Log into a specific profile with
`shardcloud auth login --profile --token `.
Every command that talks to the API runs against the currently active profile. Check who that is at any time:
```bash theme={null}
shardcloud auth whoami
```
```bash theme={null}
Logged in as Jane Doe
Profile: work
```
## Logging Out
```bash theme={null}
shardcloud auth logout
# or a specific profile:
shardcloud auth logout --profile work
```
This clears the stored token for that profile but leaves the profile itself (and any other profiles) in place.
## Non-Interactive / CI Authentication
There is no environment variable the CLI reads for a token override (e.g. no `SHARD_TOKEN`) — the only way to authenticate a script or CI job is the same `--token` flag used interactively, pointed at a dedicated profile so it doesn't clobber your local login:
```bash theme={null}
shardcloud config profile add ci
shardcloud auth login --profile ci --token "$SHARD_CI_TOKEN"
shardcloud config profile use ci
```
This persists the token to the CLI's config file (`shardcloud.json`, under your user config directory) exactly like an interactive login does, so make sure your CI runner has a writable, ideally ephemeral, home/config directory for the job.
## Creating Your First App
See the [commands](/cli/commands) section for the full command reference and how to get started.
# ShardCloud 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
```
## v2: Resource-Grouped Commands
CLI v2 replaces v1's flat command surface entirely. This is a breaking
change — there are no aliases for the old verbs, so any scripts calling
`shardcloud ` directly need to be updated. See [Migrating from
v1](#migrating-from-v1) below.
Every command is now `shardcloud `, grouped by the kind of thing it acts on:
```bash theme={null}
shardcloud app restart
shardcloud db create --type postgres --name mydb --ram 512
shardcloud vm ssh
```
Run `shardcloud --help` for the full list of subcommands in a group, or see the [full command reference](/cli/commands).
| Group | Description |
| -------------------------------------------- | ---------------------------------------------------------------------------------- |
| `auth` | Log in/out, show the current account |
| `config` | Manage auth profiles and CLI settings |
| `link` / `unlink` | Link the current directory to an existing app, database, or VM |
| `app` | Create, deploy, and manage apps |
| `db` | Create and manage databases |
| `vm` | Manage virtual machines, including SSH access |
| `backup` | Create, list, restore, delete, and download backups — for apps, databases, and VMs |
| `lb` | Manage load balancers (**Pro and Enterprise plans only**) |
| `image` | Build, deploy, and manage custom Docker images |
| `version` / `update` / `completion` / `docs` | CLI version, update check, shell completions, and opening these docs |
## Authentication
See [Authentication](/cli/auth) for logging in, profiles, and non-interactive/CI auth.
## Global Output Flags
Every command accepts two persistent flags that control how output is printed, useful for scripting:
| Flag | Effect |
| --------- | ----------------------------------------------------------------- |
| `--json` | Print machine-readable JSON instead of a table |
| `--quiet` | Print only IDs (one per line) — nothing else, no success messages |
```bash theme={null}
shardcloud app list --json
shardcloud app list --quiet | xargs -n1 shardcloud app restart
```
## 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
```
The CLI also nudges you in place when a newer version is available (after any command finishes, in table output mode), and `shardcloud update` checks and prints the right upgrade command for your platform on demand.
### Install a specific version (NPM only)
```bash theme={null}
shardcloud install 2.0.0
```
## Migrating from v1
v1's flat verbs are gone — every one of them now lives under a resource group. There are no aliases; the table below maps every old command to its v2 equivalent.
| v1 | v2 |
| ----------------------------- | --------------------------------------------------------------------------------------------- |
| `shardcloud login` | `shardcloud auth login` |
| `shardcloud logout` | `shardcloud auth logout` |
| `shardcloud me` | `shardcloud auth whoami` |
| `shardcloud create` | `shardcloud app create` |
| `shardcloud commit ` | `shardcloud app commit ` |
| `shardcloud status ` | `shardcloud app status ` |
| `shardcloud logs ` | `shardcloud app logs ` |
| `shardcloud start ` | `shardcloud app start ` |
| `shardcloud stop ` | `shardcloud app stop ` |
| `shardcloud restart ` | `shardcloud app restart ` |
| `shardcloud delete ` | `shardcloud app delete ` |
| `shardcloud backup ` | `shardcloud backup create ` — and now also works for databases and VMs, not just apps |
| `shardcloud restore ` | `shardcloud backup restore ` — also works for databases and VMs |
## Examples
For detailed examples of using every command with resource IDs and from linked directories, see the [Commands](/cli/commands) reference.
# Commands
Source: https://docs.shardcloud.app/cli/commands
Full reference for every shardcloud CLI v2 command
Make sure you are [authenticated](/cli/auth) before proceeding.
Commands that take a resource ID accept it as an argument, e.g. `shardcloud app
restart `. If you omit the ID and the current directory is
[linked](#linking-a-directory) to that resource type, the CLI uses the
linked resource. If neither is given, the command fails with a clear error
— unlike v1, there is no interactive selection menu to pick from your
resources.
## Linking a Directory
A **link** ties the current directory to one existing app, database, or VM, so you can omit the ID on every subsequent command run from that directory. It's stored in a `.shardcloud.json` file:
```json theme={null}
{
"resource_id": "550e8400-e29b-41d4-a716-446655440000",
"resource_type": "app"
}
```
```bash theme={null}
shardcloud link --type app # or: database, vm
shardcloud unlink # removes .shardcloud.json from the current directory
```
`.shardcloud.json` (the directory link) is separate from `.shardcloud` (the
app's own build/deploy config file) — linking a directory doesn't touch
your `.shardcloud` file, and vice versa.
`shardcloud app create` auto-links the directory it's run from to the newly created app, the same way v1's `create` did — you don't need to run `shardcloud link` yourself right after creating an app. Databases and VMs have no creation-time side effect to piggyback a link off of (databases are created with `db create`, VMs only from the dashboard), so link those with `shardcloud link --type database` / `--type vm` after the fact if you want to omit their ID from a directory.
## `auth` / `config`
See [Authentication](/cli/auth) for `auth login` / `auth logout` / `auth whoami` and `config profile *`. `config set ` sets a free-form CLI setting — currently used for `api_url`, to point the CLI at a different API base URL:
```bash theme={null}
shardcloud config set api_url https://staging.shardcloud.app/api
```
## `app`
`app` has an `apps` alias — `shardcloud apps list` works the same as `shardcloud app
list`.
| Command | Args | Key flags | Description |
| ----------------- | ------------------- | ------------------------------------------- | ---------------------------------------------------- |
| `create` | - | `--file`, `--from-image`, `--ram`, `--name` | Create a new app |
| `list` | - | - | List your apps |
| `get` | `[id]` | - | Show one app's details |
| `delete` | `[id]` | `-y, --yes` | Delete an app |
| `start` | `[id]` | - | Start a stopped app |
| `stop` | `[id]` | - | Stop a running app |
| `restart` | `[id]` | - | Restart an app |
| `status` | `[id]` | `--watch` | Show an app's live status |
| `logs` | `[id]` | `--since`, `--http` | Stream an app's logs |
| `metrics` | `[id]` | `--minutes` (default 60) | Show resource metrics |
| `commit` | `[id]` | `--file` | Deploy the current directory (or a zip) to an app |
| `deploys list` | `[id]` | - | List an app's deploy history |
| `deploys restore` | ` [id]` | - | Restore an app to a previous deploy |
| `resize` | `[id]` | `--ram` (required) | Change an app's RAM allocation |
| `rename` | `[id]` | `--name` (required) | Rename an app |
| `version set` | `[id]` | `--language`, `--version` (required) | Set the app's language version |
| `version list` | - | `--language` (required) | List available versions for a language |
| `web enable` | `[id]` | `--subdomain` | Enable public web access |
| `web disable` | `[id]` | - | Disable public web access |
| `env list` | - | `--app` | List environment variables |
| `env set` | `KEY=VALUE...` | `--app` | Set one or more environment variables |
| `env pull` | - | `--app` | Write env vars to a local `.env` file |
| `env run` | `-- ` | `--app` | Run a local command with the app's env vars injected |
| `exec` | `[id] -- ` | - | Run a command inside the app's container |
### Create
```bash theme={null}
# Zip and deploy the current directory
shardcloud app create
# Deploy a pre-built zip instead of zipping the cwd
shardcloud app create --file dist.zip
# Deploy from a custom Docker image (requires --name and --ram)
shardcloud app create --from-image --name my-api --ram 512
```
`create` always writes a `.shardcloud.json` link to the current directory pointing at the new app, whichever path you use.
### Deploys
`app deploys list` and `app deploys restore` only return data for apps
linked to a GitHub repository. Apps deployed via zip upload
(`shardcloud app commit`) have no deploy history to list or restore from these
commands.
### Env
```bash theme={null}
shardcloud app env list --app
shardcloud app env set DATABASE_URL=postgres://... DEBUG=true
shardcloud app env pull # writes ./.env
shardcloud app env run -- npm run start # runs locally with the app's env injected
```
`env set` merges into the app's existing variables — it doesn't wipe ones you don't mention. All `env` subcommands accept `--app ` in place of a positional ID/link.
### Exec
```bash theme={null}
shardcloud app exec -- npm run migrate
```
Streams stdout/stderr live and exits with the remote command's exit code.
## `db`
`db` has `database`/`databases` aliases.
| Command | Args | Key flags | Description |
| ------------------- | ------ | -------------------------------------------------------- | ----------------------------------- |
| `create` | - | `--type`, `--name`, `--ram` (all required), `--password` | Create a new database |
| `list` | - | - | List your databases |
| `get` | `[id]` | - | Show one database's details |
| `delete` | `[id]` | `-y, --yes` | Delete a database |
| `start` | `[id]` | - | Start a stopped database |
| `stop` | `[id]` | - | Stop a database |
| `status` | `[id]` | - | Show a database's replica status |
| `metrics` | `[id]` | `--minutes` (default 60) | Show resource metrics |
| `password set` | `[id]` | `--password`, `--generate` | Change the database password |
| `connection-url` | `[id]` | `--copy` | Show (or copy) the connection URL |
| `resize` | `[id]` | `--ram` (required), `--vcpu` | Change RAM/vCPU |
| `visualizer enable` | `[id]` | - | Enable the database's visualizer UI |
```bash theme={null}
shardcloud db create --type postgres --name mydb --ram 512
# --password omitted above: the CLI generates and prints a random one
shardcloud db connection-url --copy
shardcloud db password set --generate
```
`--type` accepts `postgres`, `mysql`, `mongo`, or `redis`.
## `vm`
`vm` has a `vms` alias. **`shardcloud vm create` does not exist.** VMs are
created from the web dashboard only — creating one starts a real recurring
subscription charge, so the CLI deliberately doesn't expose a way to
trigger that. Every other `vm` command works once a VM exists.
| Command | Args | Key flags | Description |
| ---------------- | ------------------- | ------------------------------------- | -------------------------------------------------- |
| `list` | - | - | List your VMs |
| `get` | `[id]` | - | Show one VM's details |
| `delete` | `[id]` | `-y, --yes` | Delete a VM (also cancels its recurring charge) |
| `start` | `[id]` | - | Start a VM |
| `stop` | `[id]` | - | Stop a VM |
| `ssh` | `` | - | SSH into a VM (shells out to your system `ssh`) |
| `exec` | ` -- ` | `--cwd` | Run a command on a VM over exec (not a full shell) |
| `password set` | `[id]` | `--password`, `--generate` | Change the VM's root password |
| `reinstall` | `[id]` | `--distro`, `--password`, `-y, --yes` | Wipe and reinstall a VM |
| `resize` | `[id]` | `--ram` (required) | Change a VM's RAM allocation |
| `metrics` | `[id]` | `--watch`, `--minutes` (default 60) | Show resource metrics |
| `distros list` | - | - | List available VM distros |
| `templates list` | - | - | List available VM templates |
```bash theme={null}
shardcloud vm ssh
shardcloud vm exec --cwd /opt/app -- ls -la
shardcloud vm reinstall
```
`vm reinstall --distro` is accepted by the CLI but **ignored by the
backend** — a reinstall always reuses the VM's current distro, there is no
API to change it. The CLI prints a note to stderr when you pass `--distro`
so you aren't left wondering why the distro didn't change.
## `backup`
Generic across apps, databases, and VMs — the same commands work for all three resource types, since it's one backup API underneath.
| Command | Args | Key flags | Description |
| ---------- | --------------------------- | -------------------------------- | ----------------- |
| `create` | `` | `--target-database`, `--name` | Create a backup |
| `list` | `` | - | List backups |
| `restore` | ` ` | `--target-database`, `-y, --yes` | Restore a backup |
| `delete` | ` ` | `-y, --yes` | Delete a backup |
| `download` | ` ` | `-o, --output` | Download a backup |
```bash theme={null}
shardcloud backup create --name pre-deploy
shardcloud backup list
shardcloud backup restore
shardcloud backup download -o backup.tar.gz
```
`--target-database` is only relevant when backing up/restoring a database resource. `download` without `-o`/`--output` prints the backup's download URL instead of saving it.
## `lb`
Load balancers require a **Pro or Enterprise** plan. Creating one, or
claiming a domain for one, on a lower plan fails with a plan-tier error.
A load balancer is a named, reusable pool of sibling apps that a domain can point at, so traffic round-robins/fails over across them instead of being tied to one app.
| Command | Args | Key flags | Description |
| ------------------ | --------------- | -------------------- | -------------------------------- |
| `create` | - | `--name` (required) | Create a load balancer |
| `list` | - | - | List your load balancers |
| `get` | `` | - | Show one load balancer's details |
| `delete` | `` | `-y, --yes` | Delete a load balancer |
| `update` | `` | `--timeout-ms` | Update proxy timeout |
| `target add` | ` ` | `--group` | Add a target app |
| `target remove` | ` ` | - | Remove a target app |
| `target enable` | ` ` | - | Enable a target app |
| `target disable` | ` ` | - | Disable a target app |
| `target group set` | ` ` | `--group` (required) | Set a target's host-rule group |
```bash theme={null}
shardcloud lb create --name main
shardcloud lb target add --group api
shardcloud lb update --timeout-ms 30000
```
`lb` (and its aliases `loadbalancer`/`loadbalancers`) has no domain or error-page subcommands — claiming a custom domain for a load balancer is done from the web dashboard, not the CLI.
## `image`
Custom Docker images: build them from a directory or zip, then deploy them as apps.
| Command | Args | Key flags | Description |
| --------- | ------------ | ---------------------------------------------- | ----------------------------------------- |
| `build` | - | `--context` (default `.`), `--name` (required) | Build a new custom image |
| `list` | - | - | List your custom images |
| `get` | `` | - | Show one image's details |
| `rebuild` | `` | `--context` (default `.`) | Rebuild an image from a new build context |
| `delete` | `` | `-y, --yes` | Delete a custom image |
| `logs` | `` | `--follow` | Stream an image's build logs |
| `deploy` | `` | `--name`, `--ram` (required), `--env` | Deploy a built image as a new app |
```bash theme={null}
shardcloud image build --name my-image --context .
shardcloud image deploy --name my-api --ram 512 --env PORT=3000 --env NODE_ENV=production
```
`--context` accepts either a directory (zipped Docker-context-aware, honoring `.dockerignore` and keeping the `Dockerfile`) or a path to an existing `.zip`.
`image rebuild` always requires a build context (`--context`, defaulting to
the current directory) — there is no "reuse the previous build's context"
option. Every rebuild re-packs and re-uploads a context from scratch.
## Misc
| Command | Description |
| -------------- | ------------------------------------------------------------------------------------------------ |
| `version` | Print the CLI version |
| `update` | Check for a newer CLI version and print the right upgrade command |
| `completion` | Generate shell completions (bash, zsh, fish, powershell) |
| `docs ` | Open a docs page in your browser (`apps`, `databases`, `vms`, `domains`, `config`, `cli`, `cdn`) |
```bash theme={null}
shardcloud completion zsh > ~/.zsh/completions/_shardcloud
shardcloud docs vms
```
# 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 |
# Custom Docker Images
Source: https://docs.shardcloud.app/custom-docker-images
Deploy apps from your own Dockerfile instead of Shard Cloud's auto-detected language containers.
Full control over your runtime — no auto-detected language container
Link a GitHub repo so every push rebuilds your image
Custom Docker Images require a **Core plan or higher**.
## What Is a Custom Docker Image
For most apps, the [supported languages](/apps#production-optimized-containers) auto-detect your
project and run it in a production-hardened container for you. A **Custom Docker Image** is the
alternative for when you need full control: you upload a build context — a `.zip` containing a
`Dockerfile` at its root — and Shard Cloud builds it and pushes it to an internal image registry.
Unlike a normal app, a custom image has **no language, version, entrypoint, or custom command**
settings. Whatever your image's own `ENTRYPOINT`/`CMD` runs is what runs — the image is the
complete definition of how your app starts.
## Building an Image
Zip up your project with a `Dockerfile` at the root of the archive.
Upload the zip from the dashboard, along with a name for the image. The zip must be no larger
than **100MB**.
Shard Cloud stores the image immediately and kicks off the build in the background — builds
can take several minutes, so you don't wait around for it.
### Watching the Build
The image goes through a simple status lifecycle:
| Status | Meaning |
| ---------- | -------------------------------------------------------- |
| `building` | Upload/build is in progress |
| `success` | Build completed and the image was pushed to the registry |
| `failed` | Build or upload failed (the dashboard shows why) |
You can watch the build's live output from the dashboard while it's running, or review the log
from the last completed build afterward.
## Rebuilding an Image
Uploading a new build context for an existing image triggers a fresh build in place — same
size/type limits as creating one. The image keeps the same identity throughout its life, so
anything referencing it (like an app deployed from it) doesn't need to change.
Rebuilding only updates the image in the registry — it does **not** automatically restart or
redeploy apps currently running from that image. They keep running whatever version they last
deployed until you restart or redeploy them yourself.
A rebuild is rejected if the image is already building, and an image can't be deleted while a
build is in progress either.
## Deploying an App From an Image
Once an image has built successfully, you can deploy it as an app directly from the dashboard —
give it a name, RAM, and optional description/subdomain/environment variables. This is the same as
creating a normal app, minus the file upload and minus language/version/entrypoint/custom command
— those come from the image itself.
Deploying multiple apps from the same image is fine; the dashboard shows every app currently
running from a given image alongside it.
## Auto-Rebuild on GitHub Push
Just like [Git integration](/tutorials/platform/git-integration) for regular apps, you can link a
GitHub repository to a custom image so every push triggers a fresh build automatically.
Go to **Config** → **Integrations** in the dashboard and connect your GitHub account, if you
haven't already.
From the image's page in the dashboard, choose the repository to link. Shard Cloud registers a
push webhook on the repository for you.
Every push to the linked repository starts a rebuild the same way a manual rebuild would —
same "does not auto-redeploy running apps" behavior applies.
You can unlink the repository at any time from the image's page to stop auto-rebuilding. This only
clears the link on Shard Cloud's side — it doesn't remove the webhook from the GitHub repository
itself.
## Deleting an Image
Deleting an image removes it from the registry entirely. This is blocked while a build is in
progress. Deleting an image also deletes **every app currently deployed from it** — there's
nothing left for those apps to run once the image is gone.
## Limits
| Limit | Value |
| -------------------------- | ---------------------------------------------------- |
| Build context size | 100MB, `.zip` only, `Dockerfile` at the archive root |
| Custom images — Core | 2 |
| Custom images — Pro | 6 |
| Custom images — Enterprise | 20 |
Limits apply to how many images you can have at once, regardless of their build status.
# 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
# Domains
Source: https://docs.shardcloud.app/domains
Buy a domain through Shard Cloud, or bring one you already own and point it at your apps and VMs.
Register a new domain directly through the platform
Point a domain you already own at Shard Cloud
A **domain** on Shard Cloud is a resource you can attach to your apps and VMs to serve them under your own hostname instead of the default `*.shardweb.app` subdomain or a raw VM IP. There are two ways to get one:
1. **Register a new domain** directly through Shard Cloud — we handle the purchase, renewal, and DNS.
2. **Bring your own domain (BYOD)** — use a domain you already own at another registrar by pointing its nameservers at Shard Cloud.
Both paths end up in the same place: an **active** domain, fully managed by Shard Cloud and ready to be pointed at an app or VM.
Bringing your own domain requires a **Core plan or higher**.
## Buying a Domain
Domains are registered through our registrar partner (Namesilo) and billed as a one-time invoice.
Search for a domain in the dashboard to get live availability and pricing, including up to 4
alternative TLD suggestions if your first pick is taken.
Choose how many years to register (1–5) and a payment method — credit card (a card-processing
fee applies) or PIX. Registering creates an invoice; the domain is only registered with the
registrar once that invoice is paid.
Once payment clears, Shard Cloud registers the domain and takes over its DNS automatically.
Auto-renew is enabled by default.
Most domains discount the first year of registration; years 2 and beyond (and all renewals) are
billed at the standard renewal rate, not a flat multiple of the first-year price. The dashboard
always shows the real per-year price before you buy.
## Bringing Your Own Domain
If you already own a domain at another registrar (Namecheap, GoDaddy, etc.), you can bring it to
Shard Cloud instead of transferring ownership — you keep the domain registered where it is, and
just delegate DNS to Shard Cloud.
Add the domain from the dashboard. Shard Cloud provisions a dedicated DNS zone for it and gives
you two nameservers to configure. The domain starts out in a pending state.
Log in to wherever the domain is currently registered and replace its nameservers with the pair
Shard Cloud gave you. This pair is unique to your domain — don't reuse nameservers from a
different domain.
Once the change propagates, verify it from the dashboard — or just wait, since a daily
background check does this automatically. Verification checks the real delegation status of
your domain, not just what nameservers you typed in, so it can't be spoofed by pointing at a
shared nameserver pair that isn't actually authoritative for your zone.
Once verified, the domain becomes active with Shard Cloud managing its DNS — from here it
behaves the same as a platform-registered domain.
Nameserver propagation can take up to 48 hours. If a domain sits unverified for more than 4 days,
it's automatically removed, freeing you to try again.
You can only have one domain awaiting verification at a time, and up to **15 external domains**
per account (this cap doesn't apply to domains you buy through the platform — those are
unlimited). We also do a quick registration check before setting anything up, so adding a domain
that isn't actually registered anywhere will be rejected.
## Using Your Domain
Once a domain is active — whether bought or brought — you can point it at an app or a VM straight
from the dashboard. Shard Cloud creates the necessary DNS records for you automatically:
Attaching a domain to an app creates the DNS record (and the validation records needed for
SSL) for you. If the app doesn't already have this hostname as a custom domain, it's claimed
automatically — apps can have up to 5 custom domains, and this requires a Core plan or higher.
Attaching a domain to a VM creates a DNS record pointing directly at the VM's IP address.
You can point the domain's apex (`example.com`) directly, or use a subdomain (`app.example.com`)
instead.
See [How to Set Up Your Custom Domain](/tutorials/platform/custom-domain) for the full
dashboard-driven walkthrough of attaching a custom domain to an app, including SSL and
troubleshooting.
A freshly registered domain needs about 30 minutes before its DNS delegation is confirmed and
it's ready to use this way — this happens automatically, no action needed.
### Managing DNS Records Directly
Beyond the app/VM shortcuts, you have full control over a domain's DNS: create, update, and delete
individual records (`A`, `CNAME`, `TXT`, `MX`, and more), switch the domain's SSL mode
(flexible/full), and purge its edge cache — all from the domain's page in the dashboard.
## Renewal
Renewal is handled automatically. An invoice is generated 20 days before expiry and gives you
15 days to pay; on payment, the domain is renewed and the expiry date updates. You can disable
auto-renew if you don't want this, re-enable it later, or renew on demand for 1–5 years at a
time — all from the domain's page in the dashboard.
Shard Cloud **never renews** an externally-registered domain — renewal happens at whichever
registrar you originally registered it with. Auto-renew and on-demand renewal are both
disabled for external domains; if the domain expires at its original registrar, DNS through
Shard Cloud stops working along with it.
## Deleting a Domain
Only externally-registered (BYOD) domains can be removed. Deleting one tears down its DNS zone
first, and only removes it from your account if that succeeds — so nothing is ever left dangling
with your DNS still delegated to it. Platform-registered domains aren't deleted this way; simply
let auto-renew lapse if you no longer want one.
# Welcome to Shard Cloud
Source: https://docs.shardcloud.app/index
Shard Cloud is a platform that provides user-friendly, reliable cloud hosting for your apps, bots, databases, and VMs. Get started in minutes.
## Instant deployment for modern developers
Shard Cloud is complete full-stack hosting for modern developers — apps, databases, domains,
APIs, virtual machines, CDN, and monitoring, all in one platform.
Deploy your first app or database in just a few steps.
Compare plans and find the right fit for your project.
Rated **Excellent** on [Trustpilot](https://www.trustpilot.com/review/shardcloud.app).
***
## 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 and full VMs. 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, MySQL, MongoDB, or Redis instances with optional
visual tools.
Deploy virtual private servers with full root access and customizable
configurations.
Deploy apps from your own Dockerfile instead of an auto-detected language
container.
***
## Platform Features
Once you're hosting something, Shard Cloud gives you the pieces to run a real production setup:
Buy a domain through Shard Cloud, or bring one you already own, and point
it at your apps and VMs.
Upload files and serve them globally with edge caching and image
compression built in.
***
## Developer Tools
Manage your Shard Cloud applications with our official CLI, VS Code extension, and GitHub Actions.
Deploy and manage apps from your terminal with the Shard Cloud CLI.
Deploy, monitor, and manage apps directly from VS Code.
Automate deployments with GitHub Actions CI/CD workflows.
***
## 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
## 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 **3 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.
**Applications and databases:** the limit follows the table below, applied equally to egress and ingress. For RAM values between two tiers, the limit is interpolated linearly, and it stays at **2000 Mbps** from 24GB of RAM upward. For example, an application with 512MB of RAM has **150** Mbps for both egress and ingress traffic. For databases with replicas, the limit is calculated from the RAM of each replica.
| RAM | Bandwidth (Mbps) |
| ----- | ---------------- |
| 256MB | 95 |
| 512MB | 150 |
| 1GB | 300 |
| 2GB | 500 |
| 4GB | 1000 |
| 8GB | 1250 |
| 12GB | 1500 |
| 16GB | 1750 |
| 24GB+ | 2000 |
**Virtual machines:** the limit is calculated using the formula **250 + (RAM\_MB/1024) × 75**, capped at **2000** Mbps. For example, a virtual machine with 4GB of allocated RAM will have **550** 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/60** . For example, a vps with 4GB of allocated RAM will have 68GB 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/6**. For example, a database with 2048MB of RAM would support **341** 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
Every project gets a fixed amount of CPU calculated from its **RAM** and your **plan**. It is computed per project, so each app, database, and VM is sized independently, and it is recalculated whenever you resize. CPU is measured in **mCPU** (1000 mCPU = 1 vCPU).
Your plan's vCPU count is always the upper bound for a single project. No project can be allocated more CPU than the plan allows.
### Apps and databases
Apps and databases use the same formula.
* **Under 1024 MB of RAM**: 1 vCPU (1000 mCPU).
* **1024 MB of RAM or more**: 2 vCPU (2000 mCPU) for the first 1024 MB, plus extra CPU for every additional GB of RAM, **only as far as your plan allows**. The plan cap applies to the 2 vCPU too, so on a 1 vCPU plan a project never gets more than 1 vCPU.
| Plan tier | Extra CPU per additional GB |
| ---------------- | --------------------------- |
| Basic, Core, Pro | 1.5 vCPU (1500 mCPU) |
| Enterprise | 1 vCPU (1000 mCPU) |
```
mCPU = 2000 + (RAM in MB - 1024) × rate / 1024 (capped at the plan's vCPU)
```
On the 1 vCPU plans (Free and Basic 1 GB) every project stays at 1 vCPU, since that is the plan cap.
**Databases with the visualizer**: the visualizer adds 512 MB of RAM to the database, but that extra RAM is **not** counted. The CPU is calculated from the database's own RAM only.
**Examples** (values in vCPU):
| Project RAM | Basic 2 GB | Core 4 GB | Pro 24 GB | Enterprise 32 GB |
| ----------- | ---------- | --------- | --------- | ---------------- |
| 512 MB | 1 | 1 | 1 | 1 |
| 1 GB | 2 | 2 | 2 | 2 |
| 2 GB | 2 (cap) | 3.5 | 3.5 | 3 |
| 4 GB | n/a | 4 (cap) | 6.5 | 5 |
| 8 GB | n/a | n/a | 10 (cap) | 9 |
| 16 GB | n/a | n/a | 10 (cap) | 12 (cap) |
`n/a` means the project would not fit in the plan's RAM.
### Virtual machines
VMs do not use the app formula. A VM gets a share of your plan's vCPU that is **proportional to its share of the plan's RAM**:
```
mCPU = (VM RAM / reference RAM) × plan vCPU
```
* **Reference RAM** is your plan's RAM. On **Enterprise** plans it is fixed at **32 GB**, regardless of the plan's total RAM, so larger Enterprise plans do not dilute the CPU of a 32 GB VM.
* The result is capped at the plan's vCPU.
* A VM always gets **at least 2 vCPU**.
* The result is **rounded to the nearest whole vCPU**, with halves rounded up.
**Examples** (values in vCPU):
| VM RAM | Core 4 GB (4 vCPU) | Core 8 GB (5 vCPU) | Pro 16 GB (8 vCPU) | Enterprise 32 GB (12 vCPU) | Enterprise 128 GB (14 vCPU) |
| ------ | ------------------ | ------------------ | ------------------ | -------------------------- | --------------------------- |
| 4 GB | 4 | 3 | 2 | 2 (minimum) | 2 (minimum) |
| 8 GB | n/a | 5 | 4 | 3 | 4 |
| 16 GB | n/a | n/a | 8 | 6 | 7 |
| 32 GB | n/a | n/a | n/a | 12 | 14 |
`n/a` means the VM would not fit in the plan's RAM.
# 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.
Deploy with GitHub Actions CI/CD workflows.
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 Use GitHub Actions for CI/CD
Source: https://docs.shardcloud.app/tutorials/platform/github-actions
Deploy your application to Shard Cloud directly from your GitHub workflows.
## Introduction
The ShardCloud GitHub Action allows you to deploy your application to Shard Cloud directly from your GitHub workflows. Automate deployments, backups, restarts, and more with simple workflow configurations.
This action installs the ShardCloud CLI and allows you to execute ShardCloud commands as part of your CI/CD pipeline.
***
## Prerequisites
Before setting up GitHub Actions, you'll need:
* A ShardCloud account
* A GitHub repository
* A ShardCloud API key (get it from [Dashboard](https://shardcloud.app/dash) → **Config** → **Integrations**)
***
## Setup
### Step 1: Get Your ShardCloud API Key
Go to the [Shard Cloud Dashboard](https://shardcloud.app/dash) and navigate
to **Config** → **Integrations**.
Generate or copy your API key. This key will be used to authenticate with
the ShardCloud CLI in your GitHub workflows.
### Step 2: Add Secret to GitHub
Go to your GitHub repository and navigate to **Settings** → **Secrets and
variables** → **Actions**.
Click **New repository secret** and create a secret with: - **Name**:
`SHARD_CLOUD_API_KEY` - **Value**: Your ShardCloud API key Click **Add
secret**.
Always store your API key in GitHub Secrets. Never hardcode it in your
workflow files or commit it to your repository.
### Step 3: Create Workflow File
Create a `.github/workflows/deploy.yml` file in your repository. You can use any of the examples below based on your needs.
***
## Usage Examples
### Basic Deployment
Deploy your application to Shard Cloud on every push to the main branch:
```yaml .github/workflows/deploy.yml theme={null}
name: Deploy to Shard Cloud
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Shard Cloud
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
commands: app commit
```
Replace `` with your actual Shard Cloud application ID. You can find
this in your application's dashboard URL or settings.
### Deploy and Restart
Commit your changes and restart the application in one workflow:
```yaml .github/workflows/deploy.yml theme={null}
name: Deploy and Restart
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy and Restart Application
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
commands: |
app commit
app restart
```
### Backup Before Deploy
Create a backup before deploying new changes to ensure you can rollback if needed:
```yaml .github/workflows/deploy.yml theme={null}
name: Backup and Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Backup and Deploy
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
commands: |
backup create
app commit
```
### Custom Working Directory
Execute commands from a specific directory (useful for monorepos):
```yaml .github/workflows/deploy.yml theme={null}
name: Deploy from Subdirectory
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy Application
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
workdir: ./my-app
commands: app commit
```
### Multi-Environment Deployment
Deploy to different environments based on the branch:
```yaml .github/workflows/deploy.yml theme={null}
name: Multi-Environment Deploy
on:
push:
branches:
- main
- staging
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Production
if: github.ref == 'refs/heads/main'
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
commands: |
backup create
app commit
app restart
- name: Deploy to Staging
if: github.ref == 'refs/heads/staging'
uses: shard-cloud/action@main
with:
token: ${{ secrets.SHARD_CLOUD_API_KEY }}
commands: app commit
```
***
## Action Inputs
The ShardCloud GitHub Action supports the following inputs:
| Input | Required | Default | Description |
| ---------- | -------- | ------- | --------------------------------------- |
| `token` | **Yes** | - | ShardCloud API Key (store in secrets) |
| `commands` | No | - | ShardCloud CLI commands to execute |
| `workdir` | No | `.` | Working directory for command execution |
***
## Available Commands
The action supports every ShardCloud CLI v2 command, which are grouped by resource: `shardcloud ` (`app`, `db`, `vm`, `backup`, `lb`, `image`). Common commands include:
* `app commit ` - Deploy changes to your application
* `app restart ` - Restart your application
* `backup create ` - Create a backup — this now works identically for apps, databases, and VMs, not just apps
* `app logs ` - View application logs
* And more - refer to the [ShardCloud CLI documentation](/cli/cli) for a complete list
***
## Best Practices
Always store your API key in GitHub Secrets. Never hardcode credentials.
Create backups before major deployments to ensure you can rollback if
needed.
Use specific branches for production deployments to prevent accidental
deployments.
Combine multiple commands to create complex deployment workflows.
***
## Troubleshooting
Verify that your `SHARD_CLOUD_API_KEY` secret is correctly set in your
repository settings. Ensure the API key is valid and hasn't expired. Check
the action logs for specific error messages.
Verify that your `commands` input is correctly formatted. For multiple
commands, use a multi-line string with `|`. Check that your `app_id` is
correct.
Check the action logs for specific error messages. Verify your `.shardcloud`
configuration is valid. Ensure all required files are in your repository.
Verify that the `workdir` path is correct relative to your repository root.
Ensure the directory exists in your repository.
***
## Additional Resources
* [ShardCloud GitHub Action Repository](https://github.com/shard-cloud/action)
* [ShardCloud CLI Documentation](/cli/cli)
* [GitHub Actions Documentation](https://docs.github.com/en/actions)
# 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
# Commands & Settings
Source: https://docs.shardcloud.app/vscode/commands
All available commands and configuration settings for the ShardCloud VS Code extension.
## Commands
All commands are available via the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`).
You can also access most commands by right-clicking in the ShardCloud sidebar or using the context menu.
***
### Authentication
| Command | Description |
| -------------------- | -------------------------------- |
| `ShardCloud: Login` | Authenticate with your API token |
| `ShardCloud: Logout` | Sign out of your account |
***
### Application Management
| Command | Description |
| ---------------------------------- | ------------------------------------------ |
| `ShardCloud: Deploy` | Deploy current workspace to the linked app |
| `ShardCloud: Deploy to App...` | Deploy to any app (select from list) |
| `ShardCloud: Start App` | Start the linked application |
| `ShardCloud: Stop App` | Stop the linked application |
| `ShardCloud: Restart App` | Restart the linked application |
| `ShardCloud: View Logs` | Stream application logs in real-time |
| `ShardCloud: Link to Existing App` | Link current workspace to an existing app |
***
### Quick Actions
| Command | Description |
| ------------------------------- | ----------------------------------------------- |
| `ShardCloud: Open in Dashboard` | Open the linked app in ShardCloud Dashboard |
| `ShardCloud: Open Website` | Open the app's website URL |
| `ShardCloud: Sync Config` | Sync `.shardcloud` config from the deployed app |
| `ShardCloud: Refresh` | Refresh the sidebar data |
***
## Extension Settings
Configure the extension in VS Code Settings (`Ctrl+,` / `Cmd+,`) or by editing your `settings.json` file.
### Available Settings
| Setting | Description | Default |
| -------------------------------- | -------------------------------- | ---------------------------- |
| `shardcloud.apiToken` | Your ShardCloud API token | - |
| `shardcloud.apiBaseUrl` | API endpoint URL | `https://shardcloud.app/api` |
| `shardcloud.autoRefreshInterval` | Auto-refresh interval in seconds | `30` |
| `shardcloud.showStatusBar` | Show ShardCloud status bar item | `true` |
***
### Configuration Examples
#### settings.json
```json theme={null}
{
"shardcloud.apiToken": "your-api-token-here",
"shardcloud.autoRefreshInterval": 60,
"shardcloud.showStatusBar": true
}
```
Never commit your API token to version control. Use VS Code's secure storage or set the token via the Login command.
***
## Keyboard Shortcuts
You can assign custom keyboard shortcuts to any ShardCloud command:
1. Open Keyboard Shortcuts (`Ctrl+K Ctrl+S` / `Cmd+K Cmd+S`)
2. Search for "ShardCloud"
3. Click the plus icon to add a keybinding
### Suggested Shortcuts
| Command | Suggested Shortcut |
| ------------------------- | ------------------ |
| `ShardCloud: Deploy` | `Ctrl+Shift+D` |
| `ShardCloud: View Logs` | `Ctrl+Shift+L` |
| `ShardCloud: Restart App` | `Ctrl+Shift+R` |
***
## Status Bar
When enabled, the status bar shows:
* **Connection status** - Whether you're logged in
* **Linked app name** - The currently linked application
* **Quick actions** - Click to access common commands
Click the status bar item to quickly access deploy, logs, and restart actions.
# .shardignore File
Source: https://docs.shardcloud.app/vscode/shardignore
Control which files are excluded from deployment with the .shardignore file.
## What is .shardignore?
The `.shardignore` file controls which files and folders are excluded from deployment when using the ShardCloud VS Code extension. It works similarly to `.gitignore`.
Files matching patterns in `.shardignore` will not be uploaded to ShardCloud, reducing deployment size and time.
***
## Creating .shardignore
Create a `.shardignore` file in your project root directory:
```bash theme={null}
# Dependencies
node_modules/
.pnpm-store/
vendor/
# Build outputs
dist/
build/
out/
.next/
# Dev files
.git/
.vscode/
.idea/
# Logs and temp files
*.log
*.tmp
.DS_Store
# Environment files (optional - may want to include)
.env.local
.env.development
```
***
## Pattern Syntax
The `.shardignore` file supports standard glob patterns:
| Pattern | Description | Example |
| ------------ | -------------------------- | ---------------- |
| `folder/` | Ignore entire directory | `node_modules/` |
| `*.ext` | Ignore files by extension | `*.log` |
| `filename` | Ignore specific file | `.DS_Store` |
| `**/pattern` | Match in any directory | `**/*.test.js` |
| `!pattern` | Negate (include) a pattern | `!important.log` |
***
## Common Examples
### Node.js Project
```bash theme={null}
node_modules/
.pnpm-store/
dist/
build/
.next/
coverage/
*.log
.env.local
```
### Python Project
```bash theme={null}
__pycache__/
*.pyc
.venv/
venv/
.pytest_cache/
*.egg-info/
dist/
build/
```
### General Development
```bash theme={null}
# Version control
.git/
.svn/
# IDEs
.vscode/
.idea/
*.swp
*.swo
# OS files
.DS_Store
Thumbs.db
# Test files
*.test.js
*.spec.js
__tests__/
```
***
## Best Practices
Dependencies are installed automatically on ShardCloud.
Build artifacts are regenerated during deployment.
Include `.shardcloud` and necessary config files.
Check what's being uploaded in the extension output.
Don't ignore your `.shardcloud` config file or essential source files needed for your application to run.
***
## Troubleshooting
Ensure the pattern is correct. Directory patterns should end with `/`.
Check for typos in file/folder names.
You may have ignored essential files. Review your `.shardignore` and ensure
source files and configs are included.
Add more patterns to exclude large directories like `node_modules/`, build
outputs, and test files.
# Shard Cloud VS Code Extension
Source: https://docs.shardcloud.app/vscode/vscode
Manage your ShardCloud applications and databases directly from VS Code.
## Installation
Install the extension from the VS Code Marketplace:
Get the official ShardCloud extension from the Visual Studio Marketplace.
Or search for **"ShardCloud"** in the VS Code Extensions panel (`Ctrl+Shift+X` / `Cmd+Shift+X`).
### Cursor Users
For Cursor IDE, download the VSIX file directly and install it manually:
Download the .vsix file for manual installation in Cursor.
To install in Cursor:
1. Download the VSIX file
2. Open Cursor and go to the Extensions tab (`Ctrl+Shift+X` / `Cmd+Shift+X`)
3. Drag and drop the downloaded `.vsix` file into the Extensions panel
***
## Features
Deploy, start, stop, and restart your applications with one click.
View, manage, and connect to your databases from the sidebar.
Stream application logs directly in VS Code via SSE.
Monitor RAM and CPU usage at a glance.
### 🚀 Application Management
* **Deploy** your code to ShardCloud with one click
* **Start, Stop, Restart** your applications
* **View Logs** in real-time (SSE streaming)
* **Monitor Resources** - RAM, CPU usage at a glance
### 💾 Database Management
* View all databases in the sidebar
* Start/Stop databases
* Copy connection link for quick access
* Copy database ID
### 📝 .shardcloud Config Support
* **IntelliSense** - Auto-completion for config keys
* **Validation** - Real-time error checking
* **Hover docs** - Documentation on hover
* **File auto-completion** for `MAIN=` field
### 🔗 Quick Actions
* Link existing apps to your workspace
* Sync `.shardcloud` config from deployed apps
* Open apps in ShardCloud Dashboard
* Access websites directly
***
## Getting Started
Click the ShardCloud icon in the sidebar and enter your API token.
Get your token from [ShardCloud Dashboard](https://shardcloud.app/dash) → **Config** → **Integrations**
Click **"Link to Existing App"** in the Current App panel, or create a `.shardcloud` file manually.
Right-click your app → **"Deploy to App"**, or use the Deploy button in the Current App panel.
***
## .shardcloud Config
Create a `.shardcloud` file in your project root:
```bash theme={null}
# App configuration
APPID=your-app-id
NAME=my-app
MAIN=src/index.ts
RAM=512
VERSION=recommended
SUBDOMAIN=myapp
```
The extension provides IntelliSense and validation for this file.
***
## Learn More
Control which files are excluded from deployment.
View all available commands and configuration options.
***
## Troubleshooting
Ensure you're logged in with a valid API token. Try logging out and back in.
Check that your token has the correct permissions.
Check the Output panel (`View` → `Output` → `ShardCloud`) for error details.
Verify your `.shardcloud` config is valid and `APPID` is set correctly.
Ensure your application is running. Check your network connection.
Try restarting the log stream.
Reload VS Code window (`Ctrl+Shift+P` → `Developer: Reload Window`).
Ensure the extension is enabled.
***
## Need Help?
Chat with developers, ask questions, and share feedback in our community
Discord server.