Skip to content

    Frontend System Design

    Long-Term Maintenance and Dependency Management

    Keep a front end healthy for years: read semver ranges, upgrade in small batches, automate update pull requests, track runtime support and own each dependency.

    By Published 12 min read

    • frontend-system-design
    • maintenance
    • dependencies
    • semver
    • renovate
    Share

    Standard lessonintermediateFrontend System Design

    Before this: Front-End Platform Teams and Governance

    What you'll learn: By the end of this lesson you will be able to read what a version range allows, explain what semantic versioning promises and what it does not, tell Current, Wanted and Latest apart in npm outdated, set an update cadence by size of change, configure a bot such as Renovate or Dependabot to open small grouped pull requests, plan around the support window of the runtime, handle a peer-dependency conflict and keep a replaceable seam around risky libraries.

    Think of a house. Nobody expects a roof to last unattended, but nobody replaces the whole house when a tile slips either. Owners who repaint a little every year spend less than owners who ignore everything for ten years and then face rot. A front end is the same: its package.json is a list of tenants of your attention, and each one ages at its own speed. Maintenance is the habit of small, scheduled repairs.

    The running example is the customer dashboard of an online shop, a React and TypeScript app built by several teams, with a few dozen direct dependencies and a much larger installed tree. All figures and names below are illustrative. This lesson takes the working definitions of the security controls from Dependency and Supply-Chain Security (lockfiles, install scripts, audit) and concentrates on what keeps a codebase current and understandable over years. The one-off big move (large-scale migration) and the platform-teams lesson on ownership are planned lessons, named here in plain text.

    The core idea

    1. Dependencies are a running cost, not a one-time choice. Every library you install ships new versions, gets fixes, may be abandoned and must run on a runtime that itself expires.
    2. Small, frequent upgrades are cheaper than rare, large ones. A one-version step has a short list of changes; a four-version jump has all of them at once, often with the original context lost (judgement, widely observed in practice).
    3. Semantic versioning is a promise from a maintainer, not a test result. It tells you where to look first. Your tests decide whether an update is safe.
    4. Maintenance needs an owner, a cadence and automation. Without them it becomes the neglected backlog that a rewrite later has to pay for.

    What a version range allows

    The semantic versioning specification (semver.org) defines MAJOR.MINOR.PATCH: increment the major version for incompatible API changes, the minor for new backward compatible functionality and the patch for backward compatible bug fixes. It says major version zero (0.y.z) is for initial development and "anything MAY change at any time", and that deprecating public API functionality requires a minor release. For deprecations, its FAQ advises releasing a minor version with the deprecation in place before removing the functionality in a major release.

    npm's package.json documentation lists the range forms: an exact version, ~version ("approximately equivalent"), ^version ("compatible with") and x-ranges such as 1.2.x. The node-semver documentation, which npm uses, gives the exact rule for the caret: it allows changes that do not modify the left-most non-zero element of the [major, minor, patch] tuple. So ^1.2.3 means >=1.2.3 <2.0.0-0, ^0.2.3 means >=0.2.3 <0.3.0-0 and ^0.0.3 means >=0.0.3 <0.0.4-0; the tilde ~1.2.3 means >=1.2.3 <1.3.0-0.

    Illustration 1: the minimal example

    Ranges checked with the semver package. Run in Node 26.13.1 with semver 7.8.5, the copy that ships inside npm 11.20.0, installed as a package so the import resolves as shown:

    import semver from "semver";
    
    for (const [range, version] of [["^1.2.3", "1.9.0"], ["^1.2.3", "2.0.0"], ["^0.2.3", "0.2.9"], ["^0.2.3", "0.3.0"], ["~1.2.3", "1.3.0"]]) {
      console.log(`${range} accepts ${version}:`.padEnd(26), semver.satisfies(version, range));
    }

    Output, from that run:

    ^1.2.3 accepts 1.9.0:      true
    ^1.2.3 accepts 2.0.0:      false
    ^0.2.3 accepts 0.2.9:      true
    ^0.2.3 accepts 0.3.0:      false
    ~1.2.3 accepts 1.3.0:      false

    Two consequences. A caret on a 1.x dependency will take every new minor and patch the next time you run an update, so the lockfile, not the range, is what pins what you run today. And a caret on a 0.x package is much narrower: a new 0.3.0 is outside the range, matching semver's rule that anything may change before 1.0.

    What is outdated, and what is only different

    npm outdated reports three versions per package. npm's documentation says Wanted is the highest version that satisfies the range in package.json and Latest is the version tagged latest in the registry, which may not be the highest or most recent one because maintainers manage dist-tags. A package can be up to date with its range and still a major version behind: that gap needs a decision.

    For known vulnerabilities, npm audit reports and npm audit fix applies remediations. The documentation says some fixes need --force, which can install versions outside your declared range including semver-major changes, and that some vulnerabilities cannot be fixed automatically. Treat a forced fix as an upgrade with its own review, not as a button.

    The runtime also expires

    Your dependencies run on a Node version in your build and, for server rendering, in production. The Node.js release page says a major version is Current for six months, then moves to long-term support, which "typically guarantees that critical bugs will be fixed for a total of 30 months", and that production applications should only use Active LTS or Maintenance LTS releases. It also says that starting with Node.js 27 the cycle becomes annual, with every major version moving to LTS after its Current phase. Dates change, so check the page.

    Dependencies declare the runtimes they support in the engines field, which npm documents as advisory unless engine-strict is set. The practical rule is a calendar item: when your Node major leaves support, upgrading it is a planned task with an owner, because libraries drop old runtimes in their next major.

    Cadence by size of change

    Not every update deserves the same process. A simple policy, which the snippet below encodes, is a function of how far behind a dependency is.

    Gap Examples Default handling
    Patch Bug fixes Group weekly, merge when checks pass
    Minor New features, backward compatible Group weekly, skim release notes
    0.x minor Anything may change Treat as major
    Major Breaking changes One pull request each, with an owner and a codemod where one exists
    Stale for a long time A year or more behind A ticket, because the gap is itself a risk

    Illustration 2: the realistic example

    An illustrative dependency inventory, turned into a plan. Run in Node 26.13.1 with semver 7.8.5, as above:

    import semver from "semver";
    
    // Illustrative inventory: [name, installed, latest, months since installed version was released]
    const inventory = [
      ["ui-kit", "4.2.1", "4.2.3", 1],
      ["router", "5.1.0", "5.4.0", 6],
      ["charts", "2.8.0", "3.1.0", 14],
      ["date-utils", "1.0.4", "1.0.4", 20],
      ["legacy-form", "0.9.2", "0.11.0", 30],
    ];
    
    function plan([name, installed, latest, months]) {
      let gap = semver.diff(installed, latest);
      if (gap === null) return "current";
      // 0.y.z: semver says anything may change, so a minor bump counts as major.
      if (gap === "minor" && semver.major(installed) === 0) gap = "major";
      if (gap === "patch" || gap === "minor") return months > 12 ? "batch now (stale)" : "weekly batch";
      if (gap === "major") return months > 12 ? "own a ticket, codemod first" : "schedule a migration";
      return `review (${gap})`;
    }
    
    for (const row of inventory) {
      const gap = semver.diff(row[1], row[2]) ?? "none";
      console.log(" ", row[0].padEnd(12), `${row[1]} -> ${row[2]}`.padEnd(16), gap.padEnd(6), plan(row));
    }

    Output, from that run:

      ui-kit       4.2.1 -> 4.2.3   patch  weekly batch
      router       5.1.0 -> 5.4.0   minor  weekly batch
      charts       2.8.0 -> 3.1.0   major  own a ticket, codemod first
      date-utils   1.0.4 -> 1.0.4   none   current
      legacy-form  0.9.2 -> 0.11.0  minor  own a ticket, codemod first

    The 12-month threshold is an illustration, not a standard. Note legacy-form: its raw gap prints minor, but it is handled as a major because it is a 0.x package.

    Automating the pull requests

    A bot turns "someone should update that" into a reviewed pull request. Two common ones, as documented at the time of writing:

    Capability Renovate Dependabot
    How often schedule (and lockFileMaintenance, disabled by default, whose own default schedule is before 4am on Monday) schedule.interval: daily, weekly, monthly, quarterly, semiannually, yearly or cron
    Fewer pull requests groupName: a non-null name enables grouping groups: all updates matching a rule go into one pull request; without it, one pull request per dependency
    Wait before adopting minimumReleaseAge: time before a new release is considered stable cooldown: delays version updates by a configurable number of days
    Skip a kind of change Rules per package ignore with update-types such as version-update:semver-major

    Notes on the table. Renovate's automerge defaults to false, so merging without review is opt-in, and its documentation states a default of 10 for prConcurrentLimit, which caps open pull requests. Dependabot's cooldown and Renovate's minimumReleaseAge are the same idea as the version delay in the security lesson: a short wait lets problems surface before you adopt a release. Neither tool decides whether an update is safe: your tests do, so the testing pyramid is part of the maintenance system, and CI is where the bot's pull request meets it (CI/CD for Front Ends).

    Figure 1. The update pipeline

    Dependency updates: bot, checks, review and staged releaseRegistry to Update bot; Update bot to CI checks (opens PR); CI checks to Review (green); Review to Staged release (merge)Registry: new releasesRegistrynew releasesUpdate bot: grouped PRsUpdate botgrouped PRsCI checks: tests, typesCI checkstests, typesReview: owner decidesReviewowner decidesStaged release: ramp, rollbackStaged releaseramp, rollbackopens PRgreenmerge

    How to read this: the bot only proposes. Two gates sit between a new release and users: automated checks and a human owner for anything beyond a patch. The staged release is the last safety net; see Blue-Green, Canary and Rollbacks for Front Ends.

    Deciding what to do with one update

    Figure 2. One update, one decision

    flowchart TD accTitle: Deciding how to handle a dependency update accDescr: A decision tree. A security fix goes to the fast path. Otherwise a patch or minor update goes into the weekly group. A major update asks whether a codemod or upgrade guide exists; if yes, make a pull request with an owner; if no, schedule a spike. A package that is abandoned or has no maintainer response goes to a replace-or-fork decision. U["New version available"] --> S{"Security fix?"} S -->|"yes"| F["Fast path: review,
    test, ship"] S -->|"no"| G{"Gap size"} G -->|"patch or minor"| W["Weekly group"] G -->|"major or 0.x minor"| M{"Codemod or
    upgrade guide?"} M -->|"yes"| P["PR with an owner"] M -->|"no"| K["Spike, then plan"] G -->|"no releases, no replies"| A["Replace or fork decision"]

    How to read this: the size of the gap sets the process, and an abandoned package leaves the upgrade tree entirely: it needs a decision about the dependency itself.

    Dependencies as a lifecycle

    A dependency is not a permanent member of the codebase. Give each a state and let the state drive action.

    Figure 3. Lifecycle of a dependency

    stateDiagram-v2 accTitle: Lifecycle of a dependency accDescr: A dependency is adopted, then current, then falls behind. From behind it can be updated back to current, or become deprecated or abandoned. A deprecated dependency is wrapped and replaced, then removed. A current dependency may also be removed when no longer needed. [*] --> Adopted Adopted --> Current Current --> Behind: new releases Behind --> Current: update Behind --> Abandoned: no maintainer Abandoned --> Wrapped: put behind an interface Wrapped --> Replaced: swap implementation Replaced --> [*]: old one removed Current --> [*]: no longer needed

    How to read this: the path to the right is the exit plan. A dependency behind an interface you own can be replaced in one place, using the expand, migrate and contract steps from the migration lesson.

    Three habits (all judgement) keep the lifecycle healthy. Record why each direct dependency exists and who owns it. Wrap risky or volatile libraries (date handling, charts, form helpers) behind a thin module of your own, so a replacement touches one folder. Remove what is unused: every dependency adds update work and, as the security lesson notes, attack surface. Monorepos and Shared Libraries and Design System Governance and Versioning cover how internal packages carry their own version promises.

    Illustration 3: a failure, a peer-dependency conflict

    A form plugin declares a peer dependency on the host library's major version 3. The host releases major 4. npm's documentation says that, as of npm v7, peer dependencies are installed by default and advises keeping the range broad, because under semver only changes in the host's major version will break a plugin. This plugin's range does not include 4, so installing the new host fails with a conflict. The paths out are a plugin update that supports 4, replacing the plugin, or the overrides field: the documentation says overrides apply only in the root package.json, and an override forces a combination the plugin's author has not tested, which is a risk you now own. The scenario is hypothetical; the lesson is to check plugins that lag their host first in an upgrade plan.

    The other side of this topic. A back-end service has the same problem with its libraries, build plugins and base images, and its runtime also reaches end of support. The tooling differs; the habits (small batches, an owner, a way to replace a library) are the same.

    Trade-offs

    Choice Gain Cost
    Weekly grouped updates Small steps, fresh context Review time every week
    Quarterly batch Fewer interruptions Larger, riskier upgrades
    Auto-merge for patches Little human time A bad release can reach production unseen
    Release-age delay Time for problems to surface Fixes arrive later
    Pin exact versions Predictable installs You must update every pin on purpose
    Wrap libraries One place to replace An adapter to write and maintain

    Build it

    This lesson has no lab. The two Node snippets were run unedited in Node 26.13.1 against semver 7.8.5 (the copy bundled with npm 11.20.0) and their output is shown as captured. Bot options come from the documentation pages in Related reading; no bot was run, and no registry or private data was used.

    In practice: a maintenance policy for the dashboard

    NOTE

    This is a realistic scenario, not a case history. It is a composite built from common production patterns. It describes no specific company or product, and every number in it is an illustrative assumption.

    The situation

    The dashboard has about forty direct dependencies. Updates happen when someone is bored or when a vulnerability alert forces it. The last Node upgrade took three weeks because several libraries had dropped the old version, and one charting library is two majors behind. Teams say "we do not have time for updates".

    Starting architecture

    Figure 4. Updates by accident

    Starting point: no bot, no owner, no scheduleAudit alert to Whoever notices; Whoever notices to Lockfile (big jump); Lockfile to DashboardAudit alert: occasionalAudit alertoccasionalWhoever notices: ad hocWhoevernoticesad hocLockfile: years of driftLockfileyears of driftDashboard: one big upgradeDashboardone big upgradebig jump

    How to read this: the warning boxes are the process gaps. Updates are triggered by alerts, done by whoever happens to notice, and arrive as one large change.

    Options considered

    Option What it fixes What it costs Risk
    Quarterly upgrade sprint Predictable time A big batch each time Large pull requests, lost context
    Bot with weekly groups and an owner rota Small steps, steady Review time each week Notification fatigue if ungrouped
    Freeze and ignore Nothing changes Nothing Security and runtime debt grow

    The decision

    Field Decision record
    Context Updates are ad hoc, and the runtime upgrade took weeks.
    Decision A bot opens one grouped weekly pull request for patches and minors, with a release-age delay, and one pull request per major with an owner. A rota owner reviews. Majors for 0.x packages are handled as majors. The Node support calendar is a recurring ticket. Risky libraries go behind an interface we own.
    Consequences, good Small reviewable steps; the Node upgrade stops being a project.
    Consequences, bad Weekly review time; some noise from the bot.
    Revisit when The review burden outgrows the rota, or a major is stuck for two quarters.

    Rollout and verification

    1. Inventory direct dependencies with owner, purpose and gap; delete what is unused.
    2. Turn the bot on in one repository with grouping and a release-age delay, and run a month before spreading it.
    3. Fix CI so a green build means something: tests, types and a bundle-size check for dependency changes.
    4. Stage the release of dependency updates through the usual canary, with a rollback.
    5. Put the runtime calendar in the team's planning.

    The 2 a.m. failure

    A grouped minor update ships and a date-formatting library changes its default output. Order dates show in the wrong format for some locales. First three checks: (1) which package in the group changed output; (2) whether a test covers the format; (3) whether the lockfile diff matches the release notes. Mitigation: roll back the release (the canary should have caught it at a small share). Follow-up: pin that package until the format is covered by a test, and add the test.

    Architect's notes

    • Make the owner explicit. An update with no owner is a backlog item forever.
    • Treat 0.x as major and a long-stale package as a risk.
    • Put the support calendar in planning, for the runtime and for frameworks.
    • Keep seams around volatile libraries so replacement is a small change.

    Common mistakes

    • Letting updates pile up until a forced, huge upgrade.
    • Trusting semver as a guarantee instead of running tests.
    • Using npm audit fix --force without reading what it changes.
    • Auto-merging everything, with weak tests.
    • No grouping, so the bot floods the team and gets ignored.
    • Never removing unused dependencies.

    Key takeaways

    • Dependencies are a running cost; small frequent updates are cheaper than rare large ones.
    • A caret range follows the left-most non-zero element: 0.x ranges are narrow and 0.x minors should be handled as majors.
    • Wanted is what your range allows; Latest is the registry's tag. The gap between them is the decision.
    • Bots such as Renovate and Dependabot group, schedule and delay updates; tests and owners decide.
    • Plan for the runtime's end of support and keep a replaceable seam around risky libraries.

    Practice exercises

    Exercise 1: Starter (30 min). Run npm outdated in a project you maintain and write, for each row, whether the gap is in your range (Wanted) or beyond it (Latest).

    Exercise 2: Intermediate (2 hours). Extend the inventory snippet to read a real package.json and print a plan per dependency, then argue with it: which rows would you override?

    Exercise 3: Advanced (half day). Write a bot configuration for your repository with weekly grouping, a release-age delay and one pull request per major, and list what you could not verify without running the bot.

    In this course:

    Official documentation

    Ask about this article

    Get answers grounded in this post. AI-generated — based on this article, and may be imperfect.

    Scaled AI Weekly

    Enjoyed this? Get more like it every Monday.

    Real architecture decisions, LLMOps patterns that survive production, and engineering leadership advice — from 12+ years of building at enterprise scale. Free. No spam. Unsubscribe anytime.

    Get new articles by email

    Free. We email a confirmation link first, and you can unsubscribe from any email.

    Join engineers building production AI systems

    Comments