Next.js developer in Genoa

Next.js for businesses in Genoa, delivered remotely by one developer.

Next.js developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.
  • Local WordPress meetup: WordPress Meetup Genova

My WordPress.org profile

When one Italian public body reads data from another, the exchange runs through PDND Interoperabilità, the national platform that PagoPA documents on its developer portal. A Next.js back end that sits on the consuming side has a short, well-defined job: sign a request, obtain a voucher, call the provider’s API with it and let the voucher expire. This page follows that job, using the manual published by PagoPA.

Moored sailing boats at the Porto Antico in Genoa

Sailing boats at the Porto Antico of Genoa, September 2023. Image credit Timothy A. Gonsalves under CC BY-SA 4.0, via Wikimedia Commons.

#What is PDND Interoperabilità?

The manual’s overview describes it as infrastructure for secure, standardised data exchange. Member bodies join, publish their own e-services and access those of others through uniform authentication, authorisation and tracing. It rests on article 50-ter of the Codice dell’Amministrazione Digitale. The manual states the goals as simpler administrative procedures, interoperability through common rules, and governance through tracing and control, and it ties the platform to the once-only principle: public administrations should not ask citizens and businesses again for information already held by other public administrations.

One line matters for architecture. Data owned by providers does not pass through PDND and is not stored in it. PDND issues the vouchers and traces the exchange. The data itself travels from the provider’s API to the consumer.

The manual names two roles for a member body: the one that publishes an e-service and holds the data, the provider (erogatore), and the one that uses it, the consumer (fruitore). A body can be both.

#Who can join?

The “who this is for” page lists the bodies that can join as providers or consumers of data:

  • public administrations under article 2, paragraph 2, letter a of the CAD
  • public service managers under letter b
  • publicly controlled companies under letter c
  • companies in the consolidated economic account (SCEC)
  • e-procurement platforms certified by AgID
  • insurance companies, only for specific flows set by current rules

Under the 2025 update of the AgID guidelines the page says access extends to private companies, which for now can use the attestation environment with fictitious data, while production participation depends on future guidelines. Completing the accession procedure is indispensable before using the platform. Bodies outside the listed cases can ask for a specific assessment through support during accession.

A Next.js project in Genoa therefore starts with a question to the body, not to the developer: is the organisation already a member, and who holds the accession? Everything below needs that answer.

#What are the steps from catalogue to voucher?

The quick start lists five steps for a consumer:

  1. Browse the e-service catalogue.
  2. Request access to a specific e-service.
  3. Create a purpose (finalità) and associate it with the e-service.
  4. Create a client and associate it with the purpose.
  5. Obtain a voucher to use when accessing the e-service.

Steps one to four are done in the front office by people, not by code. They end with a client, a key pair whose public key is uploaded to that client, and a purpose the client is associated with. The back end only starts at step five.

#Which user roles are involved?

To reach the front office, the manual says to log in to the Area Riservata with SPID or CIE, select the body, choose Interoperabilità, and select the environment: Produzione, Collaudo or Attestazione. Only Produzione serves real data.

It describes five roles:

RoleWhat the manual says
Administrator (Amministratore)complete control of the front office, appointed by the legal representative, creates and revokes other users
Security operatortechnical role for cryptographic material, cannot manage users or e-services
API operatormanages e-services and the technical aspects of purposes
Evaluatorfills in and signs risk analyses assigned by administrators
Consultantviews the body’s risk analyses before and after a purpose is published

For the API operator, the page’s text and its permissions table differ on cryptographic material, so a project should confirm with the administrator what that role may do. The client page adds a rule that matters for a developer: the only roles allowed inside a client are administrator and security operator. A security operator does not have to belong to the body and can come from a technology partner, but the body’s administrator must register that person’s account in the Area Riservata first.

#What does the voucher request look like?

The manual separates two voucher types. A Bearer voucher works against a provider’s API or against PDND APIs such as Core v2, Signal Hub and Tracing, and the manual says it is what the great majority of services use. A DPoP voucher serves, among others, Core v3, and uses two independent tokens, one towards PDND and one towards the resource server, whose match is needed for authorisation. If the provider states no preference, the default is a Bearer voucher for the provider’s API with no additional information. A variant with additional information follows the MoDI Audit REST 02 pattern, used for example for ANPR services.

