<< back to Guides

🧠 Semantic Versioning (SemVer) – Complete Guide

Semantic Versioning is a versioning system that conveys meaning about the underlying changes in a release through its version number. It helps teams communicate changes, manage dependencies, and avoid unexpected breakages.


πŸ”’ Format: MAJOR.MINOR.PATCH

Each version number is made of three digits, for example:

1.4.2
Part Purpose Example
MAJOR Breaking changes 2.0.0
MINOR Backward-compatible feature additions 1.5.0
PATCH Backward-compatible bug fixes 1.5.3

🧭 When to Increment?

Scenario Example Before β†’ After
Breaking API contract 1.4.0 β†’ 2.0.0
Adding new backward-compatible features 1.4.0 β†’ 1.5.0
Fixing bugs or performance improvements 1.4.0 β†’ 1.4.1

πŸ“Œ Pre-release Tags and Build Metadata

You can add optional labels to denote pre-release or build metadata:

1.4.0-alpha.1
1.4.0-beta
1.4.0+build.123

Pre-releases are considered lower precedence than the associated final release.

πŸš€ What is a Release Candidate (RC)?

A Release Candidate is a version that is feature-complete and potentially ready to become a final release β€” unless significant bugs emerge. It signals the final stages of testing before the stable release.

πŸ”’ Format

RC versions use the pre-release syntax with a hyphen (-) followed by rc (short for "release candidate") and a number:

1.0.0-rc.1
1.0.0-rc.2

Each increment reflects an iteration toward stabilization.


πŸ“Š SemVer Precedence Rules

Pre-release versions have lower precedence than the associated final release:

Version Meaning
1.0.0-alpha.1 Early prototype version
1.0.0-beta.1 More stable than alpha, less than RC
1.0.0-rc.1 Release candidate
1.0.0 Final release

So:

1.0.0-alpha.1 < 1.0.0-beta.1 < 1.0.0-rc.1 < 1.0.0

βœ… When to Use Release Candidates


πŸ‘€ Best Practices


πŸ”— Example Workflow

  1. Release 1.0.0-alpha.1 β†’ internal development
  2. Release 1.0.0-beta.1 β†’ early user feedback
  3. Release 1.0.0-rc.1 β†’ bug fixes and performance stabilization
  4. Release 1.0.0 β†’ final stable version

🏷️ Version Tags in Package Managers

Tool RC Usage Example
npm npm install mylib@rc
pip pip install mylib==1.0.0rc1
Maven Use <version>1.0.0-RC1</version>
Cargo 1.0.0-rc.1 in Cargo.toml

πŸ” Why Semantic Versioning Matters


🚫 Common Mistakes to Avoid


πŸ“¦ SemVer in Package Managers


πŸ“˜ Best Practices


🧭 Summary Table

Action SemVer Change Backward Compatible?
Breaking API change MAJOR ❌ No
New feature (compatible) MINOR βœ… Yes
Bug fix or small patch PATCH βœ… Yes

πŸ”— Resources


<< back to Guides