Does creating a Shopify app also create a separate database for each user?

wil_dev
Shopify Partner
12 0 2

I'm having a little trouble formulating my question so I'll give an example:

 

If we deployed the shopify tutorial application (qrcodes), would the database that manages qrcodes be valid?
Because if a customer modifies the table, it modifies it for all customers (the database is hosted with the application?).

 

Or maybe I didn't understand and when a customer installs an app, he automatically creates a database on his shop?

If I haven't been clear enough, please don't hesitate to tell me, it's pretty confusing for me...

 

Thank you! 🙂

Reply 1 (1)

martingrzzler
Shopify Partner
1 0 0

I took me a while to figure this out but by default multiple merchants that install you're application would use the same database instance. As you can see the shop is included within the qr code table in order to map a qr code with a specific store. 

 

model QRCode {
  id               Int       (autoincrement())
  title            String
  shop             String
  productId        String
  productHandle    String
  productVariantId String
  destination      String
  scans            Int      (0)
  createdAt        DateTime (now())
}

 

  When you then deploy you're app with a database you don't have to use prisma and sqlite. You could for instance host a AWS dynamodb database and use a separate session adapter as described here: https://github.com/Shopify/shopify-app-template-remix?tab=readme-ov-file#application-storage. Generally the documentation lacks explanations on different deployment solutions. Heroku and Fly.io are just not enough for a lot of people.