1backend

1backend

A common backend for your AI applications—microservices-based and built to scale.

Stars: 2156

Visit
 screenshot

1Backend is a flexible and scalable platform designed for running AI models on private servers and handling high-concurrency workloads. It provides a ChatGPT-like interface for users and a network-accessible API for machines, serving as a general-purpose backend framework. The platform offers on-premise ChatGPT alternatives, a microservices-first web framework, out-of-the-box services like file uploads and user management, infrastructure simplification acting as a container orchestrator, reverse proxy, multi-database support with its own ORM, and AI integration with platforms like LlamaCpp and StableDiffusion.

README:

1Backend

backend build frontend build go client build js client build go sdk
A common backend for your AI applications—microservices-based and built to scale.
1backend.com

1Backend started as a microservices PaaS and then evolved into a flexible and scalable platform designed for running AI models on private servers and handling high-concurrency workloads.

Built by engineers who’ve spent over a decade building and scaling microservices in fast-moving startups, 1Backend provides both a ChatGPT-like interface for users and a network-accessible API for machines—while also serving as a general-purpose backend framework.

Highlights

  • On-premise ChatGPT alternative – Run your AI models locally through a UI, CLI or API.
  • A "microservices-first" web framework – Think of it like Angular for the backend, built for large, scalable enterprise codebases.
  • Out-of-the-box services – Includes built-in file uploads, downloads, user management, and more.
  • Infrastructure simplification – Acts as a container orchestrator, reverse proxy, and more.
  • Multi-database support – Comes with its own built-in ORM.
  • AI integration – Works with LlamaCpp, StableDiffusion, and other AI platforms.

Starting

Easiest way to run 1Backend is with Docker. Install Docker if you don't have it. Step into repo root and:

docker compose up

to run the platform in foreground. It stops running if you Ctrl+C it. If you want to run it in the background:

docker compose up -d

Using

Now that the 1Backend is running you have a few options to interact with it.

UI

You can go to http://127.0.0.1:3901 and log in with username 1backend and password changeme and start using it just like you would use ChatGPT.

Click on the big "AI" button and download a model first. Don't worry, this model will be persisted across restarts (see volumes in the docker-compose.yaml).

Clients

For brevity the below example assumes you went to the UI and downloaded a model already. (That could also be done in code with the clients but then the code snippet would be longer).

Let's do a sync prompting in JS. In your project run

npm init -y && jq '. + { "type": "module" }' package.json > temp.json && mv temp.json package.json
npm i -s @1backend/client

Make sure your package.json contains "type": "module", put the following snippet into index.js

import { UserSvcApi, PromptSvcApi, Configuration } from "@1backend/client";

async function testDrive() {
  let userService = new UserSvcApi();
  let loginResponse = await userService.login({
    body: {
      slug: "1backend",
      password: "changeme",
    },
  });

  const promptSvc = new PromptSvcApi(
    new Configuration({
      apiKey: loginResponse.token?.token,
    })
  );

  // Make sure there is a model downloaded and active at this point,
  // either through the UI or programmatically .

  let promptRsp = await promptSvc.prompt({
    body: {
      sync: true,
      prompt: "Is a cat an animal? Just answer with yes or no please.",
    },
  });

  console.log(promptRsp);
}

testDrive();

and run

$ node index.js
{
  prompt: {
    createdAt: '2025-02-03T16:53:09.883792389Z',
    id: 'prom_emaAv7SlM2',
    prompt: 'Is a cat an animal? Just answer with yes or no please.',
    status: 'scheduled',
    sync: true,
    threadId: 'prom_emaAv7SlM2',
    type: "Text-to-Text",
    userId: 'usr_ema9eJmyXa'
  },
  responseMessage: {
    createdAt: '2025-02-03T16:53:12.128062235Z',
    id: 'msg_emaAzDnLtq',
    text: '\n' +
      'I think the question is asking about dogs, so we should use "Dogs are animals". But what about cats?',
    threadId: 'prom_emaAv7SlM2'
  }
}

Depending on your system it might take a while for the AI to respond. In case it takes long check the backend logs if it's processing, you should see something like this:

1backend-backend-1   | {"time":"2024-11-27T17:27:14.602762664Z","level":"DEBUG","msg":"LLM is streaming","promptId":"prom_e3SA9bJV5u","responsesPerSecond":1,"totalResponses":1}
1backend-backend-1   | {"time":"2024-11-27T17:27:15.602328634Z","level":"DEBUG","msg":"LLM is streaming","promptId":"prom_e3SA9bJV5u","responsesPerSecond":4,"totalResponses":9}

CLI

Install oo to get started (at the moment you need Go to install it):

go install github.com/1backend/1backend/cli/oo@latest
$ oo env add local http://127.0.0.1:58231

$ oo env ls
ENV NAME   SELECTED   URL                           DESCRIPTION
local      *          http://127.0.0.1:58231
$ oo login 1backend changeme

$ oo whoami
slug: 1backend
id: usr_e9WSQYiJc9
roles:
- user-svc:admin
$ oo post /prompt-svc/prompt --sync=true --prompt="Is a cat an animal? Just answer with yes or no please."
# see example response above...

Context

1Backend is a microservices-based AI platform, the seeds of which began taking shape in 2013 while I was at Hailo, an Uber competitor. The idea stuck with me and kept evolving over the years – including during my time at Micro, a microservices platform company. I assumed someone else would eventually build it, but with the AI boom and the wave of AI apps we’re rolling out, I’ve realized it’s time to build it myself.

Run On Your Servers

See the Running the daemon page to help you get started.

Services

For articles about the built-in services see the Built-in services page. For comprehensive API docs see the 1Backend API page.

Run On Your Laptop/PC

We have temporarily discontinued the distribution of the desktop version. Please refer to this page for alternative methods to run the software.

License

1Backend is licensed under AGPL-3.0.

For Tasks:

Click tags to check more tools for each tasks

For Jobs:

Alternative AI tools for 1backend

Similar Open Source Tools

For similar tasks

For similar jobs