convex outside react
Are there any docs on writing to convex outside of React? I want to seed my database with some data via a script.
12 Replies
hi @simonjbest ! we're still updating the docs, but we have SDKs for both python (https://pypi.org/project/convex/) and JS outside the browser (https://docs.convex.dev/api/classes/browser.ConvexHttpClient). these will then let you call into your queries, mutations, and actions.
@simonjbest let me know if you have any specific questions or need boilerplate. All my Convex use is outside React.
@simonjbest here's a quick example in JS from a project of mine: https://github.com/jamwt/roundest-mon-convex/blob/main/scripts/fill-db.ts
GitHub
roundest-mon-convex/fill-db.ts at main · jamwt/roundest-mon-convex
Port of theo.gg's roundest pokemon demo to Convex. Contribute to jamwt/roundest-mon-convex development by creating an account on GitHub.
Thanks, I'll take a look at these and see how I get on 👍
Here is another one for you that contains a mutation and trigger. You could easily just turn this into a node script.
GitHub
GitHub - 61cygni/flyconv-pixi: Bare bones convex / pixi / fly configs
Bare bones convex / pixi / fly configs. Contribute to 61cygni/flyconv-pixi development by creating an account on GitHub.
If you're just looking for seeding data, you could consider the
npx convex import
command, which copies data into Convex from a json or csv fileAnd yet-another-way, you can edit manually on the dashboard to add a few rows of data by hand (if it's small enough that it's viable).

dashboard.convex.dev
Dashboard | Convex Developer Hub
Dashboard Projects View
Thanks for all the help. I got this working with ConvexHttpClient 🙌
fantastic! glad to hear it @simonjbest