Skip to content

serendipity-seeker/qearn-api

Repository files navigation

Qearn API

This is the API for the Qearn Dapp and transaction indexer of Qearn Smart Contract. It is built using Axum, PostgreSQL, Prisma Rust.

Getting Started

To begin with this project:

Prisma

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 generate

To push db schema to database, you can use the following command:

$ cargo prisma db push

Run Postgres

The 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

Configure the Application

$ cp .env.sample .env

Starting the Application

With everything else set up, all you need to do now is:

$ cargo run

About

Qearn Smart Contract transaction indxer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published