The base flow has three parts: generate and sign a client assertion, send it to the PDND authorisation server, then send the data request to the provider with the voucher in the header.

The Bearer tutorial gives the client assertion fields. The header carries kid (the id of the signing key from PDND), alg (for now always RS256) and typ (JWT). The payload carries:

  • iss and sub: the clientId
  • aud: the audience, found on PDND
  • jti: a unique random id set by the caller
  • iat and exp: creation and expiry in UNIX epoch
  • nbf: optional
  • purposeId: the id of the purpose, available in the front office

The request to the authorisation server carries client_id, client_assertion, client_assertion_type set to urn:ietf:params:oauth:client-assertion-type:jwt-bearer, and grant_type set to client_credentials. The URL depends on the environment and is shown in the front office. The front office also offers a sample Python script and a debug tool for client assertions under the development tools.

#How does that look in a Next.js back end?

A route handler or a server-only module signs the assertion with the private key and caches the voucher until it expires. The sketch uses the jose library that the Next.js authentication guide itself uses for sessions. The names of the environment variables are placeholders.

// app/lib/pdnd.ts
import 'server-only'
import { importPKCS8, SignJWT } from 'jose'
import { randomUUID } from 'node:crypto'

export async function requestVoucher() {
  const key = await importPKCS8(process.env.PDND_PRIVATE_KEY!, 'RS256')
  const clientId = process.env.PDND_CLIENT_ID!

  const assertion = await new SignJWT({
    purposeId: process.env.PDND_PURPOSE_ID!,
  })
    .setProtectedHeader({
      alg: 'RS256',
      kid: process.env.PDND_KEY_ID!,
      typ: 'JWT',
    })
    .setIssuer(clientId)
    .setSubject(clientId)
    .setAudience(process.env.PDND_AUDIENCE!)
    .setJti(randomUUID())
    .setIssuedAt()
    .setExpirationTime('10m')
    .sign(key)

  const res = await fetch(process.env.PDND_TOKEN_URL!, {
    method: 'POST',
    body: new URLSearchParams({
      client_id: clientId,
      client_assertion: assertion,
      client_assertion_type:
        'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',
      grant_type: 'client_credentials',
    }),
  })

  const { access_token, expires_in } = await res.json()
  return { voucher: access_token as string, expiresIn: expires_in as number }
}

The call to the provider then sets Authorization: Bearer <voucher>, which the tutorial names as the header format for all later calls. The 10m lifetime of the assertion is an example, and the sample omits error handling. The assertion lifetime, the request encoding and the token URL come from the front office and the tutorial for your environment, so check them there.

The response carries access_token and expires_in in seconds. The manual’s example shows 600, which is 10 minutes, and says the provider chooses the voucher duration for its own security reasons, so it can differ between e-services. Cache per e-service and renew from expires_in, not from a constant.

On the provider’s side, the voucher contains issuer interop.pagopa.it, audience, purpose, producer, consumer, e-service and descriptor identifiers, and the manual says the provider runs the checks and then processes the request.

#Where do the secrets live?

The private key is the credential. The Next.js environment variables guide says variables without the NEXT_PUBLIC_ prefix are available only in the Node.js environment and are not accessible to the browser, while a prefixed variable is inlined into the client bundle at build time. A multiline private key is supported in .env files, and the guide warns that .env files almost never belong in the repository.

The data security guide adds two habits that fit this job: read process.env only inside a data access layer, and mark that module server-only, so an accidental import from a Client Component fails the build. The voucher goes to the provider and never to the browser.

#Scoping a PDND client in Next.js

If a Genoa body needs a Next.js back end that consumes an e-service, send the e-service name, the environment you work in, whether the client and purpose already exist and the provider’s voucher type through the contact page. The first written estimate is free and covers the signing module, voucher caching and the calling code. Joining PDND and creating the client are done by your administrator. The wider Next.js work is described on the Next.js developer page.

WordPress support & development in Genoa

Need this service: Next.js developer in Genoa?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Explore other WordPress services and knowledge base