Skip to main content

Overview

Stormkit can run long-running server processes using the Start command setting. This is different from serverless functions and is ideal for:
  • Go HTTP servers
  • Python web applications
  • Node.js Express/Fastify apps
  • Ruby on Rails applications
  • Any application that runs a persistent process
The Start command option is only available on self-hosted Stormkit instances. It is not available on Stormkit Cloud.

How It Works

When you configure a start command:
  1. Build command runs during deployment
  2. Build artifacts are packaged
  3. Start command launches your server process
  4. Server listens on the PORT environment variable
  5. Traffic is routed to your running server
Unlike serverless functions that spin up on-demand, start command applications run continuously.

Configuration

Basic Setup

1

Navigate to Config

Go to Your App > Environments > Config
2

Set Build Command

Configure how to build your application
3

Set Output Folder

Specify where build artifacts are located
4

Set Start Command

Enter the command to start your server

Required Settings

  • Build command: Command to compile/build your application
  • Output folder: Directory containing server executable and files
  • Start command: Command to start the server process

Go Applications

Run Go HTTP servers by compiling a binary and starting it with the start command.

Requirements

  • go.mod file in your build root
  • Go runtime version specified via .go-version or mise.toml
  • Server must listen on PORT environment variable

Runtime Version

Configuration Example

In Your App > Environments > Config:

Server Code Example

cmd/server/main.go

With Gin Framework

cmd/server/main.go

Deployment Flow

1

Build Phase

go build -o .stormkit/server/app ./cmd/serverCompiles your Go code into a binary at .stormkit/server/app
2

Upload Phase

The .stormkit/server folder is packaged and uploaded as the server artifact
3

Runtime Phase

Start command ./app executes the binaryServer listens on PORT and handles incoming requests

Including Assets

If your Go app needs templates, migrations, or other files:
All files in .stormkit/server are deployed with your binary.

Node.js Applications

Run Express, Fastify, or any Node.js HTTP server.

Configuration Example

Server Code Example

server/index.js

With TypeScript

server/index.ts

Build Configuration

tsconfig.json

Python Applications

Run Flask, Django, or FastAPI applications.

Requirements

  • requirements.txt or Pipfile
  • Python version specified via .python-version or mise.toml
  • Server must listen on PORT environment variable

Runtime Version

Flask Example

app.py

Configuration

FastAPI Example

main.py

Configuration

Environment Variables

PORT Variable

Your server must listen on the PORT environment variable:
Stormkit sets PORT at runtime. Using a hardcoded port will cause connection failures.

Custom Environment Variables

All environment variables configured in Config > Environment Variables are available to your server:

Static Assets

Serve static files alongside your server application.

Go Example with Static Files

Node.js Example with Static Files

Health Checks

Implement a health check endpoint for monitoring:

Graceful Shutdown

Handle shutdown signals properly:

Go Example

Node.js Example

Best Practices

Use Compiled Binaries (Go)

Compiled binaries start faster and have fewer dependencies.

Include Dependencies

For Node.js, install production dependencies:
For Python:

Log to stdout/stderr

Use standard output for logs:
Logs are captured by Stormkit and viewable in deployment logs.

Set Timeouts

Configure appropriate timeouts:

Troubleshooting

Server Not Starting

If your server doesn’t start:
  • Check logs in deployment details
  • Verify start command path is correct
  • Ensure executable permissions (Go binaries)
  • Check for missing dependencies

Connection Refused

If you can’t connect to your server:
  • Verify server listens on PORT environment variable
  • Ensure server binds to 0.0.0.0, not localhost
  • Check firewall settings (self-hosted)

Build Failures

If build command fails:
  • Check build command syntax
  • Verify runtime version is installed
  • Ensure all dependencies are listed
  • Review build logs for errors

Missing Files

If assets or dependencies are missing:
  • Verify output folder includes all required files
  • Copy assets during build command
  • Check that build artifacts are in correct location

Comparison: Start Command vs Serverless

How We Deploy

Understand folder structure and deployment artifacts

Configuration

Configure build and deployment settings

System Variables

Available environment variables

Troubleshooting

Fix common deployment issues