Skip to content

Backend REST API for Harvest, a Tractor statistics tool

License

Notifications You must be signed in to change notification settings

ArtFXDev/harvest-api

Repository files navigation

Harvest API 👨‍🌾👩‍🌾🌾


Introduction

Harvest is a realtime front-end application to display useful statistics for the Tractor render farm.

This is the backend API repository that the front-end uses.

It uses Prisma which is a TypeScript ORM for interacting with a PostgreSQL database. Then Express is used to build the REST API.

Installation

The package manager used is Yarn. Clone the repository and install the dependencies:

$ git clone https://github.com/ArtFXDev/harvest-api
$ cd harvest-api
$ yarn install # Install the dependencies

Usage

Environment variables

Before starting the API, make sure the variables defined in the .env file are correct. To see which one are needed, please see the .env.example file in the root of the repository.

They are:

  • TRACTOR_URL - the url of the running Tractor API instance. Usually the hostname is tractor so it will be http://tractor/Tractor

  • TRACTOR_LOGIN / TRACTOR_PASSWORD - the user and password of the Tractor account (you need to enable account based auth in the configuration)

  • HARVEST_DB_USER / HARVEST_DB_PASSWORD - the user and password of the Postgres database

Available scripts

  • 🚀 yarn dev -> will start a nodemon process to automatically reload the code on changes

    You can then access the api on http://localhost:3000.

  • 👷 yarn prod -> launches the API in production mode without hot-reload

  • 🔨 yarn tsc -> runs the TypeScript compiler and report errors. Add :watch to run an interactive process that watches file changes.

  • 💅 yarn prettify -> prettify the code with Prettier. Add :write to write the modifications.

  • 🚨 yarn lint -> shows ESLint warnings and errors. Add :fix to apply auto fixes.

Libraries

Here are the main libraries and packages used:

Library Version
Express 4.17.2
TypeScript 4.5.5
Prisma 3.8.1

Contributing

Pull requests and issues are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT @ArtFX