Run StaticBackend on your own infrastructure with full control over your data and deployment.
StaticBackend is open source and free to self-host. You can deploy it on any server, cloud platform, or local machine.
You should self-host if you need:
Consider managed hosting if you:
We offer three ways to self-host, from easiest to most customizable:
Best for: Quick setup, development, production
Uses Docker Compose to run everything with one command. No manual configuration needed.
Best for: Lightweight deployments, specific OS requirements
Download a ready-to-run binary for Linux, macOS, or Windows. You manage the database separately.
Best for: Contributing to the project, custom modifications
Clone the repository and build with Go. Full control and customization.
The fastest way to get StaticBackend running. Everything included.
git clone https://github.com/staticbackendhq/core.git
cd core
Copy the demo environment file:
cp .demo.env .env
The defaults work for development. For production, update .env with your settings.
If you have make:
make docker
Otherwise:
docker build . -t staticbackend:latest
docker-compose -f docker-compose-demo.yml up
That’s it! StaticBackend is now running at http://localhost:8099
Save these credentials - you’ll need them to connect your app.
The Docker setup includes:
Download a pre-built binary and run it with your own database.
Get the latest release for your OS: GitHub Releases
Available for:
Option A: Use Docker for services only
# PostgreSQL + Redis
docker-compose up
# Or MongoDB + Redis
docker-compose -f docker-compose-mongo.yml up
Option B: Install natively
Install PostgreSQL (or MongoDB) and Redis on your system. Refer to their official documentation.
Create a .env file with your settings:
APP_ENV=dev
DATABASE_URL=postgresql://user:password@localhost:5432/staticbackend
# Or for MongoDB: mongodb://localhost:27017
DATA_STORE=pg # or 'mongo' for MongoDB
REDIS_HOST=localhost:6379
REDIS_PASSWORD=your-redis-password
FROM_EMAIL=you@domain.com
FROM_NAME=Your Name
JWT_SECRET=your-secret-key-here
MAIL_PROVIDER=dev # or 'ses' for AWS SES
STORAGE_PROVIDER=local # or 's3' for AWS S3
LOCAL_STORAGE_URL=http://localhost:8099
Make the binary executable (Linux/macOS):
chmod +x staticbackend
./staticbackend
Windows:
staticbackend.exe
StaticBackend is now running at http://localhost:8099
Follow the same process as Docker setup to create your first app.
Build StaticBackend from source for complete control.
git clone https://github.com/staticbackendhq/core.git
cd core
Create your .env file (see Binary Setup for example).
Use Docker for services:
docker-compose up
Or install PostgreSQL/MongoDB and Redis natively.
With make (Linux/macOS):
make start
Or manually:
cd cmd
go build -o staticbackend
./staticbackend
Windows:
cd cmd
go build -o staticbackend.exe
staticbackend.exe
Update your .env file for production:
APP_ENV=production
DATABASE_URL=your-production-db-url
# Use AWS SES for emails
MAIL_PROVIDER=ses
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_SES_ENDPOINT=https://email.us-east-1.amazonaws.com
AWS_REGION=us-east-1
# Use S3 for file storage
STORAGE_PROVIDER=s3
AWS_S3_BUCKET=your-bucket-name
AWS_CDN_URL=https://your-cdn-url.com
Before deploying to production:
JWT_SECRET (random 32+ characters)StaticBackend runs anywhere Go applications run:
Install the CLI to manage your instance:
npm install -g @staticbackend/cli
Create a .backend.yml file in your project:
region: dev
Create an account:
backend account create your@email.com
Manage your database, users, and functions via CLI commands.
To update your self-hosted instance:
git pulldocker build . -t staticbackend:latest or recompiledocker-compose restart or restart the binaryNeed simpler setup? Try managed hosting - same features, zero DevOps.
Questions? Check our GitHub Discussions or contact us.
If you already have a working Docker and Docker Compose environment you can be up and running with a fully working development mode instance.
Clone or download our core repository
$> git clone git@github.com:staticbackendhq/core.git
$> cd core
Create a .env file. You may start from the provided .demo.env:
$> cp .demo.env .env
Build the staticbackend:latest image.
If you have make available
$> make docker
Otherwise
$> docker build . -t staticbackend:latest
Run the backend and all required services via the demo docker-compose file we provide:
$> docker-compose -f docker-compose-demo.yml up
Leave the terminal open as you’ll need it to grab your app tokens.
From there you’re fully setup to start building your app.
Check out our documentation and select your desired programming language.
If you don’t have or want to use Docker, here’s how you can get started with a more manual setup.
You may use the pre-built binaries for Linux, MacOS and Windows we provide on the release page on our GitHub repo.
You will need to clone or download the code:
$> git clone git@github.com:staticbackendhq/core.git
$> cd core
Either copy the binary in that directory or build the server (see later).
StaticBackend relies heavily on either PostgreSQL or MongoDB, and Redis.
Here are the environment variables you’ll need.
APP_ENV=dev
MAIL_PROVIDER=dev or ses
STORAGE_PROVIDER=local or s3
DATABASE_URL=mongodb://localhost:27017 or user=postgres password=postgres dbname=postgres sslmode=disable
DATA_STORE=mongo or pg
REDIS_HOST=localhost:6379
REDIS_PASSWORD=your-redis-pw
FROM_EMAIL=you@domain.com
FROM_NAME=your-name
JWT_SECRET=something-here
If you’re going to use the AWS implementation for sending email (ses) and file
storage (s3) you’ll need those environment variables:
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_SECRET_KEY=your-aws-key
AWS_SES_ENDPOINT=https://email.us-east-1.amazonaws.com
AWS_REGION=us-east-1
AWS_S3_BUCKET=your.bucketname.here
AWS_CDN_URL=https://your.cdnurlhere.com
The DATA_STORE determines if StaticBackend stores its data in PostgreSQL or
MongoDB. Therefore, the DATABASE_URL should match your choice of data
persistence.
For the local file storage you’ll need this one:
LOCAL_STORAGE_URL=http://your.domain.com
Create an .env file at the root of the core project with the proper values
for each variables.
The simplest way to provides the necessary services (PostgreSQL or MongoDB and Redis) is via Docker.
$> docker-compose up
This will start a PostgreSQL and Redis servers.
For MongoDB you may use the proper docker-compose file:
$> docker-compose -f docker-compose-mongo.yml up
This will start a MongoDB and Redis servers that are needed by StaticBackend.
Please note: The docker-compose-demo.yml is used to run all services and
the backend server. If you’re using a binary or compiling the source you
may use the docker-compose.yml file.
You may install and run native PostgreSQL or MongoDB and Redis servers if you do not have access to Docker. Please refer to PostgreSQL, MongoDB, and Redis own documentation for how to install native servers on your development computer.
If you’ve downloaded the binary for your OS you don’t need to compile the source.
You’ll need Go 1.16+ installed to compile the core project.
Refer to this page to install Go.
If you are running Linux you most certainly have make available. Here’s how
to build and start the server locally:
$> make start
This compile and start the server using the .env file to setup the proper
environment variables.
Your StaticBackend instance runs under http://localhost:8099
If you do not have make available.
$> cd cmd && go build -o staticbackend && ./staticbackend
Replace ./staticbackend for staticbackend.exe if you’re on Windows.
To start using your StaticBackend instance you’ll need to create an account for your app.
The easiest way is:
staticbackend is running and you’ll see all
your app’s credentials and tokens.You may also use our CLI.
Please refer to the documentation on how to install the version for your OS.
Once installed, add the following config file to your current directory:
.backend.yml:
region: dev
Than execute this command:
$> backend account create you@domain.com
This will create your account, a new database and an admin user with a
root token to execute database request on server-side on behalf of other user.
You may now create your application and have a new .backend.yml with the
created account info inside so any command you issue with the CLI in your
application directory will be targeting this new account and database.
From there you may start using our client or server libraries with the tokens you received.
Refer to the documentation for more information about what you can do with your backend.
© 2023 Focus Centric Inc. All rights reserved.