A web-based Integrated Development Environment (IDE) for writing, compiling, and testing Rust smart contracts for the Stellar blockchain using the stellar-cli
tool. The application provides a secure, modular, and high-quality platform for developers to build and test Stellar smart contracts without deployment or interaction capabilities.
- Overview
- Features
- Architecture
- Project Structure
- Technologies
- Setup Instructions
- Development Workflow
- Security Considerations
- Contributing
- License
Stellar IDE is designed to streamline the development of Rust-based smart contracts for Stellarβs Soroban platform. It offers a web interface for editing Rust code, compiling it to WebAssembly (WASM), and running unit tests, all powered by stellar-cli
. The IDE emphasizes code quality, modularity, and security, making it a robust tool for developers.
- Provide a user-friendly editor for Rust smart contracts.
- Enable secure compilation and testing of contracts.
- Maintain a modular and scalable codebase.
- Ensure high security standards to protect against vulnerabilities.
Feature | Description |
---|---|
Code Editing | Monaco Editor with Rust syntax highlighting and autocompletion. |
Compilation | Compiles Rust code to WASM using cargo build and stellar contract build . |
Testing | Runs unit tests with cargo test and displays results. |
Security | Sanitizes inputs, uses isolated processes, and enforces timeouts. |
Modularity | Separated frontend and backend with reusable components. |
The application follows a client-server architecture:
graph TD
A[User Browser] -->|HTTP| B[Frontend: Angular]
B -->|REST API| C[Backend: Node.js/Express]
C -->|Shell Commands| D[Rust Compiler]
C -->|Shell Commands| E[Stellar CLI]
D -->|Generates| F[WASM File]
E -->|Optimizes| F
- Frontend: Angular with Monaco Editor for code editing and result display.
- Backend: Node.js with Express.js for handling compilation and testing requests.
- Rust Compiler: Executes
cargo build
andcargo test
. - Stellar CLI: Runs
stellar contract build
for WASM optimization.
Online-Soroban-Compiler/
βββ .github/
β βββ workflows/
β βββ angular-ci.yml
β βββ backend-ci.yml
βββ apps/
β βββ frontend/
β β βββ src/
β β β βββ app/
β β β β βββ components/
β β β β β βββ editor/
β β β β β βββ output/
β β β β βββ services/
β β β βββ assets/
β β βββ angular.json
β β βββ package.json
β βββ backend/
β β βββ src/
β β β βββ controllers/
β β β βββ utils/
β β β βββ index.ts
β β βββ tsconfig.json
β β βββ package.json
βββ docs/
β βββ prd/
β β βββ PRD.md
βββ README.md
βββ LICENSE
Component | Technology | Version |
---|---|---|
Frontend | Angular | Latest |
Frontend | Monaco Editor | Latest |
Frontend | Tailwind CSS | Latest |
Frontend | TypeScript | Latest |
Backend | Node.js | 20.x |
Backend | Express.js | Latest |
Backend | TypeScript | Latest |
Package Manager | Bun | Latest |
Compiler | Rust | Latest |
CLI Tool | Stellar CLI | Latest |
- Rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- WASM Target:
rustup target add wasm32-unknown-unknown
- Stellar CLI:
cargo install --locked stellar-cli
- Bun:
curl -fsSL https://bun.sh/install | bash
cd apps/frontend
bun install
bun x ng serve
cd apps/backend
bun install
bun run src/index.ts
Open http://localhost:4200
in your browser.
-
Fork the repository.
-
Clone the Repository:
git clone https://github.com/ScaffoldRust/Online-Soroban-Compiler.git
Note: Replace
ScaffoldRust
with your GitHub username.
-
Install Dependencies: Use Bun as described above.
-
Run Tests:
- Frontend:
bun x ng test
- Backend:
bun test
- Frontend:
-
GitHub Actions: A CI workflow ensures code quality (see
.github/workflows/ci.yml
). -
Commit Guidelines: Follow conventional commits (e.g.,
feat: add editor component
).
- Input Sanitization: Uses
sanitize-filename
for directory names. - Command Safety: Employs
child_process.spawn
to prevent command injection. - Timeouts: Limits command execution to 30 seconds.
- CORS: Restricted to
http://localhost:4200
. - Directory Cleanup: Removes temporary directories after use.
- Helmet: Protects Express.js against common vulnerabilities.
Contributions are welcome! Please follow:
- Fork the repository.
- Create a feature branch (
git checkout -b feat/your-feature
). - Commit changes using conventional commits.
- Open a pull request with a detailed description.
See the issues on OnlyDust platform: https://www.onlydust.com/repositories/ScaffoldRust/Online-Soroban-Compiler
MIT License. See LICENSE for details.