0.1.3 • Published 5 months ago

@xircus-web3/graph-provider v0.1.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

@xircus-web3/graph-provider

This codebase is purposely built for hosting providers as part of the Carousel codebase

Carousel = App Template Routing + GraphQL API

Schemas

  • Accounts
  • Apps
  • NFTs
  • Tokens
  • Listings
  • Contracts

Documentation

For full documentation and examples, visit Xircus Developer.

Recent Changes

  • Added support for Array Type Mixed
  • Added Pagination Params
  • Added Domain extraction from request

Installation

Install Xircus Graph SDK and its ethers peer dependency.

npm install @xircus-web3/graph-provider graphql graphql-yoga mongoose

or

yarn add @xircus-web3/graph-provider graphql graphql-yoga mongoose

Usage

  • Sample setup with Mongoose, GraphQL Yoga on NextJS
  • Create pages/api/graphql.js in your next app
  • Make sure to have .env file DATABASE_URL=mongodburl
  • to test locally .env DATABASE_URL=mongodb://localhost:27017/DATABASE_NAME
import mongoose from 'mongoose'
import { createYoga, createSchema } from 'graphql-yoga'
import { 
  providerSchema,
  createProviderSchema,
  createMongo,
  createMongoAuth,
  extractSubdomain
} from '@xircus-web3/graph-provider'

const server = createYoga({
  schema: createSchema(schema),
  context: async({ req }) => {
    const models = await createMongo(mongoose, providerSchema)
    const auth = createMongoAuth(req, models)
    const appUrl = extractSubdomain(req)
    const app = await models.App.findOne({ url: appUrl })

    return {
      models,
      auth,
      app
    }
  }
})

export default server

Community

Check out the following places for more xircus-related content:

Support

If you find @xircus-web3/graph useful, please consider supporting our development. Thank you 🙏

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

5 months ago

0.1.0

5 months ago