This repo is to show a pattern where you write functions in one folder, but export them in a different file. So you can organize you code and API separately, without losing the ability to track down where the function is defined.
myQuery is defined in convex/foo/bar.ts and exported in convex/myFunctions.ts.
You get api.myFunctions.myQuery auto-completing, but not api.foo.bar.
When you jump-to-definition from api.myFunctions.myQuery, you go to
convex/myFunctions.ts, where you can jump-to-definition to convex/foo/bar.ts.
So this is one extra hop to get to the function definition.
If you want to export them from both, you can do the myMutation pattern, where
myMutation is defined in convex/baz/buz.ts and re-exported in
convex/myFunctions.ts.
Then you get api.myFunctions.myQuery and api.baz.buz.myMutation.
In this case, you get jump-to-definition from api.myFunctions.myMutation and
api.baz.buz.myMutation straight to convex/baz/buz.ts.
This is a Convex project created with npm create convex.
After the initial setup (<2 minutes) you'll have a working full-stack app using:
- Convex as your backend (database, server logic)
- React as your frontend (web page interactivity)
- Vite for optimized web hosting
- Tailwind for building great looking accessible UI
If you just cloned this codebase and didn't use npm create convex, run:
npm install
npm run dev
If you're reading this README on GitHub and want to use this template, run:
npm create convex@latest -- -t react-vite
To learn more about developing your project with Convex, check out:
- The Tour of Convex for a thorough introduction to Convex principles.
- The rest of Convex docs to learn about all Convex features.
- Stack for in-depth articles on advanced topics.
Join thousands of developers building full-stack apps with Convex:
- Join the Convex Discord community to get help in real-time.
- Follow Convex on GitHub, star and contribute to the open-source implementation of Convex.