oscklmO
Convex Community2y ago
2 replies
oscklm

Multiple actions in one file, using different node modules?

Hey,

So i currently have a actions.ts holding my actions. In that i have multiple actions, and import some different modules at the top.

const client = new Mux({
  tokenId: process.env.MUX_TOKEN_ID,
  tokenSecret: process.env.MUX_TOKEN_SECRET,
});

When i need to create a client like above, should i create these clients in the top of actions.ts or inside of the invidual actions?

I would think that creating them inside the action, unless they are shared makes sense.

Are there any docs or something that can better help outline the "life cycle" of an action and how it works when having multiple in one file. I'm very curious to better understand how this actually get "compiled" into runnable code?
Was this page helpful?