• Stars
    star
    1,772
  • Rank 26,271 (Top 0.6 %)
  • Language
    Rust
  • License
    Other
  • Created 9 months ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Convex open-source backend

Convex logo

Convex is the backend-as-a-service for fullstack app development. Thoughtfully curated components, optimized by experts.

Convex replaces your database, server functions, scheduling, storage, vector search, etc. It includes a set of client libraries that deeply integrate with your frontend application code to provide fully consistent caching and real-time updates out of the box. All you need to do is write your application code.

The best way to get started with Convex is to follow the getting started guides in the Convex docs.

Most Convex developers should be using the managed hosted product. The hosted product includes a generous free tier and provides a seamless, reliable, cost-effective platform that allows you to focus on building your application without worrying about infrastructure.

This repository is the wild west open source version. It's the same code used in the hosted Convex product but runs on a single machine and doesn't include the scale-out services, replicated database backend, production dashboard, or operational tooling. You are welcome to use this code to run your application, either for local testing or in production, but you are on your own managing it and ensuring the system is reliable and secure. In particular you should ensure you have strong competency with regards to:

  • Hosting
  • Traffic routing
  • Backups and replication
  • Monitoring
  • Upgrades
  • Migration between versions

No official support is provided for the open source version of Convex but community support is available in the #open-source channel in the Convex Discord.

Development of the Convex backend is led by the Convex team and we are not actively soliciting any major contributions from the community. We of course welcome bug fixes and love receiving feedback. We keep this repository synced with any internal development work within a handful of days.

Getting started

We strongly recommend using the hosted version of Convex to get familiar with the development workflow before attempting to run this version locally.

To get started, clone this repo:

git clone https://github.com/get-convex/convex-backend.git
cd convex-backend

Dependencies

You will need to first install the following dependencies if you don't already have them on your machine:

To use the scripts set up in this repo:

  • Just
    • Just is used to execute scripts set up in the Justfile.
    • To install it see Packages, for example cargo install just or brew install just

To run the Convex CLI:

  • Node.js
    • Make sure you have the version specified in .nvmrc
    • We recommend installing Node.js via nvm.
    • Run nvm use from the root of the repo.

To build the backend from source:

  • Cargo
    • The convex local backend is written in Rust. Cargo is the build system.
    • We recommend installing Cargo via rustup.
  • The Rust nightly version specified in rust-toolchain
    • Assuming you installed Rust/Cargo with rustup, this will install automatically.
  • Rush
    • npm install --prefix scripts
    • We manage the packages in a monorepo using Rush.
  • Convex JavaScript dependencies
    • just rush install

Running the Convex Backend

Using prebuilt binaries

You can download the latest precompiled binary release from Releases. Only Apple x64, Apple Arm64 (Apple silicon), and Linux x64 binaries are currently available for download.

Note: On MacOS you might need to hold the option key and double click the binary file in Finder once, to circumvent the Gatekeeper warning.

Then you can run it:

./convex-local-backend

Adjust the path based on where you downloaded the binary to or add it to your PATH. The backend will store its database in the directory where it is executed from (not where the binary file lives).

Building from source

Build and run the local backend from the source in this repo:

just run-local-backend

Under the hood, this builds with Cargo:

cargo run -p local_backend --bin convex-local-backend

Provisioning a demo app locally

This example will go through running the backend with the included demo project.

1. Start the backend

Run the backend

If this fails with an error "persisted db metadata ..." you might need to erase the local database, in root directory run rm convex_local_backend.sqlite3.

2. Develop against the backend

The Convex CLI watches for changes in the application source code and pushes the code to backend.

To make the local backend run the included demo project, do:

cd demo
npm i
just convex dev

The convex script in Justfile automatically adds appropriate --url and --admin-key flags to point the CLI to the local backend.

To run the client web application you can run the demo Vite server via:

npm run dev:client

Note that unlike the hosted Convex workflow, we don't want to run the dev:server command since convex dev is already running.

The following CLI commands may be useful when interacting with your backend:

  • just convex data - Lists tables in your Convex deployment
  • just convex env - Allows you to list/set/update/delete environment variables
  • just convex logs - Streams out log lines to the terminal (it includes all successful executions if --success is passed in)
  • just convex import - Allows you to import tables
  • just convex export - Allows you to export tables

Documentation

For full documentation visit docs.convex.dev.

To see how to contribute, visit Contributing.md.

Community & Support

  • Discord. Best for: sharing your applications, hanging out with the community, and help with building on Convex
  • GitHub Issues. Best for: surfacing bugs and errors you encounter while building and using the open source Convex backend

Disclaimers

  • The Convex local backend is designed for use in local development and testing. Please exercise caution if attempting to use it for production usage. Convex can't offer support or guarantees for that experience - you're on your own there. If you do choose to go down that route, make sure to change your admin key from the defaults in the repo.
  • The Convex local backend doesn't have backward compatibility guarantees for CLI compatibility. Once a feature is released in a CLI, the backend will support it from that point on, but newer CLI features may not work with older backends. Unreleased/beta features won't have any guarantees.
  • Convex local backend does not support robust backend migrations. We'll always ensure things will work if you wipe your local database and start from scratch. We do not provide support for upgrading an existing local-backend to a newer version.
  • If you're using both the local backend and the hosted cloud platform, make sure to run npx convex dev or just convex dev before you start testing your client. The dev command will take care of updating your .env.local file with the correct CONVEX_URL.

