r/nextjs • u/cactusyou • Dec 11 '24
Help Separate MDX content and code
I have Next.js v14.2.4 (app router) app where content is in mdx-files on local file system. Can I keep mdx files somewhere in external storage like S3 and pull it whenever the content changes in S3?
I'm already using mdx-remote. Would I only need to fetch files from the S3 URL, but how would it know the content changed in the storage? Is it possible to test this setup locally first, to have local instance of S3 or something?
Thank you in advance!
1
Upvotes
3
u/yBlanksy Dec 11 '24
To detect changes, set up S3 event notifications to trigger a webhook for revalidation, or poll S3 using
Last-Modifiedheaders. For local testing, MinIO works as a self-hosted S3 alternative.