> ## Documentation Index
> Fetch the complete documentation index at: https://swig-tracy-multiple-subaccounts-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 0. Environment Setup

> "One man spends and hour cutting wood, another sharpens his axe for 50 minutes and chops wood for 10 minutes" - Somebody

Before you begin writing Swig-powered apps—like wallets, token transfers, or Telegram integrations—you need to set up your development environment to support real blockchain interactions using the Swig SDK.

This setup follows the official Swig TypeScript SDK and prepares you to build and run your own scripts inside the example workspace. You'll be writing new files in the same folder as the examples so you can easily compare your code to working references.

## Prerequisites

Before starting, make sure you have the following installed:

### Option A: Node.js + Yarn

* Node.js v16 or newer
* Yarn v3+

### Option B (Preferred): Bun

Bun provides better performance and a simpler setup. Install it with:

```bash theme={null}
curl -fsSL https://bun.sh/install | bash
```

### Required Tools

Additionally, you'll need:

* Solana CLI
* Rust + Cargo

## Step 1: Clone and Install

First, clone the examples repository and install dependencies:

```bash theme={null}
# Clone the repository
git clone https://github.com/anagrambuild/swig-ts.git

# Enter the project directory
cd swig-ts

# Install dependencies
bun install
```

## Step 2: Navigate to Examples

Move into the examples directory where you'll write your code:

<Tabs>
  <Tab title="Classic">
    ```bash theme={null}
    cd examples/classic/transfer mkdir tutorial 
    ```
  </Tab>

  <Tab title="Kit">
    ```bash theme={null}
    cd examples/kit/transfer mkdir tutorial 
    ```
  </Tab>
</Tabs>

This location is important because it:

* Provides access to working examples (`transfer-local.ts`, `mint.ts`, etc.)
* Uses shared tooling without extra configuration
* Allows side-by-side comparison with official samples

## Step 3: Start the Validator

Start a local Solana testnet for development:

```bash theme={null}
bun start-validator
```

This command:

* Spins up a local Solana testnet
* Installs Swig programs into the testnet
* Creates a safe, reproducible environment for testing

> 💡 Keep the validator running in a separate terminal window. You only need to start it once per development session.

## Verifying Your Setup

To verify everything is working:

1. Check the validator:

```bash theme={null}
solana config get
```

You should see the local network configuration.

## Common Issues

### Validator Won't Start

If the validator fails to start:

1. Check if another validator is running:

```bash theme={null}
ps aux | grep solana-test-validator
```

2. Kill any existing processes:

```bash theme={null}
pkill solana-test-validator
```

### Installation Problems

If you encounter installation issues:

1. Clear your package cache:

```bash theme={null}
bun cache clean
```

2. Remove and reinstall dependencies:

```bash theme={null}
rm -rf node_modules
bun install
```

### Port Conflicts

If you see port conflicts:

1. Check which process is using the port:

```bash theme={null}
lsof -i :8899
```

2. Either kill the process or configure a different port in your settings.

## Development Tools

We recommend the following tools for the best development experience:

### Code Editor

* VS Code with extensions:
  * TypeScript and JavaScript Language Features
  * Solidity
  * Rust

### Browser Extensions

* Swig Wallet Extension (Coming Soon)
* Phantom Wallet
* Solflare Wallet

### Command Line Tools

* `solana-cli` for blockchain interaction
* `cargo` for Rust development
* `bun` for running TypeScript files
