How To Deploy a Feedback API on Aleph Cloud Using Aleph CLI

by IleolamiMay 8th, 2025
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Aleph Cloud is a Web3 Supercloud that provides infrastructure for decentralised storage, computing, and AI. It provides serverless computing, decentralised storage, and secure message routing without relying on traditional centralised servers. In this article, you will learn how to deploy an API on Aleph Cloud using Aleph CLI.

People Mentioned

Mention Thumbnail
Mention Thumbnail

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - How To Deploy a Feedback API on Aleph Cloud Using Aleph CLI
Ileolami HackerNoon profile picture
0-item
1-item

Aleph Cloud is a Web3 Supercloud that provides infrastructure for decentralised storage, computing, and AI. It provides serverless computing, decentralised storage, and secure message routing without relying on traditional centralised servers. It also provides a blockchain indexing framework, allowing developers to index data from any blockchain network by leveraging the Aleph network's decentralised storage and compute capabilities.


Now let’s get our hands dirty. In this article, you will learn how to deploy an API on Aleph Cloud using Aleph CLI.

Prerequiste

  1. Knowledge of Python
  2. Must have installed Python and PIP on your local machine. You can check the version of your Python or pip, use the following commands:
python3 --version //check python version

pip3 --version //check pip version

pip3 install --upgrade pip //to upgrade pip
  1. At least 500 Aleph in your Ethereum or Solana wallet
  2. A Code editor, e.g VS Code
  3. A folder for your project with a directory structure like this:my-project/ │ ├── app/ │ └── main.py


Let’s dive in

Set Up the Project

  1. Install virtualenv using this command:
pip3 install virtualenv

2. Create a virtual environment using this command:

python3 -m virtualenv venv

3. Activate the virtual environment:

source venv/bin/activate
  1. Install all the following packages:
pip3 install fastapi uvicorn aleph-client

Creating the Feedback API

In your main.py, copy and paste the following code:

from fastapi import FastAPI, Request
from pydantic import BaseModel

app = FastAPI()

# In-memory feedback storage
feedback_store = []

class Feedback(BaseModel):
    dapp: str
    feedback: str

@app.get("/")
async def root():
    return {"message": "Hello World"}

@app.get("/feedback")
async def get_feedback():
    return feedback_store

@app.post("/feedback")
async def submit_feedback(item: Feedback):
    feedback_store.append(item.dict())
    return {"message": "Feedback received"}

Test Locally

  1. Run the server:
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
  1. Then test:
curl -X POST http://localhost:8000/feedback -H "Content-Type: application/json" -d '{"dapp": "MyCoolDapp", "feedback": "Love the UI!"}'


You should see the result here:

This shows that your API is working perfectly

Deploy to Aleph Cloud

You have to create an Aleph CLI account with your private key by following this process:


  1. Create a new account using this command:
aleph account create --private-key TEXT
  1. Enter your private key
  2. Select the chain of your private key

To deploy the project:

  1. Compress your main.py file into a .zip file
  2. Upload the file using this command:
aleph program upload app/main.py.zip main:app
  1. Select the tier of the program you are going for and accept runtime reference

choose based on the amount of tokens you’ve and the project’s needs

  1. Enter the name of your application
  2. Since our project doesn’t require any volume and uses an environment variable n
Preset to default chain: SOL
╭─ Pricing: Program ───────────────────────────────────────────────────────────────────────────────╮
│        ╷               ╷       ╷           ╷            ╷                  ╷                     │
│   Tier │ Compute Units │ vCPUs │ RAM (GiB) │ Disk (GiB) │ $ALEPH (Holding) │ + Internet Access   │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   1    │ 1             │ 1     │ 2         │ 2          │    200 tokens    │    400 tokens       │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   2    │ 2             │ 2     │ 4         │ 4          │    400 tokens    │    800 tokens       │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   3    │ 4             │ 4     │ 8         │ 8          │    800 tokens    │    1600 tokens      │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   4    │ 6             │ 6     │ 12        │ 12         │   1200 tokens    │    2400 tokens      │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   5    │ 8             │ 8     │ 16        │ 16         │   1600 tokens    │    3200 tokens      │
│ ╶──────┼───────────────┼───────┼───────────┼────────────┼──────────────────┼───────────────────╴ │
│   6    │ 12            │ 12    │ 24        │ 24         │   2400 tokens    │    4800 tokens      │
│        ╵               ╵       ╵           ╵            ╵                  ╵                     │
│ Extra Volume Cost: 51.2 token/GiB (Holding) -or- 0.02401 token/GiB/day (Pay-As-You-Go)           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Select a tier by index: 1
Program name: Feedback API
Ref of runtime? [63f07193e6ee9d207b7d1fcf8286f9aee34e6f12f101d2ec77c1229f92964696] 
Add volume? [y/n] (n): n
Add environment variable? [y/n] (n): n


After successfully deploying your project, you will receive a notification that your application has been deployed, including your API URL, like this:


╭─ Program Created ────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Your program 7067be26978fd4a78fe106a7b428c576195597b7e224f6863bf8f5b57843afa1 has been uploaded on aleph.im.         │
│                                                                                                                      │
│ Available on:                                                                                                        │
│ ↳ https://aleph.sh/vm/7067be26978fd4a78fe106a7b428c576195597b7e224f6863bf8f5b57843afa1                               │
│ ↳ https://obt34juxr7kkpd7ba2t3ikgfoymvlf5x4ispnbr37d23k6cdv6qq.aleph.sh                                              │
│                                                                                                                      │
│ Visualise on:                                                                                                        │
│ https://explorer.aleph.im/address/SOL/CsnKR2rR5nykvJ3GX2VFptiim6Bbg9b3Zz1uo5VDdvTm/message/PROGRAM/7067be26978fd4a78 │
│ fe106a7b428c576195597b7e224f6863bf8f5b57843afa1


Congratulations, you’ve just successfully deployed your API to Aleph cloud 🎉

You can add this feedback API to your dApp to get user feedback.

Conclusion

Aleph Cloud makes deployment easy for developers with its CLI and web console.


You can do much more with Aleph Cloud, such as:

  1. Host your AI models as an instance.
  2. Host your frontend code using the web hosting service.


And much more.


You can explore Aleph doc or join the Aleph developers' community on Discord or Telegram.

Trending Topics

blockchaincryptocurrencyhackernoon-top-storyprogrammingsoftware-developmenttechnologystartuphackernoon-booksBitcoinbooks