Automate certificate renewal on Node.js applications

Node.js can renew certificates in the app with an ACME client and reload them without dropping connections, or hand TLS to a proxy that renews for it. Shorter public lifetimes make either path mandatory rather than optional.

On this page

Can Node.js renew its own certificates, and what do 47-day lifetimes change?

Yes, Node.js can renew its own certificates, and there are two places to do it. Inside the application, node-acme-client can obtain and renew certificates over ACME, and the app can then load the new material into a running TLS server with server.setSecureContext() without a restart. Outside the application, TLS can be terminated in front of Node.js by Caddy or nginx, which handle issuance and renewal themselves and forward plain traffic to the app. Either way, the public subscriber certificate lifetime is shrinking. The CA/Browser Forum's Baseline Requirements set a maximum of 200 days from 15 March 2026, 100 days from 15 March 2027 and 47 days from 15 March 2029, so manual renewal stops being workable. Teams that serve TLS directly from Node.js own the in-app renewal path, and teams that run the proxy in front of it own the renewal path there. Both groups need to confirm which one applies to each service before the shorter lifetimes arrive.

The practical question for each team is where the renewal loop lives and who watches it. If the Node.js process renews, the renewal job, the ACME account, the challenge handling and the reload must all be tested together, and the reload must replace the secure context without interrupting existing connections, which server.setSecureContext() is documented to do for the options it accepts. node-acme-client's auto() method covers the full issuance flow with an http-01 challenge or, where that is unavailable, dns-01, and wildcard names can only be validated through dns-01, so the challenge functions must be written for the environment. If a proxy handles TLS, the team should confirm which ACME client and reload behavior it uses, and what happens when renewal fails. Let's Encrypt recommends monitoring that alerts when certificates are not renewed as expected and does not recommend manual renewal, since shorter lifetimes would require it far more often. Teams should confirm the minimum Node.js version their chosen node-acme-client release requires, and check the current documentation for each tool before committing to a design.

Which lifetime steps apply to Node.js certificates and when

This table lists each CA/Browser Forum and Let's Encrypt lifetime step with its start date, and what it means for a Node.js service in renewals per year and in what breaks if renewal is manual. Each Let's Encrypt change reaches a certificate at its next renewal after the date, not the day it takes effect.

StepStart dateWhat it means for a Node.js service
CA/B Forum maximum of 200 days15 March 2026Certificates renew about every 200 days at most, roughly 2 times a year. Manual renewal is still workable but must be scheduled.
CA/B Forum maximum of 100 days15 March 2027Renewals roughly 3 to 4 times a year. Manual renewal becomes error-prone, and a missed renewal stops HTTPS for the service.
CA/B Forum maximum of 47 days15 March 2029Renewals about 8 times a year. Manual renewal is not practical, so the Node.js process must reload the new key and certificate automatically.
CA/B Forum validation reuse of 200 days, then 100 days, then 10 days15 March 2026, 15 March 2027, 15 March 2029Domain validation must be repeated more often, so the ACME client must complete challenges on each renewal and cannot rely on old validation.
Let's Encrypt opt-in 45-day profile (tlsserver)13 May 2026Only applies if the ACME client requests this profile. Renewals about 8 times a year. Your client must support profile selection or the default applies.
Let's Encrypt default 64-day certificates with 10-day reuse10 February 2027Applies at the next renewal after this date. Renewals about 6 times a year, and the Node.js service must renew before expiry without a hardcoded 60-day schedule.
Let's Encrypt classic 45-day certificates with 7-hour reuse16 February 2028Applies at the next renewal after this date. Renewals about 8 times a year. A hardcoded 60-day interval will no longer be sufficient.

How certificates reach a running Node.js server

Before you automate renewal on Node.js, decide which of two models you run, because it determines where the renewal logic lives. In the first, the Node.js application itself obtains the certificate and private key, stores them, and serves TLS directly. In the second, a proxy in front of Node.js terminates TLS, obtains and renews the certificate, and forwards plain HTTP to the application over a private network. In the proxy model the renewal work sits outside the Node.js code, and the proxy is what has to be reloaded. Both models carry the same 200-day maximum subscriber validity from 15 March 2026 and the 100-day and 47-day steps that follow, so the schedule is the same either way. Your choice should follow from which team owns the certificate lifecycle and whether you already run a proxy.

