Convex Community

CC

Convex Community

Join the Convex Discord! Explore Convex, the fullstack TypeScript platform for developers and startup founders.

Join

support-community

show-and-tell

general

open-source

announcements

Optimizing Function Calls by Avoiding Redundant Abstractions

The problem I’m facing is that I’m using an extra layer of abstraction in my code that doesn’t seem necessary. I have a function called getCurrentUserInternal, which is basically just a wrapper around another function called getCurrentUser. I’m using this wrapper to access user information inside another function, getFacturapiLiveInstance. The problem is that getCurrentUser accepts QueryCtx, and in the action I only have access to ActionCtx. Is there a better way? ...

`default()` on Convex validators

.parse() and .default() are some of my favorite features of Zod validators, and it would be really great to not have to think about doing z.parse() before writing something to Convex and that Convex could automatically apply defaults specified in the schema. Is this on the roadmap?...

What is the recommended approach to structure my app?

I am using Nextjs + Convex and I am wondering how is the best way to structure the app. When I am not using convex and I use a regular db I generally do this: -The front end layer (either client or server component) -Acitons (my server actions) -Data-access (Where I access the db)...

convex-auth with sveltekit

Hi Here, While convex references and examples are react-heavy (react-focused) , i want to ask if anyone has been successful in implementing convex-auth with sveltekit , particularly with session validation in server hooks . Thanks...

Control Convex env variables output location

Hi, yarn convex dev seems to forcibly create env.local even though we have an .env file that we want to use instead. We are in an Expo React Native app where we cannot reliably use env.local, instead we would ideally use env.development and env.production, but .env can suffice (env.local can not, however). The docs https://docs.convex.dev/production/project-configuration#convexjson state that "npx convex dev writes the URL to the .env.local or .env file.", but we can only get it to write to .env.local. ...
No description

Sign up user with custom fields

(Using convex auth/Password) Hey, so following the docs, I need custom fields for my users (who doesn't?), so I make a custom Password provider as specified for the password sign in/up function. But now when I need to set up email verification, the custom Password provider is erroring, since it's not callable. Code:...

How to run multiple local-only apps that use Convex

I'm finally getting my feet wet with Convex, and so far I'm really loving it. Aside from future plans for work-related projects, I would also love to migrate a bunch of personal databases from Airtable and create custom apps for them (probably in Remix, which I'm also learning at the same time). However, these would purely be for my own personal use; i.e. no public hosting. Each app would likely have its own Convex project, but I'd like some of them to be able to talk to each other; e.g. on the splash page for my planning app I'd like to pull a random quote from my quotes database. The thing I'm struggling to figure out is how to best run all of this stuff locally, partly when it comes to launching each app, but also with the aforementioned interactivity in mind. The only idea that's come to mind so far is to possibly use Docker (another tool I'm just getting started with), but even after building a separate image for each app, that would still involve (I think) a bunch of terminal-based steps to get each container running before launching any of the apps. Or maybe there's some aspect of using Docker that I haven't discovered yet that would make this easier? At any rate, whether or not you've gone this route yourself, I'd be grateful for any input on how I might pull this off....

Prioritizing unifying docs and building doc integrations with Popular coding assistants

As more and more coding assistants get even more popular, I think tools like Convex should prioritize developing easier ways for documentation to integrate with coding assistants. I only suggest this, because I genuinely want Convex to win! Having extensively used all other offerings, from early adoption of prisma, to supabase, drizzle, trpc, grpc, REST, years of graphql(still presently for day job), I think Convex has a real shot at winning and I am completely rooting for you. The work you've done with the application, customer support, docs, guides, youtube, stack, hackathons, HIPAA and SOC2, have all been awesome. Love it all....

Designing a friend system with Convex

Hi, I’m building a friend system with Convex and am torn between two approaches: 1. Multiple indexes for better scalability. 2. Multiple entries in a single table for each friendship. ...

Setting `_id` when creating documents with optimistic update

We absolutely love optimistic updates and use them heavily on our app. There's however some places where we can't use them because we would require Convex to create a document with an id that we pass it which is equal to the id of the document created optimistically. In our app, when you create a page, a document gets created and we navigate the user to pages/<doc_id> Doing this optimistically would break atm......

instanceof Error

Could you provide the error class type for comparison, for example via try { } catch (error) { // error typescript any...
No description

useQuery never enters Error state

When an error is thrown within the query the query stays in isLoading state. Within the query we throw expected errors. When a resource isn't found (ie the id doesn't exist in the database). We are using svelte. ...

Quering random row

Hello, what would be the best way to query a random row from DB via Convex? I have a game project where users should get a random image, each image should be a row in DB (ideally) and there will be more than 100 images.

How to do something on a specific date or time?

I'm wondering if it is possible to do something on a specific date or time. For instance, I have a taskboard in my app where I can set a due date. I would like to add to a table if the date is either near, on date or past date. I was looking at scheduled functions, but I couldn't figure out if that could lookup a value in the database and then do the function?...

Why is it that file names only appear when uploading through the console?

When I upload files using a script equal to the one in the documentation, the file name does not seem to be stored, as you can see from the screen shot. But when I upload the file manually through the console, it does seem to get the file name store (and with the proper extension). I don't see a parameter in the documentation to specify the file name....
No description

Convex Auth Missing SITE_URL in Expo App

The docs say that SITE_URL is not needed when I am using react native. For my expo app I am getting an error regarding missing env SITE_URL. Is there anything I am missing or is SITE_URL actually required?
No description

Querying for dev/preview/prod status within code?

Does Convex offer a way to query for whether the app is dev, preview, or prod? I can use process.env.NODE_ENV to check for prod or dev but it registers preview deploys as production. (This is just the way NODE_ENV works so I’m wondering if there is an equivalent CONVEX_ENV of sorts)

Buggy dashboard schema validator

See screenrecording. I briefly remove a field and add it back in but I still see errors

Delete all files

Is there an easy way to clear all files in convex storage? I'm doing 20 at a time and I have 1k total.

stripe + process.env

For my app, process.env variable for Stripe are being picked up from development area in convex but not project wide default env variables. Does this happen with test keys only? process.env.STRIPE_SECRET_KEY...