Convert Figma logo to code with AI

bknd-io logobknd

Lightweight Firebase/Supabase alternative built to run anywhere β€” incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

3,299
115
3,299
23

Top Related Projects

86,485

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

52,090

Build like a team of hundreds_

Parse Server for Node.js / Express

Blazing fast, instant realtime GraphQL APIs on all your data with fine grained access control, also trigger webhooks on database events.

68,900

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.

31,857

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.

Quick Overview

BKND is an open-source backend-as-a-service (BaaS) platform designed to simplify and accelerate web and mobile application development. It provides a suite of tools and services for managing databases, authentication, file storage, and API creation, allowing developers to focus on building frontend experiences without worrying about backend infrastructure.

Pros

  • Offers a comprehensive set of backend services in a single platform
  • Provides easy-to-use SDKs for multiple programming languages
  • Supports real-time data synchronization across devices
  • Includes built-in security features and user authentication

Cons

  • Limited customization options compared to building a custom backend
  • Potential vendor lock-in due to tight integration with BKND services
  • May have performance limitations for high-traffic applications
  • Learning curve for developers new to BaaS platforms

Code Examples

  1. Initializing BKND in a JavaScript application:
import { BKND } from '@bknd/sdk';

const bknd = new BKND({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});
  1. Creating a new user:
const newUser = await bknd.auth.createUser({
  email: 'user@example.com',
  password: 'securePassword123'
});
console.log('New user created:', newUser);
  1. Querying data from a BKND database:
const users = await bknd.db.collection('users')
  .where('age', '>', 18)
  .orderBy('name', 'asc')
  .limit(10)
  .get();

users.forEach(user => console.log(user.data()));

Getting Started

To start using BKND in your project:

  1. Sign up for a BKND account at https://bknd.io
  2. Create a new project in the BKND dashboard
  3. Install the BKND SDK in your application:
npm install @bknd/sdk
  1. Initialize BKND in your code:
import { BKND } from '@bknd/sdk';

const bknd = new BKND({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});
  1. Start using BKND services in your application!

Competitor Comparisons

86,485

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Pros of Supabase

  • More comprehensive feature set, including authentication, storage, and real-time subscriptions
  • Larger community and ecosystem, with more resources and third-party integrations
  • Better documentation and learning resources for developers

Cons of Supabase

  • More complex setup and configuration process
  • Steeper learning curve for beginners due to its extensive feature set
  • Less flexibility in customizing the underlying database structure

Code Comparison

Supabase (JavaScript):

import { createClient } from '@supabase/supabase-js'

const supabase = createClient('YOUR_SUPABASE_URL', 'YOUR_SUPABASE_KEY')

const { data, error } = await supabase
  .from('users')
  .select('*')

BKND (JavaScript):

import { BKND } from '@bknd/sdk'

const bknd = new BKND('YOUR_API_KEY')

const users = await bknd.collection('users').find()

Both examples demonstrate basic setup and querying, but Supabase's approach is more SQL-like, while BKND uses a MongoDB-style syntax. Supabase offers more built-in features, while BKND focuses on simplicity and ease of use for basic backend operations.

52,090

Build like a team of hundreds_

Pros of Appwrite

  • More comprehensive feature set, including authentication, databases, storage, and functions
  • Larger community and more active development (20k+ stars, 500+ contributors)
  • Extensive documentation and tutorials for easier onboarding

Cons of Appwrite

  • Steeper learning curve due to more complex architecture
  • Requires more resources to run and maintain
  • May be overkill for smaller projects or simpler use cases

Code Comparison

Appwrite (JavaScript SDK):

const sdk = new Appwrite();
sdk
    .setEndpoint('https://[HOSTNAME_OR_IP]/v1')
    .setProject('[PROJECT_ID]');

const account = sdk.account;
const user = await account.create('[USER_ID]', 'email@example.com', 'password');

BKND (JavaScript):

const bknd = new BKND('YOUR_API_KEY');
const user = await bknd.users.create({
  email: 'email@example.com',
  password: 'password'
});

Both repositories provide backend-as-a-service solutions, but Appwrite offers a more feature-rich platform with a larger ecosystem. BKND focuses on simplicity and ease of use, making it potentially more suitable for smaller projects or developers looking for a straightforward solution. The code comparison shows that while both offer user creation functionality, Appwrite's SDK requires more setup but provides more granular control over the project and endpoint configuration.

Parse Server for Node.js / Express

Pros of Parse Server

  • More mature and established project with a larger community and ecosystem
  • Extensive documentation and tutorials available
  • Supports multiple database backends (MongoDB, PostgreSQL)

Cons of Parse Server

  • Steeper learning curve for beginners
  • Requires more setup and configuration compared to bknd
  • May be overkill for smaller projects or simple use cases

Code Comparison