When the application terminates TLS, a renewed certificate can be loaded without restarting the process. The Node.js TLS API provides server.setSecureContext(options), added in v11.0.0, which replaces the secure context of an existing TLS server using any tls.createSecureContext() options, including key, cert and ca. Existing connections are not interrupted, so new handshakes pick up the new certificate while open sessions continue. Your renewal job therefore has to read the new files, call this method on the live server, and confirm the handshake now presents the new certificate. Note that this sets the context, not the process lifecycle, so a failed reload should be treated as a renewal failure to alert on rather than silently ignored.

The sources do not set a file layout for the application, so decide where key and certificate files live yourself and confirm the storage location, ownership and file permissions with your security team. The private key should be readable only by the account the Node.js process runs as. Keep the renewal client's write path and the server's read path in mind so that a partial write never replaces a working certificate.

Which automation options fit a Node.js service

node-acme-client is an ACME client library for Node.js that implements RFC 8555. It lets the application obtain and renew its own certificate, so the process that serves TLS also manages the issuance flow. Its auto() method takes one config object and runs the full process, using options such as csr, email, termsOfServiceAgreed, challengeCreateFn and challengeRemoveFn.

  • Runtime requirement: Version 5.x requires Node.js v16 or later. Confirm your runtime version before you pin the library.
  • License: The library is MIT licensed, so confirm that its terms fit your internal policies.
  • Challenge selection: Auto mode uses http-01 when it is available and falls back to dns-01.
  • Wildcard certificates: Wildcard names can only be validated through dns-01, so you need a DNS update hook in challengeCreateFn and challengeRemoveFn.
  • Fine-grained control: Methods such as createAccount() and createOrder() exist for teams that need to control each step. The .forge interface is deprecated in favor of .crypto, so use .crypto in new code.

With this option, renewal logic and the reload of the new certificate live in your application code. Check how the service picks up a new certificate without a restart, and confirm that the renewal schedule still works at shorter lifetimes.

How to set up renewal for a Node.js service in order

