dimanche 20 décembre 2020

Better way to keep and retrieve "sample data" for new user accounts?

I'd like to prepopulate new user accounts with sample data. Initially my thought was to copy data from preconfigured "template accounts" because then we could reuse our app/web UI to create, edit, and view our onboarding templates.

The current (very slow) process is:

  1. query some template account (based on a user template selection)
  2. query posts, orgs, records associated with that account
  3. clone those records to a new account

Unfortunately that process can take up to 3000ms and makes the user's first experience slow. It can't be solved with indexing or performance, and the query itself is relatively rare (new accounts being a rare action relative to ongoing user behavior).

So how is this typically solved?

  • We're using mongo, so I could conceive of loading hard coded json objects and editing them in the code, but then it seems it'd be difficult to see changes.
  • We could build an admin UI to manage these templates, but that's another thing to build and maintain
  • We could use a headless CMS and query a much smaller database, using the headless CMS UI to make changes easy, but that's more infrastructure
  • We could break out the template data into it's own identically structure database so that queries are much faster

Aucun commentaire:

Enregistrer un commentaire