Using Silverstripe headless with Next.js via RestfulServer module

Hi there,

I was wondering if anyone has cracked a way to use Silverstripe headless with the RestfulServer module and a frontend framework such as Next.js?

I’m not 100% confident with GraphQL, and I noticed trying to add some custom values returned by functions in my code was proving tricky to get those values to appear in the query - but that is probably due to my lack of GraphQL knowledge.

Ideally, similar to the GraphQL implementation, we could keep pages as they are for the RestfulServer module, as according to the docs everything has to be a DataObject :confused:

The GraphQL implementation is great because you can get results based on the path e.g. /about, and /article, however the RestfulServer module looks to be be by ID only which isn’t ideal. It also exposes Elemental too which is nice, but I can’t find documentation on how to do this with the RestfulServer module.

Would love some pointers or inspiration on how this could work?

Would also be cool to have some starter files similar to other CMS’s on the market showing a standard implementation for both GraphQL and via a restful server.

Thanks in advance for any guidance.


You might find GitHub - emteknetnz/silverstripe-rest-api: Rest API for Silverstripe is more suited to this task than restfulserver

Hi @GuySartorelli,

Ooh this does look interesting. I’ll give this a try thanks.