Web3 libraries provide access to helper methods that allow you to interact with the blockchain via a Web3 provider such as Infura (or your own node).
The Web3 libraries enable you to build frontends that can communicate with the blockchain (including smart contracts deployed on the blockchain).
Web3 libraries are available for various blockchains, for example, Matic.js for the Polygon network. This topic focuses on the Ethereum network, but the fundamentals are the same for other blockchains.
The following image shows how a Web3 library can connect to your node (in this example Infura) to communicate with the blockchain.
Some popular Ethereum compatible Web3 libraries include (but are not limited to) the following.
|ethers-js (recommended), Rust-web3
|Ethereum Ruby library
Refer to the Ethereum instructions for information on how to access the blockchain using some of these libraries.
Web3.js vs. Ethers.js
Refer to this Web3.js vs. Ethers.js article which highlights the differences between the libraries to help you decide which library to use.