Parse Server configuration:

const api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/dev',
  appId: 'myAppId',
  masterKey: 'myMasterKey',
  serverURL: 'http://localhost:1337/parse'
});

bknd configuration:

const bknd = require('bknd');

bknd.init({
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
});

Parse Server offers more granular control over configuration options, while bknd provides a simpler setup process. Parse Server's configuration allows for customization of database connections, server URLs, and security keys, whereas bknd's initialization focuses on API key and project ID.

Both projects aim to simplify backend development, but Parse Server offers more flexibility and features at the cost of complexity, while bknd prioritizes ease of use and quick setup for smaller projects or rapid prototyping.

Blazing fast, instant realtime GraphQL APIs on all your data with fine grained access control, also trigger webhooks on database events.

Pros of graphql-engine

  • More mature and widely adopted project with a larger community
  • Offers a comprehensive GraphQL API solution with built-in authorization
  • Provides real-time subscriptions out of the box

Cons of graphql-engine

  • Steeper learning curve due to its extensive feature set
  • Requires more setup and configuration compared to bknd
  • May be overkill for simpler projects that don't need all its features

Code Comparison

graphql-engine (Hasura) configuration:

version: '3.6'
services:
  postgres:
    image: postgres:12
  graphql-engine:
    image: hasura/graphql-engine:v2.x.x
    environment:
      HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:@postgres:5432/postgres

bknd configuration:

version: '3'
services:
  bknd:
    image: bknd/bknd:latest
    environment:
      BKND_DB_URL: postgres://postgres:@postgres:5432/postgres

Both projects aim to simplify backend development, but graphql-engine focuses on providing a comprehensive GraphQL solution, while bknd appears to be a more lightweight alternative. graphql-engine offers more advanced features and scalability options, making it suitable for larger projects. However, bknd might be easier to set up and use for smaller applications or developers new to backend development.

68,900

πŸš€ Strapi is the leading open-source headless CMS. It’s 100% JavaScript/TypeScript, fully customizable, and developer-first.

Pros of Strapi

  • More mature and widely adopted, with a larger community and ecosystem
  • Offers a user-friendly admin panel for content management
  • Provides a plugin system for extending functionality

Cons of Strapi

  • Heavier and more resource-intensive
  • Steeper learning curve for developers new to the platform
  • Less flexible for custom backend logic compared to bknd

Code Comparison

Strapi (config/database.js):

module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: 'sqlite',
        filename: env('DATABASE_FILENAME', '.tmp/data.db'),
      },
      options: {
        useNullAsDefault: true,
      },
    },
  },
});

bknd (config/database.js):

module.exports = {
  client: 'sqlite3',
  connection: {
    filename: './dev.sqlite3'
  },
  useNullAsDefault: true
};

The code comparison shows that both projects use similar configuration approaches for database connections. However, Strapi's configuration is more complex, allowing for multiple connections and environment-specific settings, while bknd's configuration is simpler and more straightforward.

31,857

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.

Pros of Directus

  • More mature and established project with a larger community and ecosystem
  • Offers a user-friendly admin app for content management out of the box
  • Supports multiple database types, including PostgreSQL, MySQL, and SQLite

Cons of Directus

  • Heavier and more complex, which may lead to a steeper learning curve
  • Requires more server resources due to its comprehensive feature set
  • Less flexible for highly customized backend solutions

Code Comparison

Directus (TypeScript):

import { defineHook } from '@directus/extensions-sdk';

export default defineHook(({ filter }) => {
  filter('items.create', async (input) => {
    // Custom logic here
    return input;
  });
});

BKND (JavaScript):

const { Hook } = require('@bknd/core');

module.exports = new Hook('items.create', async (input) => {
  // Custom logic here
  return input;
});

Both projects allow for extending functionality through hooks, but Directus uses TypeScript and a more structured approach, while BKND opts for a simpler JavaScript implementation. Directus provides a more comprehensive framework, whereas BKND focuses on lightweight, flexible backend development.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

npm version

bknd

Ò­ Live Demo

bknd simplifies app development by providing a fully functional backend for database management, authentication, media and workflows. Being lightweight and built on Web Standards, it can be deployed nearly anywhere, including running inside your framework of choice. No more deploying multiple separate services!

  • Runtimes: Node.js 22+, Bun 1.0+, Deno, Browser, Cloudflare Workers/Pages, Vercel, Netlify, AWS Lambda, etc.
  • Databases:
    • SQLite: LibSQL, Node SQLite, Bun SQLite, Cloudflare D1, Cloudflare Durable Objects SQLite, SQLocal
    • Postgres: Vanilla Postgres, Supabase, Neon, Xata
  • Frameworks: React, Next.js, React Router, Astro, Vite, Waku
  • Storage: AWS S3, S3-compatible (Tigris, R2, Minio, etc.), Cloudflare R2 (binding), Cloudinary, Filesystem

