Code Monkey home page Code Monkey logo

nft-backend's Introduction

NFTs Backend System

Build & Deploy NFT Orchestration

Connects to NFTPort API and downloads all NFTs & metadata as per the contract addresses in collections.json

Example usage in nft_orchestration.py

Before running the backend, the following env variables need to be setup in docker-compose.env file

NODE_ENV=production
GCP_PROJECT_ID=mentorapp-325205
GCP_SA_KEY=/src/secrets/mentorapp-service-account-datalake.json
NFTPORT_API_URL=https://api.nftport.xyz/v0/nfts/
NFTPORT_API_KEY=d3d10f13-6f3f-407b-9981-0a419b8b994b

where GCP_PROJECT_ID is the google cloud platform project id GCP_SA_KEY is the service account key with access to GCS

Deploy nft orchestration:

$ cd packages/nft_orchestration
$ docker-compose up -d --build

The server is running on http://localhost:3000 and you can call respective REST API endpoints.

To demo the APIs please run the following example

Run example: Go to root directory

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ python3 nft_orhcestration.py 

Run Tests

To run tests, please install mongodb community edition on the host as the tests rely on mongodb instance running on host

$ brew tap mongodb/brew
$ brew install [email protected]
$ brew services start [email protected]

Run the API tests using following command:

$ cd packages/nft_orchestration
$ NODE_ENV=test npm run test

NFT Orchestration Potential Improvements

  • Use Typescript for strict typing
  • We can use microservices to make the backend architecture more scalable
  • Error handling can be improved a lot
  • Better queing system for fetching nfts if the job fails etc. Using bullmq to schedule jobs
  • For the test task, the API keys etc. are commited in the github repo but should be avoided in production

nft-backend's People

Contributors

hemantranvir avatar

Watchers

James Cloos avatar Kaspar Peterson avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.