niels
niels8mo ago

Does everything in the convex folder

Does everything in the convex folder need to be in the root folder? It feels cluttery for me
8 Replies
sujayakar
sujayakar8mo ago
hi @niels ! nope, you can organize your code into subdirectories. here's an example convex/ folder from AI town: https://github.com/a16z-infra/ai-town/tree/main/convex
GitHub
ai-town/convex at main · a16z-infra/ai-town
A MIT-licensed, deployable starter kit for building and customizing your own version of AI town - a virtual town where AI characters live, chat and socialize. - a16z-infra/ai-town
niels
nielsOP8mo ago
ok cool
niels
nielsOP8mo ago
and what about the generated apis?
No description
niels
nielsOP8mo ago
e.g. could you put this tasks.ts file somewhere else or not
sshader
sshader8mo ago
All queries, mutations, and actions need to be defined somewhere in the convex/ directory (but you can do a subdirectory like convex/queries/tasks.ts and call it like api.queries.tasks.get). Generated code will always live under convex/_generated
niels
nielsOP8mo ago
oh right so the path defines the generated methods
sshader
sshader8mo ago
Yeah the type for api is generated based off of the file structure within convex (which can be whatever you want)
niels
nielsOP8mo ago
amazing, thanks!

Did you find this page helpful?