# Connect a client · Chromia Docs (concept)

> This section covers how to connect a frontend or other client to a dapp backend deployed on a Chromia network.

Source: https://docs.chromia.com/build/deployment/testnet/connect-client/

# Connect a client

This section covers how to connect a frontend or other client to a dapp backend deployed on a Chromia network. The
examples here use the TypeScript-based [`postchain-client`](https://www.npmjs.com/package/postchain-client), but the
principles are the same when using other client libraries.

To connect to a deployed dapp, the client library needs a pool of URLs to system nodes in the Chromia network, as well
as the Blockchain RID of the dapp to connect to. The client automatically queries the
[Directory chain](https://docs.chromia.com/get-started/about/architecture/) on the system nodes to fetch the URLs of all nodes where your dapp is
currently running, thus establishing a connection to the dapp.

info

To check if the dapp is deployed successfully - visit the [Chromia Explorer](https://explorer.chromia.com) and
set **Current network** to **Testnet**.

**Deployed dapp will be accessible in about five minutes.**

1. Ensure you have a dapp deployed on a Chromia network. This will most likely be **Testnet**. For deployment
   instructions, see [Deploy your dapp to testnet](https://docs.chromia.com/build/deployment/testnet/deploy-dapp/).
2. If you are deploying a frontend created using the [Hello World guide](https://docs.chromia.com/get-started/create-dapp/run-dapp-cli/),
   remove the admin key pair configuration and replace it with a secure link to your stored key pair. This ensures the
   security of your key pair. For more details on how to build a production-ready dapp, visit the
   [Chromia course page](https://chromia.com/learn/).

   TypeScript

   ```
   // Remove any private keys from your production client code
   const adminPubkey = Buffer.from("<PubkeyLink>", "hex");
   const adminPrivkey = Buffer.from("<PrivkeyLink>", "hex");
   ```
3. Establish a connection to your dapp by providing the Blockchain RID and a node pool from Testnet:

   TypeScript

   ```
   // Connection input
   const blockchainRID = "<BlockchainRID>"; // Target Blockchain RID
   const directoryNodeUrlPool = [
     "https://node0.testnet.chromia.com:7740",
     "https://node1.testnet.chromia.com:7740",
     "https://node2.testnet.chromia.com:7740",
     "https://node3.testnet.chromia.com:7740",
   ]; // Target URLs

   // Connection setup
   const chromiaClient = await pcl.createClient({
     blockchainRID,
     directoryNodeUrlPool,
   });
   ```

   Replace `<BlockchainRID>` with the actual blockchain RID for your dapp.

With these steps, you have successfully configured `postchain-client` to work with your dapp backend running on the
Chromia network.

To learn more about developing production-ready dapps, visit the [Chromia course page](https://chromia.com/learn/).

[View this page on docs.chromia.com](https://docs.chromia.com/build/deployment/testnet/connect-client/)Content mirrored from the live docs
