#Astro System design. exposing SSG to end-user.

2 messages · Page 1 of 1 (latest)

hazy wadi
#

Dear Astro community.

I am planning to expose Astro to end-user thru API for user to "customize[only background color]" of their astro page.

I was thinking about this workflow :

  1. user1 submit their color of choice thru my front end
  2. my front-end then pass the color code to an API endpoint.
  3. the API trigger a script to change the user1.env associated to that particular user.
  4. the API trigger a script to change the user1.config.mjs associated to that particular user.
  5. then it triggers npm run build --config "user1.config.mjs"
  6. it then export the html result to cloudflare pages.

two questions :

  1. is this the best way to do this?
  2. if this is the best way to do this, what happen if there are three user costumizing their site at the same time?

Thank you,

chrome storm
#

I'm not sure if all you need to change is a color or if this is a pattern you want to extend for further heavy customization. For just a color, I would rather use a local storage variable that is updated on client side, you might think of an early running script to block until variable is read to avoid Flash of Unstyled Content on SSG. This is similar to many examples where users store their light/dark mode preferences, you switch that binary value to a color.