Skip to content

Latest commit

 

History

History
160 lines (117 loc) · 3.69 KB

README.md

File metadata and controls

160 lines (117 loc) · 3.69 KB

Coinfolio API

Manage, track, and analyze the value of your digital assets, including NFTs (ERC-721) and FTs (ERC-20) tokens


Getting Started

Technologies

Tools

Requirements

Installations

API Documentation

Architecture Diagram

Author

Technologies

  • NestJS
  • PostgreSQL
  • Kysely
  • TypeScript
  • Docker
  • Eslint
  • Prettier
  • JWT

Tools

  • Moralis used for getting token metadata and market price.
  • Privy.io used for verifying access received from the login widget.

Requirements

  • Node 18 LTS/Hydrogen (LTS is recommended)
  • Yarn 1+ (1.22.19 is recommended)
  • PostgreSQL 16 (LTS is recommended)

Installations

  • Clone the repository

    Run the command below

     git clone https://github.com/timi-codes/coinfolio-api.git && cd coinfolio-api
  • Install dependencies

    Run the command below

     yarn install
  • Create a .env file in the root of the project and add the following environment variables:

     cp .env.example .env
    How to setup environment variables

    Below are the environment variables required for the project along with links to setup instructions for each service.

    Database Setup

    • DB_HOST=localhost
    • DB_PORT=5432
    • DB_NAME=coinfolio
    • DB_USER=postgres
    • DB_PASSWORD=postgres

    Database Setup Guide

    Moralis API Setup

    • MORALIS_API_KEY=your-api-key-here

    Moralis Setup Guide

    JWT Configuration

    • JWT_SECRET=your-jwt-secret
    • JWT_EXPIRES_IN=7d
    • JWT_ISSUER=coinfolio
    • JWT_AUDIENCE=coinfolio

    JWT Setup Guide

    Privy API Setup

    • PRIVY_APP_ID=your-privy-app-id
    • PRIVY_APP_SECRET=your-privy-app-secret

    Privy Setup Guide

    Redis Setup

    • REDIS_HOST=localhost
    • REDIS_PORT=6379

    Redis Setup Guide

Running with Docker

  • Run migrations

    Run the command below to create the database schema

     docker compose run coinfolio-api yarn run db:migrate
  • Run the project

    Run the command below to start the project

     docker compose up -d --build
  • Navigate to http://localhost:4000/api-docs to access the API documentation

  • The root folder contain a token.json file that contains test data

Running Manually with Yarn

  • Run migrations

    Run the command below to create the database schema

     yarn run db:migrate

    Other commands:

      # create a new migration
       yarn run migrate:create <migration_name>
      # run the next migration
       yarn run db:migrate:up
      # rollback the last migration
       yarn run db:migrate:down
      # rollback all migrations
      yarn run db:rollback
      # create a new seed
      yarn run db:seed:make <seed_name>
      # run all seeds
      yarn run db:seed:run
  • Run the project

    Run the command below to start the project

     yarn run start:dev
  • Navigate to http://localhost:4000/api-docs to access the API documentation

  • The root folder contain a token.json file that contains test data

API Documentation

  • Navigate to http://localhost:4000/api-docs to access the API documentation

Architecture Diagram

Logo

Author