@xircus-web3/graph-provider
v0.1.3
Published
Xircus GraphQL Provider SDK
Downloads
4
Readme
@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:
- Join the discussions on GitHub
- Follow @xircusnft on Twitter for project updates
- Share your project/organization using Xircus
- Browse the awesome-xircus list of awesome projects and resources
Support
If you find @xircus-web3/graph useful, please consider supporting our development. Thank you 🙏