Self-Hosted Supabase Utilities
Deploy and manage Supabase Edge Functions and migrations on Coolify-hosted Supabase.
npm install -g shsu
# or use directly
npx shsuRun the init command to configure your project:
npx shsu initThis adds config to your package.json:
{
"shsu": {
"server": "root@your-coolify-server",
"remotePath": "/data/coolify/services/YOUR_SERVICE_ID/volumes/functions",
"url": "https://your-supabase.example.com",
"edgeContainer": "edge",
"dbContainer": "postgres"
}
}remotePath - SSH to your server and run:
docker inspect $(docker ps -q --filter 'name=edge') | grep -A 5 "Mounts"Container names - SSH to your server and run docker ps to list containers. Coolify names containers using the pattern <service>-<uuid> (e.g., abc123-supabase-edge-functions-1). The filter does substring matching, so edge matches any container with "edge" in its name.
# Configure project
shsu init
# Show current configuration
shsu env
# Deploy all functions
shsu deploy
# Deploy single function
shsu deploy hello-world
# Deploy without restarting edge-runtime
shsu deploy hello-world --no-restart
# Run database migrations
shsu migrate
# Stream logs
shsu logs
# Stream logs filtered by function name
shsu logs hello-world
# List local and remote functions
shsu list
# Invoke a function
shsu invoke hello-world '{"name":"Stefan"}'
# Create new function from template
shsu new my-function
# Restart edge-runtime
shsu restartPlace SQL files in ./supabase/migrations/ (or your configured migrationsPath). Files are sorted alphabetically and executed in order.
supabase/migrations/
001_create_users.sql
002_add_email_index.sql
Run with:
shsu migrateConfig is read from package.json "shsu" key. Environment variables override package.json values.
| Key / Env Var | Required | Description |
|---|---|---|
server / SHSU_SERVER |
Yes | SSH host (e.g., root@your-server.com) |
remotePath / SHSU_REMOTE_PATH |
Yes | Remote path to functions directory |
url / SHSU_URL |
For invoke |
Supabase URL |
localPath / SHSU_LOCAL_PATH |
No | Local functions path (default: ./supabase/functions) |
migrationsPath / SHSU_MIGRATIONS_PATH |
No | Local migrations path (default: ./supabase/migrations) |
edgeContainer / SHSU_EDGE_CONTAINER |
No | Edge runtime container filter (default: edge) |
dbContainer / SHSU_DB_CONTAINER |
No | Database container filter (default: postgres) |
shsu can run as an MCP server for AI assistants.
Add to .mcp.json in your project root:
{
"mcpServers": {
"shsu": {
"command": "npx",
"args": ["shsu", "mcp"]
}
}
}Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"shsu": {
"command": "npx",
"args": ["shsu", "mcp"],
"cwd": "/path/to/your/project"
}
}
}Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"shsu": {
"command": "npx",
"args": ["shsu", "mcp"]
}
}
}deploy- Deploy edge functionsmigrate- Run database migrationslist- List local and remote functionsinvoke- Invoke a functionrestart- Restart edge-runtimenew- Create new function from templateconfig- Show current configurationdocs- Get setup documentation
npm version patch # or minor/major
git push --follow-tagsGitHub Actions will automatically publish to npm when the tag is pushed.
MIT