Below is an example with node.js and typescript:

  1. Install polkadot/api npm package (https://www.npmjs.com/package/@polkadot/api).
  2. Initialise api
const provider = new WsProvider("wss://rpc.mainnet.cere.network/ws");
const api = await ApiPromise.create({ provider });
await api.isReady;
  1. Get the highest block number and log it.
const blockNumber = await api.derive.chain.bestNumber()
console.log(blockNumber)