Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 3.75 KB

README.md

File metadata and controls

102 lines (71 loc) · 3.75 KB

API Give

API Give is a project that provide open API for third parties to can work with https://giveth.io (https://github.com/Giveth/impact-graph)

Used Technologies

Installation

Test

Logs

Migrations

Architecture

You want to use our API right now?

References

Used_Technologies

  • Nodejs v16
  • Typescript v4.5.2
  • DB: postgres v14.2
  • DB ORM: TypeORM v0.3.6
  • Redis v5.0.9
  • API protocol : REST
  • Web application: Express v4.17.3
  • Deployment: docker-compose v3.3
  • API Documentation: Swagger
  • Test framework: Mocha v9.2.2
  • CI/CD tools : GitHub Actions

Installation and Run

  • git clone [email protected]:Giveth/apiGive.git
  • cd apiGive
  • npm ci
  • Bringing up database, you can install that in other way, but I suggest using docker docker-compose -f docker-compose-local-postgres-redis.ym up -d
  • Creat a file named development.env based on Env example file and put it in ./config
  • Run Migrations
  • npm start
  • Now you can browse Swagger
  • If you ran migrations successfully then you are able to login in Admin panel username: [email protected] password: 12345

Test

You should have a postgress instance up in order to running tests so you can use Local DB docker-compose

  • npm run test

Logs

In localhost and test we put logs in console and file but in production and staging we just use file for writing logs You can see logs beautifully with this command

  • npm i -g bunyan
  • tail -f logs/apiGive.log | bunyan

Migrations

Create new Migration file

typeorm migration:create ./migrations/createAccessTokenTable

Then you need to run the migrations like so

npm run db:migrate:run:local

If you want to revert last migration

npm run db:migrate:revert:local

Architecture

You can see Entities Diagram to get insight about entities

Staging_Guide

If you want to use our API in staging ENV, you have to do these steps:

If you are a giveth contributor you can access to admin panel ( for creating application/organizations and viewing logs, ...), so you need to these steps

  • Ask us to create a VPN for you in Discord
  • Ask us to create an admin user for you, with your email in Discord
  • Then you can go to https://staging.apigive.giveth.io/admin (your VPN should be connected otherwise you will get 403 error)
  • Login with your email and password ( that you gave use before to create admin user for you)

References

I used these articles for writing project