This is the API for the Qearn Dapp and transaction indexer of Qearn Smart Contract. It is built using Axum, PostgreSQL, Prisma Rust.
To begin with this project:
This project uses Prisma to generate the database client. To use prisma in rust, it is necessary to install the prisma-client-rust-cli package. But new version of prisma-client-rust-cli does not support global installation(cargo install prisma-client-rust-cli). So we need to install it in the project directory.
Refer this docs for more details.
This project already added alias for prisma in .cargo/config.toml. So you can use prisma command to run prisma-cli.
$ cargo prisma generate(if you installed prisma-client-rust-cli globally, you can use prisma-cli command to run prisma-cli)
$ prisma-cli generateTo push db schema to database, you can use the following command:
$ cargo prisma db pushThe most straightforward way to run Postgres is by using a container with a pre-built image. The command below will start latest version of Postgres using Docker:
$ docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=password postgres$ cp .env.sample .envWith everything else set up, all you need to do now is:
$ cargo run