👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Using Sanity as CMS for user-generated content in Next.js blog website

7 replies
Last updated: Jan 20, 2023
Hi there, I recently started on a blog website project with nextjs that allows any user to sign up and publish blogs on the site/manage their own content (similar to Medium.com ). I'm working with Sanity as my CMS/publishing editor and have managed to set up a project to publish content I personally create to the site. Could someone please point me in the direction of docs that could help with the feature that allows others to independently create/manage their own content?
Jan 19, 2023, 6:52 PM
Hey
user K
! We don’t have a guide that covers this specifically, however, you’ll use the JS client to write changes to your actual Sanity content from your frontend. This video will show you the basics of this as well. Your use case will be more complicated, though!
Jan 19, 2023, 9:44 PM
Thank you for the info
user M
! I will look at the links you provided before asking anything else implementation related but you think what I'm trying to do is possible with Sanity?
Jan 19, 2023, 9:48 PM
Definitely possible!
Jan 19, 2023, 10:00 PM
user M
the info was super helpful thank you! I can use the JS client to CRUD user content to the database from the frontend. I really like the embedded studio editor feature, is there an option to allow users to author their own content in the studio editor? So far my understanding is you can have unlimited admin under one project and control their roles and permissions. Maybe I could use roles to restrict their access to only viewing and editing content they own or have been invited to collaborate on?
Jan 20, 2023, 1:26 PM
If it’s a public facing app where anyone can sign up, you would not want to allow them to become members of the project. A project does have unlimited admin roles, but you can only customize the access of a user if you have the custom roles feature that comes with an Enterprise level plan. You could technically hack your way around this by controlling what shows up in the desk structure, but it would never be truly secure since all documents would be discoverable through search and the API.
Jan 20, 2023, 4:11 PM
user M
understood. It is a public facing app, so it's best to handle the content creation etc from the frontend and use the js client to update the backend, thank you so much
Jan 20, 2023, 4:15 PM
You’re welcome!
Jan 20, 2023, 4:16 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?