Repository layout

  • crates/ contains Rust code

    • Main binary
      • local_backend/ is an application server on top of the Runtime. This is the serving edge for the Convex cloud.
  • npm-packages/ contains both our public and internal TypeScript packages.

    • Internal packages
      • udf-runtime/ sets up the user-defined functions JS environment for queries and mutations
      • udf-tests/ is a collection of functions used in testing the isolate layer
      • system-udfs/ contains functions used by the Convex system e.g. the CLI
  • demo/ contains a demo project that showcases the basic functionality of Convex using React

More Repositories

1

convex-demos

Demo apps built on Convex.
TypeScript
168
star
2

convex-helpers

A collection of useful code to complement the official packages.
TypeScript
96
star
3

convex-js

TypeScript/JavaScript client library for Convex
TypeScript
94
star
4

convex-saas

A production-ready Convex Stack for your next SaaS application with Convex Auth, Stripe, TanStack, Resend, Tailwindcss, and shadcn.
TypeScript
68
star
5

turbo-expo-nextjs-clerk-convex-monorepo

Monorepo template with Turborepo, Next.js, Expo, Clerk, Convex
TypeScript
45
star
6

convex-py

Python Client Library for Convex
Python
35
star
7

llama-farm-chat

Use locally-hosted LLMs to power your cloud-hosted webapp
TypeScript
33
star
8

convex-rs

Rust client library for Convex
Rust
31
star
9

convex-auth

Library for built-in auth
TypeScript
31
star
10

convex-ai-chat

TypeScript
25
star
11

fullstack-convex

Fullstack.app implementation using Convex / Auth0
TypeScript
23
star
12

templates

TypeScript
22
star
13

dryad

Dryad talks to you tree! Easy semantic code search on any repository
TypeScript
22
star
14

convex-svelte

TypeScript
21
star
15

ai-storybook

Build a simple generative AI app with LangChain.js, Replicate, OpenAI, and Convex
TypeScript
16
star
16

convex-hack-pack

Resources to get hacking quickly with Convex
TypeScript
16
star
17

convex-tutorial

JavaScript
11
star
18

fast5

The fastest word game in the west
TypeScript
10
star
19

convex-nextjs-app-router-demo

Demo showing a Next.js App Router app powered by Convex backend
TypeScript
10
star
20

multiplayer-game-with-dall-e

A fun multiplayer game built on Convex using Dall-E.
TypeScript
10
star
21

convex-ai-chat-openai

AI chat with context retrieval using OpenAI Assistants API
TypeScript
10
star
22

convex-nextauth-template

Example of using Auth.js (NextAuth) with Convex
TypeScript
9
star
23

convex-ai-chat-langchain

AI chat with context retrieval using Convex and LangChain
TypeScript
9
star
24

convex-tour-chat

Chat app for use during Convex tutorial (found at https://convex.dev/start)
CSS
8
star
25

convex-waitlist

An easy to adopt waitlist implementation using Convex
TypeScript
7
star
26

convex-auth-example

Convex Auth example repo
TypeScript
7
star
27

lets-go

TypeScript
6
star
28

template-nextjs-clerk-shadcn

TypeScript
6
star
29

convex-lucia-auth

Convex database adapter for Lucia Auth
TypeScript
6
star
30

convex-lucia-auth-demo

Demo showing authentication powered by Convex and Lucia
TypeScript
6
star
31

convex-resource-search

Created with CodeSandbox
TypeScript
6
star
32

convex-mobile

Kotlin
6
star
33

cms-template

TypeScript
5
star
34

convex-presence

Implementing a presence hook in Convex
TypeScript
5
star
35

ai-world-fair

TypeScript
5
star
36

convex-stripe-demo

Demo showing integration between Convex and Stripe
TypeScript
4
star
37

creddit

A very very (very) basic Reddit clone for learning Convex
TypeScript
4
star
38

convex-react-query

TypeScript
4
star
39

convex-fivetran-source

Convex Fivetran Source Connector
Rust
3
star
40

convex-test

Testing harness for pure-JS Convex tests
TypeScript
3
star
41

convex-search-indexer

Search indexing service for Convex documentation, stack posts, etc – built on Convex!
TypeScript
3
star
42

android-convex-workout

Sample Android Convex app using Jetpack Compose
Kotlin
3
star
43

convex-swift

C
2
star
44

twilio

Convex component for sending/receiving SMS messages with Twilio
TypeScript
2
star
45

work-with-friends

Demo app built by @tomredman and @cassidoo
TypeScript
2
star
46

pagerduty-slack-sync

Syncs one or more PagerDuty on-call schedules to a Slack channel topic
TypeScript
2
star
47

convex-rust-starter

Simple chat starter project for using Rust apps with Convex
Rust
2
star
48

ai-workshop

Demo app for AI Conference Dev Day workshop
TypeScript
2
star
49

template-nextjs-shadcn

TypeScript
2
star
50

pennapps-starter

A starter webapp using React, Next.js, and Convex. Created for PennApps.
TypeScript
2
star
51

ratelimiter-component

Rate limiter component for Convex, sharded for scalability
TypeScript
2
star
52

convex-android-auth0

Kotlin
2
star
53

aggregate

Component for aggregating counts and sums of Convex documents
TypeScript
1
star
54

preloaded-counter

Simple Demo of Next 14 RSC and Convex 1.8 preloaded queries
TypeScript
1
star
55

convex-chess

Chess built on Convex
TypeScript
1
star
56

.github

1
star
57

fast-base62

HTML
1
star
58

dinner-derby

TypeScript
1
star
59

expo-convex-auth

Example app of Expo + Convex Auth
TypeScript
1
star
60

convex-treehacks-workshop

Presentation for TreeHacks Workshop
TypeScript
1
star
61

convex-tanstack-start

TypeScript
1
star