Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/interep-project/reputation-service

🚀 Interep back-end and front-end.
https://github.com/interep-project/reputation-service

badge interrep reputation reputation-badge semaphore zk-snarks

Last synced: about 1 month ago
JSON representation

🚀 Interep back-end and front-end.

Awesome Lists containing this project

README

        



Interep reputation service


Interep back-end and front-end.






GitHub Workflow Status


Coveralls


DeepScan grade


Linter eslint


Code style prettier

Repository top language




👥 Contributing

  |  

🤝 Code of conduct

  |  

🗣️ Chat & Support


Please, visit our [web app](https://kovan.interep.link) or our [documentation website](https://docs.interep.link) for more details.

---

## Code overview

This repository contains the frontend and backend code of the Interep application.

The backend code consists mainly of APIs, controllers and core functions. Next.js maps the application's [page](https://nextjs.org/docs/basic-features/pages) and [api routes](https://nextjs.org/docs/api-routes/introduction) to files in the `src/pages` directory. Each API is associated with a handler/controller in the `src/controllers` directory, which checks that the request parameters are correct. If these checks are passed and the request needs more complex logic, the core functions are used, otherwise the db methods are called directly.

The frontend consists of the pages defined in the `src/pages` directory. These pages are React components that in turn use the shared components in the `components` directory. The style of the Web application is defined in the `src/styles` directory, while `src/context` and `src/hooks` contain React contexts and hooks respectively.

The services in the `src/services` folder usually contain external services APIs, while the `src/tasks` folder contains tasks that run externally to Next.js. Finally, the `src/config.ts` file contains the environment variables and data about the Ethereum network and contracts.

The code is usually organized in modules (e.g. `src/core/groups`), where each function corresponds to a file with the same name, and an `index.ts` file exports all the functions of the module. Each module also contains an `index.test.ts` file where Jest tests are defined for each function in the module. Test files follow a standard structure for each module.

## Install

Clone this repository and install the dependencies:

```bash
git clone https://github.com/interep-project/reputation-service.git
cd reputation-service
yarn
```

## Usage

Copy the `.env.example` file and rename it `.env`.

All environment variables need to be provided. The format for the MongoDB URI is described [here](https://docs.mongodb.com/manual/reference/connection-string/).

### Running tests

```bash
yarn test
```

### Seeding

To seed the db you can run:

```bash
yarn db:seed-zero-hashes # required
```

If you want to reset the db you can run:

```bash
yarn db:reset # it will insert the zero hashes
```

### Running Interep (development)

```bash
yarn dev
```

The pages auto-update as you edit files.

To test all the features, you will need to deploy the Interep contracts in a [local network](https://github.com/interep-project/contracts/tree/main#preparing-a-local-network).

### Running Interep (production)

**NODE_ENV === 'production'**

**Build**

```bash
yarn build
```

**Start the server**

```bash
yarn start
```