A decoupled CMS-powered application built with Next.js and Drupal, demonstrating CRUD operations, pagination, and view rendering using the next-drupal library.
This project serves as a practical example of integrating Next.js App Router with a Drupal backend, fetching and managing dynamic content through the JSON:API.
- 🔄 Full CRUD functionality (Create, Read, Update, Delete) with Drupal resources.
- 📊 Fetching and rendering Drupal Views with dynamic pagination.
- 🧱 Clean component structure with server components for better performance.
- 🧪 Follows best practices for data fetching and rendering in Next.js.
We configure two clients with next-drupal:
import { NextDrupal } from "next-drupal"
// Public (browser) client
export const drupal = new NextDrupal(process.env.NEXT_PUBLIC_API_URL)import { NextDrupal } from "next-drupal"
export const serverDrupal = new NextDrupal(process.env.NEXT_PUBLIC_API_URL, {
auth: {
clientId: process.env.DRUPAL_OAUTH_CLIENT_ID,
clientSecret: process.env.DRUPAL_CLIENT_SECRET,
},
})Here are the main methods used from the next-drupal SDK:
🟢 Reading content: drupal.getResource(type, uuid) drupal.getView(viewId, { params }) drupal.getResourceCollection(type, { params })
🔴 Creating content: serverDrupal.createResource(type, payload)
🟡 Updating content: serverDrupal.updateResource(type, uuid, payload)
⚫ Deleting content: serverDrupal.deleteResource(type, uuid)
Each method supports authentication and relationships as needed, simplifying interaction with Drupal’s JSON:API.
✅ Use drupal (public client) in server components only to fetch public data.
✅ Use serverDrupal (authenticated client) for actions like creating or updating data.
🚫 Avoid using next-drupal in client components — use it only in Server Components or API routes.
✅ Always handle errors gracefully when working with getView, getResource, etc.
✅ Use pagination params like page[offset] and page[limit] properly when fetching Views.
Here are a few snapshots of what this app renders:

- Clone the Repository
git clone https://github.com/<your-username>/Next-Drupal-app.git
cd Next-Drupal-app- Install Dependencies
npm install- Create .env.local file
NEXT_PUBLIC_API_URL=https://your-drupal-site.com/jsonapi
DRUPAL_OAUTH_CLIENT_ID=your-client-id
DRUPAL_CLIENT_SECRET=your-client-secretEnsure OAuth is enabled in your Drupal site and you’ve created a client with the necessary scopes.
- Run the Development Server
npm run devNow visit http://localhost:3000 to see the app in action.
-
Next.js 15
-
Drupal JSON:API
-
next-drupal
-
Tailwind CSS
-
TypeScript