Squirble
Squirble3w ago

I just finished the tutorial and I have some questions

* Can Convex do local-first? Work offline and sync later? * Is it possible to run your own convex reactor? (Like github co-location) * Do companies need to worry about Convex having access to their data? * This is vendor lock-in, right? * What happens if you exceed the maximum quotas? * What happens if Convex raises their prices? * Can Convex afford to host all this? What if they run out of money? * How granular are “ready-sets”? Down to the record? Down to the xpath within a record? * How do queries that use randomness or the date decide when to be updated? * This “likes” example looks like an N+1 query problem. * Is it going to cause performance issues or not? * Will we ultimately want to write it a different way? * How does its performance compare to postgres? * This would be a good opportunity to introduce uniqueness constraints so you can’t double-like the same document. Can we do that? * can the scheduler debounce things? * Specifically, I’d like to schedule something to occur immediately, but if it is scheduled again within 5 seconds it should wait until the end of that period before executing again, no matter how many times it is called in between. * access control * how do you configure which actions/mutations/etc are available on the client side vs the server side? * how do you configure what’s available to a specific user? * can I use bun and not use node?
11 Replies
Convex Bot
Convex Bot3w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Omar
Omar3w ago
I'll throw in an answer: how do you configure which actions/mutations/etc are available on the client side vs the server side? These are Internal Functions: https://docs.convex.dev/functions/internal-functions
Internal Functions | Convex Developer Hub
Internal functions can only be called by other functions
lee
lee3w ago
Some more answers: - Can Convex do local-first? Work offline and sync later? Convex has optimistic updates and mutations get retried until successful connection. https://docs.convex.dev/client/react/optimistic-updates . For more sophisticated optimistic updates and persisting data across app restarts, we're actively working on it. https://stack.convex.dev/object-sync-engine
Optimistic Updates | Convex Developer Hub
Even though Convex queries are completely reactive, sometimes you'll want to
An Object Sync Engine for Local-first Apps
Object sync engines manage a rich object graph across multiple clients and a centralized server and are a great fit for building local-first apps.
lee
lee3w ago
- is it possible to run your own convex reactor Yes. https://www.convex.dev/open-source . check out #open-source for more discussion
Open Source
Develop with confidence knowing that the Convex backend will be around forever.
lee
lee3w ago
- Do companies need to worry about Convex having access to their data? Convex is SOC2, GDPR, and HIPAA compliant How granular are “ready-sets”? Down to the record? Down to the xpath within a record? Read sets are a collection of ranges of indexes. The granularity is on the record level, so if a record changes within a queried index range, the query re-executes - How do queries that use randomness or the date decide when to be updated? Queries don't automatically rerun due to the date or randomness changing. If a query reads the date or randomness, it will get cached for 5 minutes. If you want to bypass the cache, we recommend passing a "cache busting" arg that you can change to cause the query to rerun immediately
lee
lee3w ago
* This “likes” example looks like an N+1 query problem. * Is it going to cause performance issues or not? * Will we ultimately want to write it a different way? N+1 problem usually refers to round-trips from client to server. A Convex query function runs within the Convex server, so the N+1 ctx.db.query functions happen within a single client<->server round trip. Furthermore, on the server they're executed in parallel with Promise.all. This is how i would implement the feature myself, but if you want to denormalize the likes count you can do that too. Example: https://youtu.be/hW2IiPFFd_0?si=HKbTu9y_h8Qtszzs
Convex
YouTube
Porting Theo's T3 Stack Roundest to Convex
In a recent video (https://www.youtube.com/watch?v=O-EWIlZW0mM), Theo Browne built a "rate the roundest Pokemon" app using five different stacks. In a shocking turn of events, Convex was not one of the five. In this video, Convex co-founder Jamie Turner walks through what it took to port the tRPC version to Convex. Spoiler: not much. And we end...
lee
lee3w ago
- This would be a good opportunity to introduce uniqueness constraints so you can’t double-like the same document. Can we do that? Yes, in the mutation that creates the "likes" document you can first query to make sure it doesn't exist. Searching "unique" in discord will probably find you good examples, but there's also a library you can use: https://stack.convex.dev/ents#unique-field-values And here's our thinking on why things like unique constraints aren't "built-in": https://stack.convex.dev/the-software-defined-database
Convex: 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 bou...
Convex Ents: Manage your document relationships
Convex Ents is a library that provides: simpler ways to model and query related documents, ability to easily map and filter documents, enforcing uniqu...
lee
lee3w ago
- can the scheduler debounce things? * Specifically, I’d like to schedule something to occur immediately, but if it is scheduled again within 5 seconds it should wait until the end of that period before executing again, no matter how many times it is called in between. You can do this but it's currently nontrivial, since you have to keep track of the scheduled job and dedupe yourself. This is something that might be built with a Component in the future. The Expo Notifications component already debounces internally, i believe, if you want to look into its code: https://www.convex.dev/components/push-notifications
Expo Push Notifications
Send push notifications with Expo. Manage retries and batching.
lee
lee3w ago
- how do you configure what’s available to a specific user? You can write arbitrary logic in your Convex functions for restricting access control. See https://docs.convex.dev/auth/functions-auth for the basics and https://stack.convex.dev/row-level-security#authorization-via-code for more advanced patterns
Auth in Functions | Convex Developer Hub
_If you're using Convex Auth, see the
Row Level Security
Add row-level security to your database access by wrapping database reads and writes in your Convex serverless functions.
lee
lee3w ago
* can I use bun and not use node? Yes on the client https://docs.convex.dev/client/javascript/bun Not on the server, at the moment. Do you want to use Bun-only libraries? The default Convex runtime is custom but has APIs similar to browsers & deno & bun https://docs.convex.dev/functions/runtimes
Bun | Convex Developer Hub
Bun can be used to run scripts and servers that use Convex
Runtimes | Convex Developer Hub
Convex functions can run in two runtimes:
jamwt
jamwt3w ago
thanks @lee . excellent answers!

Did you find this page helpful?