Bright ideas and techniques for building with Convex.

All articles

Convex gets Rusty with Santa
If you've been itching to write Convex programs in Rust, your time has come. We take the new Convex Rust crate for a spin by writing a distributed system simulation of Santa and his team working together at the North Pole. Yes, really.
Jamie Turner's Profile image
Jamie Turner
19 days ago
Convex provides automatic type safety from your database schema to your React app. How does it work? Hint: we use some wild TypeScript.
Convex provides automatic type safety all the way from your database schema to your React app. How does it work? Hint: we use some wild TypeScript.
Alex Cole's Profile image
Alex Cole
a month ago
Many conversation threads with OpenAI's ChatGPT
Let's build a full-stack chat app to talk to ChatGPT on its new API!
Ian Macartney's Profile image
Ian Macartney
3 months ago
Migrating from Airtable to Convex
Is your project in Airtable ready for more code and less no-code? I’ve published some code to help you migrate your data into Convex.
Kate Rudolph's Profile image
Kate Rudolph
13 days ago
Writing per-table rules for per-document read/modify/insert authorization.
Implementing row-level security on Convex as a library. Wrap access to the database with access checks written in plain old JS / TS.
Lee Danilek's Profile image
Lee Danilek
21 days ago
Code for joining queries with helpers for one-to-many, many-to-many, and more.
In this post, we’ll look at some helper functions to help write code to traverse relationships in a readable, predictable, and debuggable way.
Ian Macartney's Profile image
Ian Macartney
a month ago
A web of relationships
In this post we’ll look at some patterns for structuring relationships in the Convex database.
Ian Macartney's Profile image
Ian Macartney
a month ago
Implementing a migration with our "migration" helper
Using mutations to migrate data in Convex.
Ian Macartney's Profile image
Ian Macartney
a month ago
Make changes without taking chances
There are as many ways to migrate data as there are databases, but here’s some basic information to set the stage.
Ian Macartney's Profile image
Ian Macartney
a month ago
Running functions in the Convex Dashboard
Did you know you can use the Convex Dashboard to run functions, enter seed data, filter & delete data, upload files, and more?
Ian Macartney's Profile image
Ian Macartney
2 months ago
Searching for Sanity
Your document is safely stored, but search is coming up empty? Inconsistent search systems can really confuse users! Don't worry–in Convex, transactional search indexing ensures that users always get what they expect and your apps just work.
Jamie Turner's Profile image
Jamie Turner
3 months ago
Using the createModeration API to moderate code
In this post, we’ll look at how to use the moderation API to flag messages before sending them to Chat-GPT, and patterns for handling these errors in a full-stack React app.
Ian Macartney's Profile image
Ian Macartney
3 months ago
Identities for ChatGPT
How to store multiple personalities Convex and provide them to the chatGPT API, enabling changing personalities mid-conversation. This is a follow-up to Building a full-stack ChatGPT app.
Ian Macartney's Profile image
Ian Macartney
3 months ago
Defining a Hono endpoint in Convex
Adding advanced HTTP Endpoint functionality by extending Convex with Hono.
Sarah Shader's Profile image
Sarah Shader
3 months ago
Image of Roy Lichtenstein's 1963 pop art piece “Crying Girl", depicting a woman looking nervous & upset with tears in her eyes (image via WikiArt, fair use)
Reactive backends like Convex make building live-updating apps a cinch, but default behavior might be too reactive for some use cases. Not to worry! Let’s fine-tune the reactive dataflow of a Convex + React app to deliver a better UX.
Anjana Vakil's Profile image
Anjana Vakil
3 months ago
A prompt and response from a Discord bot powered by Convex
Convex provides client libraries for storing and interacting with data, but sometimes we want a third-party app like Discord to interact with data in Convex. In this post, we use webhooks to build a simple Discord bot powered by Convex.
Sarah Shader's Profile image
Sarah Shader
4 months ago
A screenshot of Jest test results
Oftentimes during testing we want to mock out our backend so we can unit test our UI components without talking to our actual server code. In this article, we’ll explore options for testing React components that call Convex React hooks using mocking and dependency injection. To do this, I’ve written a sample TypeScript React app using the Vitest testing framework. The patterns presented in this post are also applicable to other JavaScript apps and frameworks.
Using a table to manage background jobs
Implement asynchronous job patterns using a table to track progress. Fire-and-forget, cancelation, timeouts, and more.
Ian Macartney's Profile image
Ian Macartney
4 months ago
The Whisper app for sending encrypted secrets
Implementing end-to-end encryption on top of Convex to build a secret-sharing app.
Lee Danilek's Profile image
Lee Danilek
4 months ago
Friends don't make friends log in
Getting users to sign up for a new service before seeing any benefits is challenging. In this post, we looked at a couple of strategies for managing user information without requiring a login.
Ian Macartney's Profile image
Ian Macartney
4 months ago
A chat app with images generated by OpenAI
Use Convex to fetch an image from OpenAI’s image generation service based on a user-provided prompt.
Ian Macartney's Profile image
Ian Macartney
4 months ago
People discussing art: what was the Dall-E prompt?
Building multiplayer games requires a lot of synchronization logic and event systems. However, using Convex, we get a lot of this for free! Follow along here as we build a complex multiplayer game on Convex, leveraging its reactive-by-default queries, transactional mutations, backend storage, and scheduled functions.
Ian Macartney's Profile image
Ian Macartney
4 months ago
It's not you, it's SQL
SQL has been a part of computing for a very long time, and SQL-based database systems underly most of the world's applications. But recently, developers have been clamoring for something better, and it's time to move on.
Jamie Turner's Profile image
Jamie Turner
4 months ago
Store per-session data in Convex
How to implement session storage with Convex, using some helper functions we wrote. While most of your data is associated with a user or another document, sometimes you have data that is specific to a user’s browser tab, or associated with a user who isn’t logged in. Some of this data is stored on the client, such as in the browser’s `sessionStorage` or `localStorage`, while other data is stored on the server.
Ian Macartney's Profile image
Ian Macartney
4 months ago
Convex loves zod
Function validation is important for a production app because you can’t always control which clients are talking to your server. See how to use zod to validate your Convex functions, using our withZod wrapper.
Ian Macartney's Profile image
Ian Macartney
4 months ago
The Edge
Convex middleware serves many purposes. Sometimes authentication, sometimes i18n. This time? Making sense (or nonsense) of emerging technology industry trends.
Jamie Turner's Profile image
Jamie Turner
5 months ago
Layers. Photo by Hasan Almasi: @hasanalmasi on Unsplash
Using wrapper functions like withUser can help you organize your code into middleware-like blocks that you can compose to keep your function logic concise.
Ian Macartney's Profile image
Ian Macartney
5 months ago
A happy goat is one that gets votes
Implementing an "upvote" feature 4 ways with Convex.
Kate Rudolph's Profile image
Kate Rudolph
5 months ago
Feel connected to your team by adding presence to your site
Some patterns for incorporating presence into a web app leveraging Convex, and sharing some tips & utilities I built along the way.
Ian Macartney's Profile image
Ian Macartney
5 months ago
Dare to resist weak platform guarantees. A.C.I.D. in the style of a D.A.R.E. logo
When your database supports ACID semantics, you're free to write code the intuitive way and ignore the complexities of concurrency and failure.
Jamie Turner's Profile image
Jamie Turner
6 months ago
An application field live-updating in the application table and application review page
Working with Convex has made our development workflow so much more streamlined—we no longer have to worry about the complexities of traditional frontend-backend communication, enabling us to build out the core of our new application portal at a blazing-fast speed.
Reactive Pagination automatically updates the page when inserting a new element.
Paginating over large datasets is tricky when the data is changing. Naive approaches result in missing or duplicated data. The trick is to rewrite limit queries (fetch 5 items) into range queries (fetch between cursors). Convex handles this automatically!
Alex Cole's Profile image
Alex Cole
6 months ago
Two planes with colored exhaust trails
For write-heavy applications, use single flighting to dynamically throttle requests. See how we implement this with React hooks for Convex.
Ian Macartney's Profile image
Ian Macartney
6 months ago
Movie clap board
Convex 0.5.0 introduces built-in support for actions — arbitrary lambda functions that run in a Node.js environment on the Convex cloud. We use the term action to differentiate these functions from Convex mutation and query functions, which enable transactional writes and dynamic subscriptions that update whenever data changes.
James Cowling's Profile image
James Cowling
6 months ago
An iron gate
Today we’re going to talk about how to flip features on and off remotely using a clever use of the reactive nature of Convex queries.
Ian Macartney's Profile image
Ian Macartney
6 months ago
A toy train approaches a gap in the track
The serverless movement has eliminated so many problems but it has left application developers with the hardest one of all: managing distributed state.
James Cowling's Profile image
James Cowling
7 months ago
An open drawer in a card file
How do I ensure my Convex database queries are fast and efficient? When should I define an index? What is an index? This document explains how you should think about query performance in Convex by describing a simplified model of how queries and indexes function.
Alex Cole's Profile image
Alex Cole
a year ago
Fast 5 logo
Why does anything really need to run on the server anymore? And even if it does, do I, the developer, need to be so involved? Yes! Even in a serverless world, the backend computing context being a real, discrete environment that you have control and influence over is not only necessary but hugely beneficial.
Jamie Turner's Profile image
Jamie Turner
a year ago
Chart depicting 'complexity of your app' on the x-axis and 'complexity of using Convex' on the y-axis. The line is horizontal.
You don’t have to worry about the platform locking you into a decision that seems convenient at first but is a headache to deal with later.
Indy Khare's Profile image
Indy Khare
a year ago
Fast 5 logo
While making Fast5, Convex's wordle-style multiplayer racing game, we ran into several interesting challenges. This week, let's dig into managing the combination of local and global state.
Jamie Turner's Profile image
Jamie Turner
a year ago
Fast 5 logo
At Convex, we're creating a platform for managing global state for web developers. Unsurprisingly, we've found one of the best ways to improve our platform is to actually build stuff with it!
Jamie Turner's Profile image
Jamie Turner
a year ago
Convex and PostgreSQL logos
Relational databases are powerful tools for persisting data, but using them to build interactive web apps requires a lot of work. A web app architecture built on a relational database is an entire cluster of databases, backends, caching nodes, and Pub/Sub servers. And even after you invest in all of that infrastructure you'll still need to explicitly define your database schema upfront and write cumbersome SQL queries. At Convex we believe that web developers shouldn't have to worry about any of this. We can handle the servers, caching, and reactivity and you can focus on your product.
Alex Cole's Profile image
Alex Cole
a year ago
Convex and Firebase logos
On Cloud Firestore, you'll have to do some acrobatics to integrate with React and listen for realtime updates. Down the road, you'll find your app full of slow loading experiences from request waterfalls and your database full of half-committed mutations.
Alex Cole's Profile image
Alex Cole
a year ago
Visualization of many different data points
Ideas around immutability, purity, and dataflow programming are quietly saturating our technologies like Bitcoin and React. And while these early inroads are enabling exciting new ways to build large and dependable applications, there is still much to do to realize the full potential of this revolution.
Jamie Turner's Profile image
Jamie Turner
a year ago