This sequence sets up a Node.js service so that it obtains and renews its own certificate through an ACME client, loads the new key and certificate without dropping connections, and keeps renewal running on a schedule that works with shorter lifetimes. A proxy in front of Node.js is an alternative path covered at the end.

  1. Confirm Node.js and TLS API versions

    The engineer responsible for the service checks the Node.js runtime version on the host that runs the application. The node-acme-client 5.x line requires Node.js v16 or later, so a runtime older than that needs an upgrade or an earlier client version before anything else is set up. The engineer also confirms that the runtime supports server.setSecureContext(), which was added in v11.0.0, because the reload step depends on it. The step is done when the runtime version output is recorded and both version requirements are met in the target environment.

  2. Choose the validation method

    The engineer decides how the certificate authority will check control of the domain. The http-01 method works when the host's port 80 is reachable from the internet, and node-acme-client's auto mode uses it first. The dns-01 method is needed for wildcard certificates, since wildcards can only be validated that way, and it is also the fallback when port 80 is not available. Dns-01 requires write access to the DNS zone, so the engineer confirms who controls that access before choosing it. The step is done when the chosen method and the reason for it are written into the service's configuration notes.

  3. Run the auto call with configuration options

    The engineer writes a script or startup module that calls node-acme-client's auto() method with a single config object. The config carries the certificate signing request, an account email, the terms of service agreement, and the challengeCreateFn and challengeRemoveFn functions that place and clear the validation token for the chosen method. The method handles the full process of obtaining the certificate, so the engineer does not need to call createAccount() or createOrder() separately unless a custom flow requires it. The step is done when a test run against the certificate authority's staging environment returns a certificate and key pair without errors.

  4. Write the new key and certificate to storage

    The script saves the newly issued private key and certificate to a location the Node.js process can read, using the same file or secret path the service already uses. The engineer sets file permissions so that only the service account can read the private key. Writing the files before the reload step means that a restart at any point loads the current certificate instead of an expired one. The step is done when the files exist at the chosen paths, have the expected permissions, and the certificate's expiry date matches what the certificate authority reported.

  5. Load the new certificate with setSecureContext

    The script reads the stored key and certificate and passes them to server.setSecureContext(options) on the running TLS server. The Node.js documentation states that this replaces the secure context of an existing server using any tls.createSecureContext() options, such as key, cert and ca, and that existing connections are not interrupted. The engineer confirms this behavior in the runtime version used, and does not assume that a restart is needed. The step is done when a fresh TLS connection to the service presents the new certificate's serial number and expiry date.

  6. Schedule renewal on a schedule that fits shorter lifetimes

    The engineer schedules the renewal script to run on a recurring basis, such as a cron job or a timer in the service's process manager. Let's Encrypt recommends using ACME Renewal Information (ARI), defined in RFC 9773, and says a client without ARI support must use a schedule that works with 45-day certificates, and that renewing at a hardcoded 60-day interval will no longer be sufficient. Renewing roughly two thirds of the way through the lifetime is described as acceptable. The step is done when the schedule is recorded, the next run time is confirmed, and the schedule is reviewed against the lifetime the chosen certificate authority issues.

  7. Confirm renewal and set failure monitoring

    The engineer checks that the scheduled job completed successfully and that the service serves the renewed certificate. Let's Encrypt recommends setting up monitoring that alerts when certificates are not renewed when expected, and does not recommend manual renewal, since shorter lifetimes would require it more often. The engineer sets an alert on the certificate's remaining lifetime and on the renewal job's failure status, and confirms that the alert reaches a person who can act on it. The step is done when a deliberate test alert is received and the renewal log for the last run is recorded.

  8. Use a proxy in front of Node.js instead

    If the team prefers to keep TLS out of the application, it can place a proxy in front of Node.js. Caddy's Automatic HTTPS uses Let's Encrypt and ZeroSSL as default ACME certificate authorities, so issuance and renewal are handled by Caddy's own configuration. For nginx, the ngx_http_acme_module provides ACMEv2 issuance through the acme_issuer and acme_certificate directives. The engineer checks the proxy documentation for the exact configuration keys in the version in use, and then confirms that the proxy forwards requests to Node.js over the internal address. The step is done when a test request through the proxy shows the renewed certificate and the Node.js service responds behind it.

What must be in place before automated renewal works

Automated renewal on Node.js depends on a few conditions being true before the first run. Each card below is one of them, and the list should be checked against your environment before any renewal code is deployed.

Node.js version floor

node-acme-client 5.x requires Node.js v16 or later, so any host on an older runtime must be upgraded before the client can be installed. Separately, server.setSecureContext() was added in v11.0.0, so the runtime must be at least that version for the app to swap in renewed certificates without restarting connections. Check the running version on each host, not only the one used to build the image, because the two often differ. Confirm the exact minimum for other tooling in your stack against its own documentation.

node-acme-client README

Network reachability for http-01

With http-01, the CA connects to your server on port 80 to fetch a token, so that path must be reachable from the public internet and the challenge response must be served by the process doing the validation. If TLS is terminated in front of Node.js, the proxy or load balancer must route /.well-known/acme-challenge/ to the place where the token is answered. Firewall rules, redirects to HTTPS and private network placement can all block this. Test the path from outside your network before relying on it.

DNS API access for dns-01

dns-01 is required for wildcard names, and node-acme-client auto mode falls back to it when http-01 is not available. Your code needs credentials that can create and remove the _acme-challenge TXT records, supplied through the challengeCreateFn and challengeRemoveFn callbacks. Provider-specific details such as API endpoints, token scopes and propagation timing differ by DNS host, so confirm them in your provider's documentation. Wildcard certificates cannot be validated any other way.

Read and write access to storage

The process running renewal must be able to read the account key, private key and certificate files, and write new versions of them. If the app runs as a non-root user, confirm that user owns the storage directory and that the Node.js process can reload the new files into setSecureContext(). Restricted permissions are a common reason renewal succeeds at the CA but the new certificate never reaches the server. Keep the account key protected, because anyone holding it can act on the account.

Contact email and terms acceptance

The auto() call takes an email and termsOfServiceAgreed option, so renewal cannot proceed until you supply a contact address and accept the CA's terms of service. Use a mailbox that someone monitors, since expiry and policy notices go there. Acceptance is a decision the organization should record, not a default to flip silently in code. Confirm the current terms and contact requirements with the CA you have chosen.

