Home / Companies / Convex / Blog / February 2023

February 2023 Summaries

7 posts from Convex

Filter
Month: Year:
Post Summaries Back to Blog
Jason Lengstorf's tutorial offers guidance on creating database-powered applications with type safety and real-time updates, even for those who may not have database management expertise. The tutorial is supported by a sponsored video from Convex and provides resources such as source code and a finished app link to facilitate learning. It emphasizes the importance of using async functions for mutations to enhance safety, as advised by the Convex team. Convex serves as the backend platform integrating cloud functions, a database, file storage, scheduling, workflow, vector search, and real-time updates, making it a comprehensive solution for building scalable full-stack AI projects.
Feb 28, 2023 171 words in the original blog post.
In the blog post, the author explores the challenges and solutions related to building a task manager app that provides a seamless user experience by automatically updating the displayed data in real-time, without requiring manual page refreshes. The primary focus is on using a reactive backend like Convex in conjunction with a reactive frontend framework such as React, to streamline data updates through hooks like useQuery and usePaginatedQuery. While these tools enhance user experience by maintaining data freshness, they can sometimes introduce undesirable UI behavior, such as loading flashes during data updates. To address this, the author demonstrates how to create custom React hooks, useStableQuery and useStablePaginatedQuery, which mitigate these issues by maintaining stale data until fresh data is fully loaded, thereby avoiding distracting UI flashes. The post emphasizes the balance between reactivity and user experience and encourages developers to adapt such patterns in their projects, offering code examples and further resources for customization.
Feb 21, 2023 3,638 words in the original blog post.
Sarah Shader describes the process of building a Discord bot using Convex to handle webhooks and interact with data. Convex, which supports HTTP webhooks, allows the integration of third-party apps like Discord to store and interact with data through client libraries. Shader's project involves creating a Discord bot that triggers custom responses to specific phrases, storing these prompts and responses within Convex and modifying them through a web app using the ConvexReactClient. The bot operates by receiving HTTP requests from Discord via a webhook, with specific endpoints set up to handle these requests and verify their signatures using the discord-interactions npm package. Shader details handling the initial "ping" request required by Discord and emphasizes the importance of verifying request signatures to ensure proper functioning. The final setup involves querying Convex data to respond appropriately to Discord commands, showcasing how Convex's backend platform integrates various functionalities like cloud functions, databases, file storage, and more to support full-stack AI projects.
Feb 14, 2023 719 words in the original blog post.
The text discusses strategies for testing React components that interact with Convex functions, focusing on mocking and dependency injection techniques. It introduces a sample TypeScript React application using the Vitest testing framework to demonstrate how to test a React component that renders a counter value stored in Convex and provides a button to increment this counter. The article outlines two primary methods for testing: the first involves mocking Convex imports using Vitest's mock functionality to replace internal implementations with fake methods, while the second uses dependency injection to replace the Convex client with a test version, allowing for the simulation of real deployment connections. These approaches facilitate effective unit testing of React components that rely on backend services, ensuring they function correctly without needing to communicate with the actual server code. The document suggests that these methods are applicable beyond the specific example, encouraging developers to adapt the techniques to other use cases.
Feb 10, 2023 1,220 words in the original blog post.
The text explores a structured approach to managing asynchronous background tasks using a database table to track the state and progress of long-running jobs, exemplified through a multiplayer game that utilizes OpenAI’s image generation endpoint. It emphasizes key functionalities such as starting jobs without blocking client requests, tracking incremental progress through reactive UI updates, enabling multiple clients to subscribe to job status, and safely canceling requests transactionally to avoid race conditions. Additionally, the method includes monitoring for timeouts and implementing custom retry logic in cases of transient failures, notably using Convex’s function scheduling to enhance user experience by handling slow operations asynchronously. The approach is aimed at providing a seamless backend integration for full-stack projects, ensuring reliable and efficient task management while maintaining user engagement with real-time updates and performance metrics.
Feb 08, 2023 1,632 words in the original blog post.
Lee Danilek explores the implementation of end-to-end encryption using Convex by developing a tool called Whisper, designed to securely send encrypted messages. Whisper encrypts messages on the sender's device and allows them to be decrypted only by the recipient, ensuring that no unencrypted data is exposed during transmission. Users can send messages without needing to log in or set up accounts, and they can track IP addresses if the message URL is intercepted. Messages can expire after a set number of accesses or time, triggering automatic deletion from Convex. The encryption utilizes AES symmetric encryption, and the tool operates primarily through client-side code, never exposing raw URLs or secrets to Convex servers. Danilek provides the source code for Whisper, showcasing its backend operations with Convex, which supports scalable and secure full-stack development.
Feb 03, 2023 792 words in the original blog post.
When building applications that require user interaction without initial sign-up, leveraging session-based ephemeral users can offer a practical solution by creating user IDs upon session creation and storing them in a "users" table. This approach allows for persistent user identifiers while maintaining user anonymity, enabling features like profile picture usage and game progress retrieval across devices. In a demo app, integrating this session management technique in a chat application ensures consistent user names across sessions and reflects name updates in historical messages by associating messages with user IDs rather than names. The use of custom functions to automatically handle user and session IDs simplifies the implementation, although it presents challenges in managing interactions between logged-in and anonymous users. To address potential security concerns, it is advised to avoid treating session IDs as user identifiers and consider a unified "users" table with an isAnonymous field for better user management.
Feb 02, 2023 1,154 words in the original blog post.