wild-silent
wild-silent3mo ago

Using Convex Triggers Across Multiple Frameworks: Jetpack Compose, SwiftUI, and Next.js

I'm working on a multi-framework project using Jetpack Compose (Kotlin) and SwiftUI (Swift) for the native apps, and Next.js (React) for the admin dashboard. I want to implement a Convex trigger that logs every insert on the user table to an activity tracker table. Since each framework has its own "convex" folder at the root, do I need to set up the trigger in all three folders, or can I define it once for the entire project? How should I structure the Convex backend for such use cases? Here are convex sample project repos for reference: iOS Example: https://github.com/get-convex/ios-convex-workout Android Example: https://github.com/get-convex/android-convex-workout Next.js Example: https://github.com/get-convex/template-nextjs-clerk-shadcn Any advice would be appreciated!
GitHub
GitHub - get-convex/ios-convex-workout
Contribute to get-convex/ios-convex-workout development by creating an account on GitHub.
GitHub
GitHub - get-convex/android-convex-workout: Sample Android Convex a...
Sample Android Convex app using Jetpack Compose. Contribute to get-convex/android-convex-workout development by creating an account on GitHub.
GitHub
GitHub - get-convex/template-nextjs-clerk-shadcn
Contribute to get-convex/template-nextjs-clerk-shadcn development by creating an account on GitHub.
8 Replies
Convex Bot
Convex Bot3mo 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!
lee
lee3mo ago
How do you deploy this app? If it has three convex folders I can't tell how it will be deployed to a single database
Clever Tagline
Clever Tagline3mo ago
Just to catch anyone up who hadn't read the original discussion here, I recommended Turborepo, but we're not sure if that will work because it might not support Swift and Kotlin. I'm just getting my feet wet with Turborepo, so unfortunately I can't confirm that. That said, this still feels like it would benefit from some type of monorepo setup, but the question is how to configure it.
lee
lee3mo ago
Convex in Multiple Repositories
Turns out, you can organize your Convex project across multiple repositories! Check out this guide on how to implement this in your project.
lee
lee3mo ago
A monorepo would also work. Either way, there should only be one convex folder
wild-silent
wild-silentOP3mo ago
Won't have same project url solve this issue of single database Thanks I will look into this
lee
lee3mo ago
A convex deployment has one database and has functions (and schema and triggers) deployed from one convex folder. You could set multiple convex folders to deploy to the same convex deployment, but they will overwrite each other so that's not useful
wild-silent
wild-silentOP3mo ago
Oh I see, I just went through the link you sent, and I think that makes sense...I would have one main convex folder(preferably on the NEXTJS project) and generate api.ts files for both the IOS and Android projects

Did you find this page helpful?