Choosing the ACME CA

Decide which ACME certificate authority will issue your certificates before writing the renewal code, because node-acme-client talks to whichever directory URL you configure. Public CAs differ in supported challenge types, lifetimes and account rules, so check each one against the requirements above. Caddy and nginx use Let's Encrypt and ZeroSSL defaults in their own setups, which is a separate decision if TLS sits in front of Node.js. Record the chosen CA in your runbook so renewal failures can be traced to a specific provider.

How to confirm Node.js certificates keep renewing

Let's Encrypt recommends setting up monitoring that alerts you when certificates are not renewed when expected, and it does not recommend manual renewal, because shorter lifetimes would require it far more often. For a Node.js service, a renewal that calls server.setSecureContext(options) can succeed in the application's own logs while the certificate actually being served is still old. So confirm renewal from outside the process: periodically connect to the public hostname and read the served certificate's notAfter date, using a check that runs on a different host from the application. Alert on that expiry value, not on whether the renewal code returned without error.

Log each run of the auto() call from node-acme-client and each setSecureContext call in the application, recording the domain names, the outcome, and the new certificate's expiry. Keep these entries in a dated record of renewals, because an auditor or customer may ask for proof of when each certificate was issued and replaced. Tie your alert thresholds to the timing Let's Encrypt describes as acceptable: renewal about two thirds of the way through the lifetime. Under the 45-day certificates from Let's Encrypt's published timeline, that means an alert should fire well before the remaining validity runs out, not at the last few days. Confirm the lifetime your certificates actually carry, since the new validity applies to each certificate at its next renewal after the stated dates.

Where your ACME client supports ACME Renewal Information (ARI), the server can tell the client when to renew. RFC 9773 defines this extension, published in June 2025, so that clients do not make false assumptions about appropriate renewal periods. Check whether your node-acme-client version and the certificate authority you use support ARI before relying on it, and make the monitoring independent of it, so a missed renewal window is still detected. If ARI is not available, the renewal schedule must work with the shorter lifetimes, since Let's Encrypt states a hardcoded 60-day interval will no longer be sufficient.

Common questions about renewing certificates on Node.js

Does Node.js support ACME certificate issuance directly?

Node.js does not ship an ACME client in its core, but you can run one inside your application. The node-acme-client package is a Node.js ACME client that implements RFC 8555, the protocol Let's Encrypt and other ACME certificate authorities use. Its version 5.x requires Node.js v16 or later, so confirm your runtime version before you adopt it. Once a certificate is issued, you pass the new key and certificate to your TLS server. The Node.js TLS API provides server.setSecureContext(options), added in v11.0.0, which replaces the secure context of a running server without interrupting existing connections. Check the package's README for the current API before you write production code against it.

Which ACME client should a Node.js team use?

The right choice depends on where TLS terminates. If Node.js serves TLS itself, node-acme-client is the in-process option. It is licensed under MIT, which generally permits use in commercial projects, though your legal team should confirm the terms that apply to your product. If you prefer TLS to terminate in front of Node.js, a proxy can handle issuance and renewal instead. Caddy's Automatic HTTPS uses Let's Encrypt and ZeroSSL as default ACME certificate authorities. nginx offers ACMEv2 issuance through the acme_issuer and acme_certificate directives in its ngx_http_acme_module. Choosing a proxy path moves renewal out of your application code, which often simplifies operations for teams without much PKI experience.

Can wildcard certificates renew automatically on Node.js?

Yes, but only through the dns-01 challenge. The node-acme-client documentation states that wildcard certificates can only be validated through dns-01, so the http-01 challenge will not work for them. Its auto mode uses http-01 when it is available and falls back to dns-01, so for wildcard names you need a challenge function that creates and removes DNS TXT records through your DNS provider. Automated renewal then depends on that DNS integration staying in place, including its credentials. Review how those credentials are stored and who can read them, because a DNS API key can change records for your whole domain.

How often will certificates renew under 47-day lifetimes?

