Next.js Discord

Discord Forum

Dynamic Site Generation (like stream elements)

Unanswered
Siamese posted this in #help-forum
Open in Discord
SiameseOP
Hi there! :blob_wave:
In Stream Elements users are able to store their own custom overlays (with custom code; css and JS) which can then be served as a static page when they start a stream overlay.

I assume that Stream Elements would store their user's files in a bucket (e.g. AWS S3 Bucket) and they would somehow dynamically fetch these static files to create a static page per user. (I NEED TO KNOW HOW THEY DO THIS)

I wish to create something similar to this feature. Currently I have 2 react components stored in my AWS S3 Bucket.

e.g. overlay1.tsx :
export default function Overlay1() {
  ...
}


Then in my main application I currently use the experimental feature 'urlImports' to import this module. This works fine. (likely not the best/optimized method to do this, but it was the only idea I thought of lol)

e.g.
import Overlay from https://mybucket.s3.us-west-1.amazonaws.com/overlay1.tsx

^^^ In the future I would use a CDN instead of directly accessing it via the S3 bucket

The issue however comes from the fact that each user would require a different overlay.

In '/overlay/[user-session]/[overlay-session]

**WOULD NEED TO IMPORT OVERLAY DEPENDING ON ID**
import Overlay from https://mybucket.s3.us-west-1.amazonaws.com/<DEPENDANT ON USER'S ID>.tsx


is this feasible? Or a better question, is there a much cleaner and nicer solution to this (because this is pretty sh*t codebase rn 💀 )?

Cheers and many thanks in advance 🥂

2 Replies

SiameseOP
Just a follow up; If I were to approach this via AWS static site generation route; is it possible for users to startup their own instance of an AWS static site from my application?

I'm relatively new to the AWS ecosystem, does AWS even support something like this?

Thanks in advance 🙏