![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
graphql-genie
Advanced tools
Simply pass in your GraphQL type defintions and get a fully featured GraphQL API with referential integrity, inverse updates, subscriptions and role based access control that can be used client side or server side.
In short GraphQL Genie handles creating the root Query, Mutation and Subscription types and resolvers for a variety of data stores. If that doesn't mean anything to you it may be good to read up on some graphql basics or learn by experimenting with the demo
npm install graphql-genie fortune graphql graphql-tools lodash
or
yarn add graphql-genie fortune graphql graphql-tools lodash
See the fully featured demo. Create a schema (or use the default provided) and a fully featured api is created. Click the search icon to use GraphiQL to view docs and create or mock data. See graphql genie client on github for more info on the demo.
Or for a server demo see the server examples.
import { FortuneOptions, GraphQLGenie } from 'graphql-genie';
import mongodbAdapter from 'fortune-mongodb';
//adapter: configuration array for the data store. The default type is the memory adapter. See below for other adapter options
const fortuneOptions: FortuneOptions = {
// see the documentation for your specific adapter
adapter: [
mongodbAdapter,
{
// options object, URL is mandatory.
url: config.mongodbURL
}
]
};
// Instantiate Genie with your type defintions as a string
const typeDefs = `
type City {
id: ID! @unique
name: String!
neighborhoods: [String] @unique
residents: [User] @relation(name: "city")
founded: Date
population: Int
}
type User {
id: ID! @unique
displayname: String @unique
email: String! @unique
location: City @relation(name: "city")
}`;
const genie = new GraphQLGenie({
typeDefs: typeDefs,
fortuneOptions: fortuneOptions
});
// get the schema and use it with any other tools you want
const schema: GraphQLSchema = genie.getSchema();
GraphQLGenie uses FortuneJS for accessing the data store. This means any fortune adapter will work, plugins currently exist for memory (example), localforage, IndexedDB (example), MongoDB (example), PostgreSQL (example), Redis (examples), Google Cloud Datastore, NeDB and File System. Or you could write your own adapter.
The api documentation can be found in the docs folder
GraphQL Genie also supports subscriptions with the subscriptions plugin.
Checkout the authentication plugin to easily implement role based access control down to individual fields.
See the apollo server 2 redis jwt example for JWT authentication with users stored in the database. Uses Apollo Server 2.
See the yoga redis example for session authentication with users stored in the database.
See the yoga redis firebase example for using firebase authentication to login and control access from an external JWT provider.
Of course Genie creates a normal schema so you can add authentication in any other way you want. (the authentication plugin uses a combination of all of these)
You can use the methods on the GraphQLSchemaBuilder (returned by getSchemaBuilder()) to add types and resolvers to the generated schema. Or since it is just a normal schema you can use any tool you want (such as graphql-tools) to alter the schema in any way. Including adding resolvers, mocking, stitching, transforming, etc.
If you want guidance or discussion feel free to ask on stack overflow (tag with graphql-genie) or chat on discord
Sets up an API that stores data in browser memory
Sets up an API that stores data in browser Indexed DB
Sets up a server using Apollo Server 2 and an api that stores to a mock Redis with json web token based signup and login. Uses the authentication plugin for role based access control.
Sets up a server using GrapqhQL Yoga and an api that stores to a mock Redis with session based signup and login. Uses the authentication plugin for role based access control.
Sets up a server using GrapqhQL Yoga and an api that stores to a mock Redis. Serves static html for firebase signup and login. Uses the authentication plugin for role based access control.
Sets up a server using GrapqhQL Yoga and an API that stores to PostgreSQL.
Creates a simple node script that uses the GraphQL Genie api to store in a MongoDB database
GraphQL Genie is inspired by Prisma GraphQL and the resulting API has a lot of similarities but they have different goals. Because GraphQL Genie gives you a fully functioning graphql api but is not opinionated about anything else you have the flexibility to use that schema wherever you want and integrate it with any existing services you use.
[Your Name and link Here]
If you contribute and want a thanks callout on genie project READMEs let me know via twitter message (at least 1.00/month). Thanks so much!
Prisma GraphQL / Graphcool for inspiration
FortuneJS for CRUD adapters
Logo Icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY
FAQs
GraphQL Genie
The npm package graphql-genie receives a total of 10 weekly downloads. As such, graphql-genie popularity was classified as not popular.
We found that graphql-genie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.