npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

jstellar

v1.0.7

Published

![alt text](main-logo.svg)

Readme

alt text

Stellar Soroban TypeScript License Network

Stellar Smart Contract Development with JavaScript/TypeScript

This project enables you to develop Stellar (Soroban) smart contracts quickly and easily using JavaScript/TypeScript. Instead of writing Rust, you can create Soroban contracts using familiar JavaScript syntax and decorators.

Purpose

Traditional Soroban contract development requires Rust knowledge. This tool allows JavaScript/TypeScript developers to:

  • Simplify storage operations with decorators
  • Define type-safe structs
  • Rapidly prototype contracts
  • Write contracts with familiar syntax

Getting Started

# Install dependencies
npm install jstellar
npx stellar build --path {YOUR_PATH_YOU_CAN_FIND_EXAMPLES_IN_THE_GITHUB_REPOSITORY}

Features

  • Storage Decorators: Easy storage management with @Storage, @GetString, @GetNumber
  • Struct Support: Complex data structures with @Struct, @GetStruct, @Field
  • Type Safety: Type safety with TypeScript support
  • Automatic Rust Conversion: Your JavaScript code is automatically converted to Rust

Tsconfig Sample

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "ts-node": {
    "transpileOnly": true,
    "compilerOptions": {
      "module": "commonjs"
    }
  }
}

Examples

Example 1: Basic Storage Operations (examples/hello.contract.ts)

import { GetNumber, GetString, Storage } from "../lib/stellar-js-decorator"

class TestWord {
    MY_NUMBER = 17
    MY_NAME = 'john doe'

    // Simple functions
    hello_number(){
        return 17
    }

    get_number(num: number){
        return num
    }

    get_name(){
        return this.MY_NAME
    }

    // Write to storage
    @Storage('name', 'akif')
    set_name(){}

    @Storage('my_num', 17)
    set_num(){}

    // Read from storage
    @GetString('name')
    get_stor_name(){}

    @GetNumber('my_num')
    get_num_stor(){}
}

export default TestWord

Features:

  • @Storage(key, value): Save value to contract storage
  • @GetString(key): Read string from storage
  • @GetNumber(key): Read number from storage
  • Class variables and methods automatically convert to contract functions

Example 2: Struct Operations (examples/hello2.contract.ts)

import { Field, GetStruct, Struct } from "../lib/stellar-js-decorator"

class Hello2Con {
    USER = {
        name: '',
        lastname: '',
        city: ''
    }

    TEAM = {
        name: '',
        foundation: ''
    }

    // Save struct to storage
    @Struct('strucuser', {name: 'akifcan', lastname: 'kara', city: 'izmir'})
    @Field('USER')
    set_struct(){}

    // Read struct from storage
    @GetStruct('strucuser')
    @Field('USER')
    get_struct_by_name(){}
}

export default Hello2Con

Features:

  • @Struct(key, value): Save complex objects to storage
  • @GetStruct(key): Read struct from storage
  • @Field(fieldName): Specify which class variable to use
  • Nested objects automatically convert to Rust structs

How It Works

  1. Write in JavaScript/TypeScript: Write your contract with familiar syntax
  2. Mark with Decorators: Use decorators for storage and struct operations
  3. Automatic Rust Conversion: Code is automatically converted to Soroban-compatible Rust
  4. Deploy and Invoke: Deploy and invoke using standard Stellar CLI

JavaScript to Rust Compilation Example

Here's how the JavaScript code from Example 2 compiles to Rust:

JavaScript Input (examples/hello2.contract.ts):

import { Field, GetStruct, Struct } from "../lib/stellar-js-decorator"

class Hello2Con {
    USER = {
        name: '',
        lastname: '',
        city: ''
    }

    TEAM = {
        name: '',
        foundation: ''
    }

    @Struct('strucuser', {name: 'akifcan', lastname: 'kara', city: 'izmir'})
    @Field('USER')
    set_struct(){}

    @GetStruct('strucuser')
    @Field('USER')
    get_struct_by_name(){}
}

export default Hello2Con

Compiled Rust Output:

#![no_std]
use soroban_sdk::{contract, contractimpl, contracttype, symbol_short, vec, Env, String, Vec};

#[contract]
pub struct Hello2Con;

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct USER {
    pub name: String,
    pub lastname: String,
    pub city: String
}

#[contracttype]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct TEAM {
    pub name: String,
    pub foundation: String
}

#[contractimpl]
impl Hello2Con {
    pub fn set_struct(env: Env) {
        let key = symbol_short!("strucuser");
        let ss = USER {
            name: String::from_str(&env, "akifcan"),
            lastname: String::from_str(&env, "kara"),
            city: String::from_str(&env, "izmir"),
        };
        env.storage().instance().set(&key, &ss);
    }

    pub fn get_struct_by_name(env: Env) -> USER {
        let key = symbol_short!("strucuser");
        env.storage().instance().get(&key).unwrap()
    }
}

What happens during compilation:

  • JavaScript class → Rust #[contract] struct
  • Object definitions → Rust #[contracttype] structs with proper derives
  • @Struct decorator → Storage write operation with struct initialization
  • @GetStruct decorator → Storage read operation with type-safe return
  • @Field decorator → Maps to the corresponding Rust struct type
  • All Soroban SDK imports and boilerplate are automatically generated

Deploying the Contract

stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/hello.wasm \
  --source-account akif \
  --network testnet

Invoking the Contract

# Simple function call
stellar contract invoke \
  --id CONTRACT_ID \
  --source-account akif \
  --network testnet \
  -- \
  get_number \
  --num 42

# Write to storage (--send=yes required)
stellar contract invoke \
  --id CONTRACT_ID \
  --source-account akif \
  --network testnet \
  --send=yes \
  -- \
  set_name

# Read from storage
stellar contract invoke \
  --id CONTRACT_ID \
  --source-account akif \
  --network testnet \
  -- \
  get_stor_name

Advantages

  • Rapid Development: Write contracts without learning Rust
  • Less Code: Decorators reduce boilerplate code
  • Type Safety: Catch errors with TypeScript
  • Easy Debugging: Use JavaScript tooling and debugging
  • Stellar/Soroban Compatible: Full Soroban features support

Requirements

  • Node.js
  • TypeScript
  • Stellar CLI
  • Rust and Soroban SDK (for building)

Note: This tool is designed to help JavaScript developers quickly start working in the Stellar ecosystem. Thorough testing is recommended before using in production.

alt text

Stellar Soroban TypeScript License Network