Under the CA/Browser Forum Baseline Requirements, the maximum subscriber certificate validity steps down from 200 days on 15 March 2026, to 100 days on 15 March 2027, and to 47 days on 15 March 2029. Let's Encrypt's own timeline is separate: it moves its classic profile to 64-day certificates on 10 February 2027 and to 45-day certificates on 16 February 2028. Let's Encrypt recommends ACME Renewal Information (ARI), defined in RFC 9773, so clients learn the right renewal window from the certificate authority. Clients without ARI support must use a schedule that works with 45-day certificates, and it says a hardcoded 60-day interval will no longer be sufficient. Renewing about two thirds of the way through the lifetime is acceptable.

What happens when a certificate renewal fails, and how do you recover?

A failed renewal leaves the current certificate in place until it expires, so the window to fix the problem is the remaining lifetime. Causes usually include DNS or challenge errors, expired account credentials, rate limits, or a server that never picks up the new files. To recover, first read the error from the ACME client, then fix the failing challenge path and re-run issuance. Make sure the new key and certificate are actually loaded: with server.setSecureContext(options), confirm the call succeeds and check the served certificate's expiry from outside your network. Let's Encrypt recommends monitoring that alerts you when certificates are not renewed when expected, and it does not recommend manual renewal, because shorter lifetimes would require it far more often.

Should a team bring in outside help for Node.js certificate automation?

It is worth considering outside help when renewal sits inside application code, when wildcard names need DNS automation, or when several services share one certificate process. The work is usually a mix of design choices, such as in-process renewal or a proxy, plus integration with DNS providers, secret storage and monitoring. DeployOpen plans and implements self-hosted platforms inside a client's own infrastructure, and its fixed-scope engagements define scope, deliverables and timelines in writing before work starts. It does not issue audit reports or certifications. To compare options, ask any provider what they will change in your application, how they will test renewal before the first expiry, and who will support it after handover.

Can a team run the renewal setup in-house instead?

Yes, if the team already runs ACME clients and monitors its certificates. The core steps are to pick a client, set up the challenge type your names need, store the key and certificate securely, load them into the TLS server, and monitor expiry. Start by reading the node-acme-client README and the Node.js TLS API documentation for your exact versions. Then test renewal in a staging environment with a short-lived certificate before you rely on it in production. The main ongoing cost is attention: someone must own the monitoring, respond to failed renewals, and keep the setup working as lifetimes shorten.

How a Node.js certificate moves from the CA to a live server

The flow starts with the Node.js app, or node-acme-client inside it, sending an order to the ACME certificate authority. The CA then issues a validation challenge that is answered over http-01 or dns-01, and it returns the signed certificate. The app writes the key and certificate to storage and loads them into the running TLS server with server.setSecureContext(), which replaces the secure context without interrupting existing connections. A separate branch covers Caddy or nginx terminating TLS in front of Node.js. Check that the renewal schedule works with 45-day certificates and that the reload path actually runs.

Certificate flow from the ACME CA to a live Node.js TLS server, with a proxy branch.

How DeployOpen helps teams automate certificate renewal

DeployOpen scopes, builds, tests and hands over certificate renewal for Node.js applications, whether TLS is served from the app itself or terminated in front of it. Each engagement starts with a written scope that names the renewal method, the ACME client or proxy, the reload behavior and the monitoring your team will use.

How we scope

  • We confirm whether your Node.js process serves TLS directly or sits behind a proxy such as Caddy or nginx.
  • We record which Node.js version you run, since the node-acme-client 5.x line requires Node.js v16 or later.
  • The written scope lists which names need certificates, including whether wildcard names require dns-01 validation.

How we build

  • We set up the renewal client, using node-acme-client's auto mode or the proxy's built-in ACME support, as agreed in scope.
  • We wire certificate reloads with server.setSecureContext(), which replaces the secure context without interrupting existing connections.
  • We configure renewal to follow ACME Renewal Information where supported, so schedules track the shorter lifetimes.

How we hand over

  • We document the renewal flow, the hook or reload steps, and where each certificate and key file is stored.
  • We test a forced renewal and a failed renewal in your environment and record the results in the handover pack.
  • We deliver a runbook that explains how to check renewal status and what to do when an alert fires.

How we support

  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and renewal monitoring are available as a retainer.
  • For a quote, ask for the scope, the named renewal method and the monitoring deliverables in writing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.