For documentation and examples, please visit https://docs.bknd.io.

[!WARNING] This project requires Node.js 22.13 or higher (because of node:sqlite).

Please keep in mind that bknd is still under active development and therefore full backward compatibility is not guaranteed before reaching v1.0.0.

Size

gzipped size of bknd gzipped size of bknd/client gzipped size of bknd/elements gzipped size of bknd/ui

The size on npm is misleading, as the bknd package includes the backend, the ui components as well as the whole backend bundled into the cli including static assets.

Depending on what you use, the size can be higher as additional dependencies are getting pulled in. The minimal size of a full bknd app as an API is around 300 kB gzipped (e.g. deployed as Cloudflare Worker).

Motivation

Creating digital products always requires developing both the backend (the logic) and the frontend (the appearance). Building a backend from scratch demands deep knowledge in areas such as authentication and database management. Using a backend framework can speed up initial development, but it still requires ongoing effort to work within its constraints (e.g., "how to do X with Y?"), which can quickly slow you down. Choosing a backend system is a tough decision, as you might not be aware of its limitations until you encounter them.

The solution: A backend system that only assumes and implements primitive details, integrates into multiple environments, and adheres to industry standards.

Features

  • Қ‘ Instant backend with full REST API:
    • Data: Define, query, and control your data with ease.
    • Auth: Easily implement reliable authentication strategies.
    • Media: Effortlessly manage and serve all your media files.
    • Flows: Design and run workflows with seamless automation. (UI integration coming soon!)
  • 🌐 Built on Web Standards for maximum compatibility
  • Γ°ΒŸΒΒƒΓ’Β€ΒΓ’Β™Β‚Γ―ΒΈΒ Multiple run modes
    • standalone using the CLI
    • using a JavaScript runtime (Node, Bun, workerd)
    • using a React framework (Next.js, React Router, Astro)
  • Γ°ΒŸΒ“Β¦ Official API and React SDK with type-safety
  • Γ’ΒšΒ›Γ―ΒΈΒ React elements for auto-configured authentication and media components
  • Γ°ΒŸΒ›Β Γ―ΒΈΒ MCP server, client and UI built-in to control your backend

Structure

The package is mainly split into 4 parts, each serving a specific purpose:

ImportPurpose
bknd
bknd/adapter/*
Backend including APIs and adapters
bknd/uiAdmin UI components for react frameworks
bknd/clientTypeScript SDK and React hooks for the API endpoints
bknd/elementsReact components for authentication and media

The backend (bknd)

Serve the backend as an API for any JS runtime or framework. The latter is especially handy, as it allows you to deploy your frontend and backend bundled together. Furthermore it allows adding additional logic in a way you're already familar with. Just add another route and you're good to go.

Here is an example of serving the API using node:

import { serve } from "bknd/adapter/node"
serve();

Integrated admin UI (bknd/ui)

The admin UI allows to manage your data including full configuration of your backend using a graphical user interface. Using vite, your admin route looks like this:

import { Admin } from "bknd/ui"
import "bknd/dist/styles.css";

export default function AdminPage() {
   return <Admin />
}

Using the REST API or TypeScript SDK (bknd/client)

If you're not using a JavaScript environment, you can still access any endpoint using the REST API:

curl -XGET <your-endpoint>/api/data/entity/<entity>
{
  "data": [
    { "id": 1, ... },
    { "id": 2, ... }
  ],
  "meta": { /* ... */ }
}

In a JavaScript environment, you can use the TypeScript SDK with type-safety. The above example would look like this:

import { Api } from "bknd/client";

const api = new Api({ host: "<endpoint>" });
const { data } = await api.data.readMany("<entity>");

If you're using React, there are 2 hooks exposed (useApi, useEntity), as well as an swr wrapper around each (useApiQuery, useEntityQuery). The swr wrapped hooks automatically handled query invalidation:

import { useState } from "react";
import { useEntityQuery } from "bknd/client";

export default function App() {
   const { data } = useEntityQuery("todos");   
   return <ul>
      {data?.map(todo => (
         <li key={todo.id}>{todo.name}</li>
      ))}
   </ul>
}

React elements (bknd/elements)

You don't have to figure out API details to include media uploads to your app. For an user avatar upload, this is all you need:

import { Media } from "bknd/elements"
import "bknd/dist/main.css"

export function UserAvatar() {
   return <Media.Dropzone
     entity={{ name: "users", id: 1, field: "avatar" }}
     maxItems={1}
     overwrite
   />
}

The import path also exports components for login and registration forms which are automatically pointed to the bknd defaults.

Γ°ΒŸΒšΒ€ Quick start

To quickly spin up an instance, run:

npx bknd run

Installation

npm install bknd