hello, guys first of all awesome product, i was th...
# community-help
s
hello, guys first of all awesome product, i was thinking of using typesense(in my react project) but i cant figure out what would be the fastest way of creating a dataset and how to maintain it with updates and where does the dataset stays assuming that i'll directly integrate it to my react frontend.
n
i dont know your exact setup but what i tend to do is have my own (postgres) database. i have a boolean column “synced” which i set to false on any change (and initially). i then have a cron which runs every 5 minutes and uses the upsert feature of the import endpoint to push any unsynced rows in my database, if any
essentially, you’d still be responsible for storing your data as a single source of truth, in whatever way you like. i did see some messages on here relating to using typesense as a datastore, but i dont think that that’s its intended use
if you tell me your stack i may be able to give you some more specific pointers 🙂
s
i have a react front-end and mysql as db a simple express backend, as much as i understood, i can have typesense server running and i can use react-instasearch.js with typesense adapter (with an api key ) to directly integrate it to my frontend, so my question is, how do i create a dataset and where does the dataset stays in my case, do i need a backend to load the datasets ? and in typesense demo app the books dataset was in the frontend 😕...sorry i'm new to such things and thanks for getting back to me
k
Hi Sonu. Typesense is meant to be a secondary search data store, which means that your primary database still exists on MySQL. Whenever the data in MySQL changes, you will update Typesense. There are multiple ways to do this. Nick has mentioned one of those ways of using a cron that updates the entire collection using the import+upsert operation. Another way to do this will be to create a new collection periodically from scratch and just make your app use the new collection using the Alias feature (https://typesense.org/docs/0.20.0/api/collection-alias.html#collection-alias). Finally, you can also update Typesense everytime you update your DB if your updates are pretty low volume. You can also use a mixture of both approaches. Apply live and also do a full sync every day or week etc.
s
ohh i get it now, thanks but one question, where does the dataset file stays if i directly integrate it to my frontend with api key and all. thanks again
k
Your front end can connect directly to Typesense.
s
if my frontend has the dataset, won't that be affecting my frontends loading time, i mean like file size will increases.
k
The dataset will be inside so front end will just be the client library talking to Tyoesense to get tbe data.
s
thanks for the support, i'll try it out. let's see how it goes down. 😄