---
title: Connecting to a Solana Environment
description: "Learn how to connect to a Solana environment."
---

To develop on Solana, you first need to connect to a Solana cluster.

| Cluster   | RPC Endpoint                     |
| --------- | -------------------------------- |
| mainnet   | `https://api.mainnet.solana.com` |
| devnet    | `https://api.devnet.solana.com`  |
| testnet   | `https://api.testnet.solana.com` |
| localhost | `http://localhost:8899`          |

## Connect using RPC URL

Connect to a specific RPC endpoint:

<CodeTabs storage="cookbook">

```ts !! title="Kit" file=packages/docs-examples/cookbook/development/connect-environment/kit.ts#region=rpc-url

```

```ts !! title="Legacy" file=packages/docs-examples/cookbook/development/connect-environment/legacy.ts#region=rpc-url

```

```rust !! title="Rust" file=packages/docs-examples/cookbook/development/connect-environment/rust/src/main.rs#region=rpc-url

```

```py !! title="Python"
import asyncio
from solana.rpc.async_api import AsyncClient

async def main():
    async with AsyncClient("http://localhost:8899") as client:
        res = await client.is_connected()
    print(res)  # True

asyncio.run(main())
```

</CodeTabs>

## Connect using the network moniker

You can also connect to a public RPC endpoint by specifying its network name
(moniker):

```ts !! title="Legacy" file=packages/docs-examples/cookbook/development/connect-environment/legacy-moniker.ts#region=moniker

```
