The ultimate VS Code extension for NEAR Protocol Rust smart contract development - streamline your workflow with powerful tools for creating, building, testing, and deploying NEAR smart contracts.
- Features
- Installation
- Quick Start
- Integrated Sidebar
- Usage Guide
- Available Commands
- Project Structure
- Troubleshooting
- Roadmap
- Contributing
- License
- Support
- Rust-First Development: Optimized for Rust smart contracts using
cargo-nearand modern NEAR tooling - Instant Contract Creation: Create new contracts with automatic workspace and terminal switching
- One-Click Build & Deploy: Build and deploy contracts to testnet/mainnet with dropdown options
- Contract Testing: Run tests directly from the sidebar with integrated terminal support
- ABI Parsing & Contract Interface: Automatically parse deployed contract ABIs and interact with methods via UI
- Rich Code Snippets: Extensive Rust snippet library for common NEAR patterns (view/call methods, storage, cross-contract calls, testing)
- Create New Contract: One-click Rust contract creation with automatic directory selection
- Build & Deploy Dropdown:
- Random Account: Automatically create and deploy to a new random testnet account
- Select Account: Choose from your saved accounts for deployment
- Run Tests: Execute
cargo testwith a single click - Contract Interface: After deployment, view and call contract methods through an interactive UI
- Automatic detection of all NEAR contracts in your workspace
- Real-time build status tracking (β
Built /
β οΈ Not Built) - Contract type identification (π¦ Rust / π JavaScript/TypeScript)
- Click any contract to instantly switch to its directory
- File system watchers for auto-refresh on changes
- Create new NEAR accounts (mainnet/testnet)
- Quick testnet account creation with automatic faucet funding
- Import existing accounts with private keys or seed phrases
- Switch between multiple configured accounts
- View account balances
- Open accounts in NEAR Explorer
- Network selection (testnet/mainnet)
- Automatic Workspace Switching: Newly created contracts automatically become your active workspace
- Terminal Auto-Navigation: Terminal automatically
cds into new contract directories - Smart Dependency Checking: Automatically prompts to install missing tools (
cargo-near,near-cli-rs) - Command Palette Integration: All features accessible via VS Code Command Palette
- Context Menu Actions: Right-click file explorer integration for quick actions
- Task Integration: Built-in VS Code tasks for NEAR operations
Before using Near Studio, ensure you have the following installed:
- Node.js (v16 or higher) - Download
- Rust (latest stable) - Install via rustup
- cargo-near - NEAR's Rust contract build tool:
cargo install cargo-near
- near-cli-rs - Modern NEAR CLI (Rust version):
cargo install near-cli-rs
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Add WebAssembly target
rustup target add wasm32-unknown-unknown
# Install NEAR tooling
cargo install cargo-near
cargo install near-cli-rs- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X/Cmd+Shift+X) - Search for "Near Studio"
- Click Install
- Download the latest
.vsixfile from GitHub Releases - In VS Code, go to Extensions view (
Ctrl+Shift+X/Cmd+Shift+X) - Click the
...menu β "Install from VSIX..." - Select the downloaded
.vsixfile
git clone https://github.com/Festivemena/Near-Studio.git
cd Near-Studio
npm install
npm run compile
npm run package
# Install the generated .vsix file-
Open the NEAR Studio Sidebar
- Click the NEAR Studio icon in the Activity Bar (left sidebar)
- Or use Command Palette:
View: Show Near Studio
-
Create a New Contract
- Click "π Create New Contract" in the Project Explorer panel
- Enter your contract name (e.g.,
my-first-contract) - The extension will:
- Run
cargo near new <project-name> - Automatically open the new contract directory as your workspace
- Switch the terminal to the contract directory
- Run
-
Build and Deploy
- Click "π¨ Build & Deploy" dropdown
- Choose "Random Account" for quick testing (creates a new testnet account)
- Or choose "Select Account" to deploy to a saved account
-
Interact with Your Contract
- After deployment, click "Open Contract Interface"
- View and call contract methods through the interactive UI
- Or use the terminal for manual interactions
- Open the Account Manager panel in the sidebar
- Click the "+" button
- Choose:
- Quick Create Testnet Account - Instant testnet account with faucet funding
- Create New Account - Manual account creation
- Import Existing Account - Import via private key or seed phrase
The Project Explorer provides quick-access buttons for common development tasks:
- Opens a prompt for contract name
- Validates naming conventions (lowercase, numbers, hyphens, underscores)
- Checks for
cargo-nearinstallation (prompts to install if missing) - Runs
cargo near new <project-name> - Automatically opens the new contract directory
- Automatically switches terminal to the new directory
Two deployment options:
-
π² Random Account
- Generates a unique random account name
- Creates account on testnet with faucet funding
- Builds and deploys contract automatically
- Parses contract ABI and opens interactive interface
-
π Select Account
- Lists all saved accounts from Account Manager
- Shows account ID, network, and balance
- Deploys to selected account
- Parses contract ABI and opens interactive interface
- Executes
cargo testin the current workspace - Opens terminal to show test results
- Works with any Rust project containing tests
Automatically detects and manages NEAR contracts in your workspace:
- Real-time Detection: Watches for
Cargo.toml,package.json,asconfig.json - Build Status: Shows β
Built or
β οΈ Not Built based on compiled artifacts - Type Identification: π¦ Rust, π JavaScript, β‘ AssemblyScript
- Quick Navigation: Click any contract to switch workspace to that directory
- Auto-Refresh: File system watchers detect changes automatically
- Manual Refresh: π button to force refresh
Complete account lifecycle management:
- Quick Create Testnet Account: One-click testnet account with faucet
- Create New Account: Manual account creation with custom ID
- Import Existing Account: Import via private key or seed phrase
- Switch Account: Set active account for deployments
- View on Explorer: Opens account in NEAR Explorer (testnet/mainnet)
- Balance Display: Shows NEAR balance for each account
- Network Badge: Visual indicator for testnet/mainnet
1. Click "π Create New Contract"
2. Enter name: my-contract
3. Wait for cargo near new to complete
4. Workspace automatically opens to my-contract/
5. Terminal is ready at my-contract/ directory
1. Click "π¨ Build & Deploy" dropdown
2. Choose deployment method:
- Random Account: For quick testing
- Select Account: For specific account deployment
3. Contract builds and deploys automatically
4. Contract interface opens automatically
1. Click "π§ͺ Run Tests"
2. Terminal opens with cargo test output
3. View test results in real-time
After deployment:
- Click "Open Contract Interface" in the notification
- The Contract Interface webview opens showing:
- View Methods (read-only): Query contract state
- Call Methods (state-changing): Execute transactions
- Enter parameters as JSON
- Click View or Call to execute
- Results appear in terminal
- View All Contracts: Contract Manager shows all detected contracts
- Switch Between Contracts: Click any contract card to switch workspace
- Track Build Status: Quickly see which contracts are built
- Refresh Detection: Use π if new contracts aren't detected
All commands are accessible via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Description |
|---|---|
Near: Create New Rust Contract |
Create a new Rust smart contract |
Near: Build Contract |
Build the current contract with cargo near |
Near: Test Contract |
Run contract tests with cargo test |
Near: Deploy Contract (Existing Account) |
Deploy to an existing account |
Near: Deploy Contract (New Dev Account) |
Deploy to a new random dev account |
Near: Setup Rust Toolchain |
Install required Rust tools |
| Command | Description |
|---|---|
Near: Add Account |
Add a new account to the manager |
Near: Create New Account |
Create a new NEAR account |
Near: Quick Create Testnet Account |
Quick testnet account with faucet |
Near: Import Existing Account |
Import account with keys |
Near: Switch Account |
Change active account |
Near: View Account on Explorer |
Open account in NEAR Explorer |
Near Studio includes a comprehensive library of Rust snippets for rapid development:
near-contract- Complete contract structure with imports and basic setupnear-init- Contract initialization methodnear-default- Default implementation for contract
near-view- View method (read-only)near-call- Call method (state-changing)near-payable- Payable method (accepts NEAR tokens)near-private- Private method
near-storage-map- UnorderedMap storage collectionnear-storage-set- UnorderedSet storage collectionnear-storage-vec- Vector storage collectionnear-lazy-option- LazyOption for large data
near-cross-contract- Cross-contract call setupnear-promise- Promise chainingnear-callback- Callback method
near-test- Complete test module setupnear-test-context- Test context initializationnear-test-deposit- Test with attached deposit
Type near-view and press Tab to generate:
#[near_bindgen]
impl Contract {
pub fn method_name(&self) -> ReturnType {
// TODO: Implement view method
}
}When you create a new contract, cargo near new generates this structure:
my-contract/
βββ Cargo.toml # Rust package configuration
βββ rust-toolchain.toml # Rust toolchain specification (if applicable)
βββ src/
β βββ lib.rs # Main contract code
βββ tests/
β βββ test_basics.rs # Integration tests (if generated)
βββ target/
βββ near/
βββ my_contract.wasm # Compiled contract
βββ my_contract_abi.json # Contract ABI
Cargo.toml: Defines dependencies (near-sdk-rs, etc.)src/lib.rs: Your smart contract implementationtarget/near/: Build outputs created bycargo near build
Problem: Rust is not installed or not in PATH
Solution:
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Add to PATH (Linux/Mac)
source $HOME/.cargo/env
# Restart VS Code after installationProblem: cargo-near is not installed
Solution:
cargo install cargo-near
# Restart terminal/VS CodeProblem: near-cli-rs is not installed
Solution:
cargo install near-cli-rs
# Restart terminal/VS CodeProblem: Extension not detecting contracts
Solutions:
- Click the π Refresh button in Contract Manager
- Ensure your project has
Cargo.toml(Rust) orpackage.json(JS/TS) - Check that
Cargo.tomlincludesnear-sdkdependency - Try closing and reopening VS Code
- Check Output panel: View β Output β "NEAR Studio" for errors
Problem: WebAssembly target not installed
Solution:
rustup target add wasm32-unknown-unknownProblem: Various deployment issues
Solutions:
- Ensure contract is built: Check
target/near/directory exists - Verify account has sufficient balance (testnet: use faucet)
- Check network connectivity
- Verify account credentials are correct
- Review terminal output for specific error messages
Problem: New contract directory not opening
Solutions:
- Wait 2-5 seconds for directory creation
- Check terminal for errors during
cargo near new - Manually open the contract folder if needed
- Ensure you have write permissions in the workspace directory
Problem: Contract ABI file not generated
Solutions:
- Ensure contract was built with
cargo near build - Check
target/near/*.jsonfile exists - Rebuild contract and redeploy
- Ensure contract uses
#[near_bindgen]macro
# Fast syntax checking (no compilation)
cargo check
# Run tests
cargo test
# Build contract
cargo near build
# Deploy to testnet
cargo near deploy --account-id your-account.testnet# Verbose build output
RUST_BACKTRACE=1 cargo near build
# Clean and rebuild
cargo clean
cargo near build- Minimize storage reads/writes
- Use efficient data structures (
UnorderedMap,Vector) - Avoid unnecessary String allocations
- Batch operations when possible
- Test gas usage with
cargo test
- Use Code Snippets: Type
near-and press Tab for quick scaffolding - Keep Terminal Open: Reduces context switching
- Use Contract Manager: Quick navigation between multiple contracts
- Leverage Auto-Refresh: File watchers detect changes automatically
- Integrated sidebar panel with Project Explorer, Contract Manager, and Account Manager
- Real-time contract detection with file system watchers
- Contract build status tracking (built vs. not built)
- Automatic workspace switching for new contracts
- Terminal auto-navigation to contract directories
- Build & Deploy dropdown with random and select account options
- Contract ABI parsing and interactive interface
- Account management with testnet faucet integration
- Comprehensive Rust snippet library
- Context menu integration
We welcome contributions from the community! Here's how you can help:
- Report Bugs: Open an issue with details
- Request Features: Share your ideas in GitHub Discussions
- Submit Pull Requests: Fork, branch, and submit PRs for review
- Improve Documentation: Help us make docs clearer
- Share Feedback: Tell us what works and what doesn't
# Clone the repository
git clone https://github.com/Festivemena/Near-Studio.git
cd Near-Studio
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes (development)
npm run watch
# Package extension
npm run package- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes
- Test thoroughly
- Commit with clear messages:
git commit -m "Add: feature description" - Push to your fork:
git push origin feature/my-feature - Open a Pull Request with a detailed description
- Follow existing TypeScript conventions
- Add comments for complex logic
- Update README.md if adding features
- Test on Windows, Mac, and Linux if possible
MIT License - see LICENSE file for details.
Copyright (c) 2025 Festivemena
- NEAR Docs: https://docs.near.org/
- near-sdk-rs: https://docs.rs/near-sdk/
- cargo-near: https://github.com/near/cargo-near
- GitHub Issues: Report bugs or request features
- GitHub Discussions: Ask questions and share ideas
- NEAR Discord: https://discord.gg/nearprotocol
- GitHub Releases: Watch for updates
- Star the repo: Show your support and stay notified
- Added automatic workspace switching for new contracts
- Added terminal auto-navigation to contract directories
- Improved contract creation workflow
- Enhanced build and deploy features
- Stable release with contract testing support
- Added build and deploy to random account feature
- Project Explorer enhancements
- Rust-focused release
- Major improvements to cargo-near integration
- Enhanced sidebar panels
- Initial stable build
- Basic contract management features
Install Near Studio and experience the best NEAR smart contract development workflow in VS Code!
Install from Marketplace | View on GitHub | Report Issue
Made with β€οΈ by Festivemena and contributors
Star β the repo if you find it helpful!
