burnstony#1975
burnstony#197513mo ago

data

Is there a good way to check in something to load a starter set of data, and a good way to reset all the data to run from scratch.
4 Replies
Michal Srb
Michal Srb13mo ago
You can: - Run a function, like the init function here: https://github.com/get-convex/convex-tour-chat/blob/main/convex/init.ts#L24 which gets run via npx convex run init or npx convex dev --run init (see the package.json) - Export and import a snapshot of the data in the database https://docs.convex.dev/database/import-export/
Import & Export | Convex Developer Hub
If you're bootstrapping your app from existing data, Convex provides three ways
GitHub
convex-tour-chat/convex/init.ts at main · get-convex/convex-tour-chat
Chat app for use during Convex tutorial (found at https://convex.dev/start) - get-convex/convex-tour-chat
ian
ian13mo ago
Search stack.convex.dev for “seed data” - I wrote an article on it recently
ian
ian13mo ago
Supercharge npm run dev with package.json scripts
With a simple npm run dev we can sign up a user for Convex, add seed data, and run the frontend and backend (including database) in parallel. Here's...
burnstony#1975
burnstony#1975OP13mo ago
thank you

Did you find this page helpful?