support for module naming or separate .internal.ts .api.ts files
Just posted this via the feedback form but will post it here in case anyone else wants to comment on it.
I currently organise all my code as follows:
convex
├── domain
│ ├── table
│ │ ├── queries
│ │ │ ├── getFoo.ts
│ │ │ └── getBar.ts
│ │ ├── mutations
│ │ │ ├── insertFoo.ts
│ │ │ └── insertBar.ts
│ │ ├── actions
│ │ │ └── userflow.ts
│ │ └── table.ts
│ ├── queries.ts // barrel exports
│ ├── mutations.ts
│ ├── actions.ts
│ └── tables.ts
├── actions.ts
├── queriesPublic.ts
├── queriesInternal.ts
├── mutationsInternal.ts
├── mutationsPublic.ts
└── schema.ts
This allows me to keep everything really organised. Each query/mutation function in the table folder looks like:
In the top level mutation files, I can then import all the mutation objects and wrap them:
mutationsInternal.ts
mutationsPublic.ts
I like this because then I can keep my internal and public mutations and queries separate from each other which feels like better practice.
However, when I want to use them I then have to type out internal.mutationsInternal.foo or api.mutationsPublic.baz which is mildly annoying because of the naming redundancy - see comment as hitting message length limit
2 Replies
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!
Is there anyway of exposing a variable so we could do say
Which could then resolve to internal.mutations.foo when you wanted to call it? Alternatively, could you add support for something like mutations.api.ts and mutations.internal.ts files?