adamA
Convex Community2y ago
4 replies
adam

File based routing: How to organize files?

Hi, I'm looking for the best way to organise files within the convex directory. The single file such as messages.ts is becoming very large with many different mutations, queries, actions etc.

I tried to create a ./messages/index.ts and then use export * from './create' from within the ./messages/index.ts file, though this approach doesn't work very well with the auto generated Convex functions. I worked out that I can use the _ prefix, eg ./_messages/create.ts for the folder (also works with files too), so they will be excluded from Convex function auto generation but the TS types are still created for these _* files and directories.

My question is, am I on the right path with using _* prefix to exclude some files and folders from file based routing, or is there a better approach to organizing files?
Was this page helpful?