Bright ideas and techniques for building with Convex.

All articles

The Software-Defined Database
Which to choose, the expressive power of code, or the robustness of built-in database features? With Convex, you can have both. By eliminating the boundary between the application and the database, Convex provides a uniform and powerful way to model your entire backend data flow and security using plain ol' code.
Jamie Turner's Profile image
Jamie Turner
9 days ago
AI-Powered Voice Note Taking
I recently built a full-stack app called notesGPT. It allows you to record a voice note, transcribes it, and extract action items and display them as action items. It’s fully open source and comes equipped with authentication, storage, vector search, action items, and is fully responsive on mobile for ease of use.
Hassan El Mghari's Profile image
Hassan El Mghari
10 days ago
Queries that scale: Indexing, Pagination, Read/Write Isolation
As your app grows from tens to hundreds to thousands of users, there are some techniques that will keep your database queries snappy and efficient. I’ve put together a short list of the most common techniques used by teams scaling on Convex.
Ian Macartney's Profile image
Ian Macartney
17 days ago
"who's on call?" in black text, above an image of the pagerduty logo with a red arrow going to the slack logo.
Syncing your Pagerduty instance with Slack is a good way to stay on top of your on-call schedule. We cover syncing Pagerduty information with a Slack channel.
Gautam Gupta's Profile image
Gautam Gupta
3 months ago
Setup ESLint to enforce type checking and Typescript code quality
ESLint is a powerful tool that goes beyond simply type checking. We go over how to set it up and implement some basic workflows with the
Ian Macartney's Profile image
Ian Macartney
2 hours ago
Uploading files from React Native / Expo
Step by step guide to take a file URI provided by Expo media APIs and upload it to Convex in React Native.
Indy Khare's Profile image
Indy Khare
3 days ago
Retry your actions: use the power of convex scheduling
Learn how to automatically retry actions in Convex while also learning a little about scheduling, system tables, and function references.
James Cowling's Profile image
James Cowling
17 days ago
Convex Ents: Bring your ORM workflow to Convex
Convex Ents is a library that provides: simpler ways to model and query related documents, ability to easily map and filter documents, enforcing unique field values, default field values, cascading deletes, soft deletion and more!
Michal Srb's Profile image
Michal Srb
a month ago
Session tracking without cookies?
Advice and resources for session tracking per-tab or per-browser via localStorage / sessionStorage using React Context, hooks, and some utilities to make your life easier.
Ian Macartney's Profile image
Ian Macartney
a month ago
Using branded types in validators with type casting in your schema
If you have a more specific type than what you can express with Convex validators, you can still document that at the type level in Convex by casting once in your schema definition.
Ian Macartney's Profile image
Ian Macartney
a month ago
Code for joining queries with helpers for one-to-many, many-to-many, and more.
Traverse database relationships in a readable, predictable, and debuggable way. Support for one-to-one, one-to-many, and many-to-many via utility functions available in convex-helpers.
Ian Macartney's Profile image
Ian Macartney
2 months ago
Argument validation without repetition: Advanced tips and tricks
In the first post in this series, the Types and Validators cookbook,, we shared several basic patterns & best practices for reusing types & validators from your schema. In this post, we introduce a few more advanced techniques & helpers to further reduce duplication and accelerate your Convex workflow.
Anjana Vakil's Profile image
Anjana Vakil
2 months ago
Use zCustomQuery to add zod argument validation
Use Zod with TypeScript for argument validation on your server functions allows you to both protect against invalid data, and define TypeScript types that propagate to your client. This can now be used as an alternative to the built-in argument validation on Convex.
Ian Macartney's Profile image
Ian Macartney
3 months ago
Customize your Convex functions with the new customQuery helper
Re-use code and centralize request handler definitions with discoverability and type safety and without the indirection of middleware or nesting of wrappers. Use the new customFunction module in convex-helpers for your Convex TypeScript functions.
Ian Macartney's Profile image
Ian Macartney
3 months ago
Convex Build Bounty for CodeWithAntonio's Jotion: Announcing the Winners
We hosted a hackathon for building features on top of a Notion clone created by CodeWithAntonio. Here are the results.
Wayne Sutton's Profile image
Wayne Sutton
3 months ago
"types and validators" in bold text. "best practices and useful tidbits" in light text. a colored cookbook
It can be tough to wrangle types to behave how you want them to. Thankfully, Convex was designed to make the experience with types perfect. Learn why that's the case here.
Anjana Vakil's Profile image
Anjana Vakil
3 months ago
example of waiting customers
Does your app need to limit the amount of users that can use it at a time? You might need to add a waitlist, which you will learn to build in this post.
Michal Srb's Profile image
Michal Srb
3 months ago
open AI logo followed by a text box with the word assistants API followed by a list of vector database logos with the skull emoji next to them
This year vector databases have sprung up like mushrooms to enable applications to retrieve context based on semantic search. A large portion of these applications have used the retrieved context to augment the ability of large language models (LLMs) in a pattern known as RAG. On November 7th OpenAI released its Assistants API, enabling the implementation of AI chat interfaces with context retrieval without needing a separate message store or vector database. Does this new API make vector databases obsolete?
Michal Srb's Profile image
Michal Srb
3 months ago
AI chat bot in a docs site
Convex is a full-stack development platform and cloud database, including built-in vector search. In this third post in our [series](https://stack.convex.dev/ai-chat-using-openai-assistants-api), we’ll build an AI-powered chat interface using Convex, with our own message storage and context retrieval.
Michal Srb's Profile image
Michal Srb
3 months ago
AI chat bot in a docs site
In this second post in our series, we’ll build an AI-powered chat interface using LangChain and its new Convex integration.
Michal Srb's Profile image
Michal Srb
3 months ago
AI chat bot in a docs site
On November 7th OpenAI released its Assistants API, enabling chat bot with context retrieval implementations without needing a messages or vector database. In this post, we’ll cover how to leverage this API to build a fully functioning AI chat interface.
Michal Srb's Profile image
Michal Srb
3 months ago
Convex Build Bounty for CodeWithAntonio's Jotion: Build features and earn prizes
Learn how you can win cash prizes for building features on an open-source Notion clone.
Wayne Sutton's Profile image
Wayne Sutton
3 months ago
Text: "seeding preview deployments" in a red box. Below it is the text: "3 ways" in a yellow box. To the right is a small image of preview deployments.
Now that we've launched Preview Deployments on Convex, you can test out backend changes easier than ever. But you may want to seed your project with data first, so let's go over how to do that.
Ian Macartney's Profile image
Ian Macartney
4 months ago
"npm create convex" in monospace font
There’s a new fastest way to start building a new app on Convex. Use our new magical command, npm create convex, to spin up a new Convex app from a preexisting template.
Convex's Profile image
Convex
4 months ago
Convex and Fivetran logos over a colored stripe. Text reads: "Seamless data integration from Convex to your destinations of choice" alongside a stylized version of the Convex frontend.
Launching our official Convex Fivetran connector.
Nipunn Koorapati's Profile image
Nipunn Koorapati
4 months ago
The new AI town frontend with new assets, featuring a forest camp where the agents hang out.
It's never been a better time to make your own town of AIs.
Ian Macartney's Profile image
Ian Macartney
4 months ago
Multi-user chat with ChatGPT streaming responses.
Stream GPT responses without brittle browser-based HTTP streaming. Multiplayer reactivity, persistence, reactivity via Convex. Using OpenAI’s Node SDK server-side, and Convex's useQuery hook client-side.
Ian Macartney's Profile image
Ian Macartney
4 months ago
AI Town
Learn more about how AI Town works and how to customize it. In this post, we'll dig into how character identities are represented: how to alter them, and how to add entirely new characters.
Anjana Vakil's Profile image
Anjana Vakil
6 months ago
Screenshot of an authentication UI
Learn how to build a full stack app with authentication without any third-party auth providers, using Convex and the Lucia library.
Michal Srb's Profile image
Michal Srb
7 months ago
Convex starts a checkout with Stripe, then handles the success webhook
If you’re building a full-stack app, chances are you’ll want some of your users to pay you for the service you provide. How to use Stripe with Convex to get it done.
Michal Srb's Profile image
Michal Srb
7 months ago
A code block showing how to generate fake data using Faker. Robot hands typing on a keyboard are visible in the background.
Learn how to generate fake data for your dev deployments using the Faker library
Nicolas Ettlin's Profile image
Nicolas Ettlin
8 months ago
Convex sits between the browser and cloud services like Pinecone and OpenAI
Pinecone and Convex are a good match when you're looking to build an application that leverages embeddings and also has application data.
Ian Macartney's Profile image
Ian Macartney
8 months ago
Moving data from Typeform into Convex
Leverage Typeform while keeping the data in a powerful transactional application database.
Kate Rudolph's Profile image
Kate Rudolph
8 months ago
Embeddings turn text into an array of numbers
Embeddings, why they’re useful, and how we can store and use them in Convex.
Ian Macartney's Profile image
Ian Macartney
9 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
9 months ago
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
9 months 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
10 months 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
10 months 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
10 months ago
Implementing a migration with our "migration" helper
Using mutations to migrate data in Convex.
Ian Macartney's Profile image
Ian Macartney
10 months 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
10 months 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
a year 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
a year 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
a year 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
a year ago
Defining a Hono endpoint in Convex
Adding advanced HTTP Endpoint functionality by extending Convex with Hono.
Sarah Shader's Profile image
Sarah Shader
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year ago
A happy goat is one that gets votes
Implementing an "upvote" feature 4 ways with Convex.
Kate Rudolph's Profile image
Kate Rudolph
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
a year 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
2 years 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
2 years 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
2 years 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
2 years 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
2 years 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
2 years 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
2 years 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
2 years ago