A performant self-hosted backend API for your web / mobile apps, done in Golang

Golang Rest API Backend

A simple backend API handles user management, database, file storage, forms, real-time experiences via channel/topic-based communication, and server-side functions for web and mobile applications.

You can think of it as a lightweight Firebase replacement you may self-host. Less vendor lock-in, and your data stay in your control.

Table of content

  • What can you build
  • How it works / dev workflow
  • Get started with the self-hosted version
  • Documentation
  • Python, JavaScript, and Golang Libraries & CLI
  • Examples
  • Deploying in production

What can you build with this Golang Opensource Project

StaticBackend is made with the mindset of someone tired of writing the same code over and over on the backend. If your application needs one or all of user management, database, file storage, and real-time interactions, it should be a good fit.

It can be used from the client side and/or server side.

How it works / dev workflow

The main idea is that StaticBackend is your backend API for your applications. A performant free and open-source self-hosted Firebase alternative.

Note that it can also be used from your backend code as well.

Once you have an instance running and your first app created, you may install the JavaScript client-side library:

$> npm install @staticbackend/js

Let’s create a user account and get a session token and create a task document in the tasks collection:

import { Backend } from "@staticbackend/js";

const bkn = new Backend("your_public-key", "dev");

let token = "";

login = async () => {
	const res = await bkn.register("[email protected]", "password");
	if (!res.ok) {
	token = res.content;


createTask = async () => {
	const task = {
		desc: "Do something for XYZ",
		done: false

	const res = bkn.create(token, "tasks", task);
	if (!res.ok) {

The last console.log prints

	"id": "123456-unique-id",
	"accountId": "aaa-bbb-unique-account-id",
	"desc": "Do something for XYZ",
	"done": false

You build your application using the database CRUD and query functions, the real-time component, the storage API, etc.

StaticBackend provides commonly used building blocks for web applications.

You may use server-side libraries for Node, Python, and Golang or use an HTTP client and use your preferred language.

Get started with the self-hosted version

Docker or manual setup

Get started with self-hosted version

Click on the image above to see a video showing how to get started with the self-hosted version.

Please refer to this guide here.

We also have this blog post that includes the above video.

If you have Docker & Docker Compose ready, here’s how you can have your server up and running in dev mode in 30 seconds:

$> git clone [email protected]:staticbackendhq/core.git
$> cd core
$> cp .demo.env .env
$> docker build . -t staticbackend:latest
$> docker-compose -f docker-compose-demo.yml up

Test your instance:

$> curl -v http://localhost:8099/db/test

You should get an error as follow:

< HTTP/1.1 401 Unauthorized
< Content-Type: text/plain; charset=utf-8
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< X-Content-Type-Options: nosniff
< Date: Tue, 03 Aug 2021 11:40:15 GMT
< Content-Length: 33
invalid StaticBackend public key

This is normal, as you’re trying to request a protected API, but you’re all set.

The next step is to visit http://localhost:8099 and create your first app. Please note that in dev mode, you’ll have to look at your docker compose output terminal to see the content of the email after creating your app. This email contains all the keys and your superuser account information.