https://github.com/edjcase/typescript_pds_ic
https://github.com/edjcase/typescript_pds_ic
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/edjcase/typescript_pds_ic
- Owner: edjCase
- License: mit
- Created: 2025-01-13T18:18:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-13T18:23:58.000Z (over 1 year ago)
- Last Synced: 2025-01-13T19:32:02.737Z (over 1 year ago)
- Language: TypeScript
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azle Hello World
- [Installation](#installation)
- [Deployment](#deployment)
Azle helps you to build secure decentralized/replicated servers in TypeScript or JavaScript on [ICP](https://internetcomputer.org/). The current replication factor is [13-40 times](https://dashboard.internetcomputer.org/subnets).
Please remember that Azle is in beta and thus it may have unknown security vulnerabilities due to the following:
- Azle is built with various software packages that have not yet reached maturity
- Azle does not yet have multiple independent security reviews/audits
- Azle does not yet have many live, successful, continuously operating applications deployed to ICP
## Installation
> Windows is only supported through a Linux virtual environment of some kind, such as [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)
You will need [Node.js 20](#nodejs-20) and [dfx](#dfx) to develop ICP applications with Azle:
### Node.js 20
It's recommended to use nvm to install Node.js 20:
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
```
Restart your terminal and then run:
```bash
nvm install 20
```
Check that the installation went smoothly by looking for clean output from the following command:
```bash
node --version
```
### dfx
Install the dfx command line tools for managing ICP applications:
```bash
DFX_VERSION=0.22.0 sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
```
Check that the installation went smoothly by looking for clean output from the following command:
```bash
dfx --version
```
## Deployment
To create and deploy a simple sample application called `hello_world`:
```bash
# create a new default project called hello_world
npx azle new hello_world --http-server --experimental
cd hello_world
```
```bash
# install all npm dependencies including azle
npm install
```
```bash
# start up a local ICP replica
dfx start --clean
```
In a separate terminal in the `hello_world` directory:
```bash
# deploy your canister
dfx deploy
```
If you would like your canister to autoreload on file changes:
```bash
AZLE_AUTORELOAD=true dfx deploy
```
View your frontend in a web browser at `http://[canisterId].raw.localhost:8000`.
To obtain your application's [canisterId]:
```bash
dfx canister id backend
```
Communicate with your canister using any HTTP client library, for example using `curl`:
```bash
curl http://[canisterId].raw.localhost:8000/db
curl -X POST -H "Content-Type: application/json" -d "{ \"hello\": \"world\" }" http://[canisterId].raw.localhost:8000/db/update
```