/graphql-app-acl

An ACL implementation using GraphQL

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Boilerplate for an Advanced GraphQL Server with basic Auth APIs

🚀 Bootstrap your GraphQL server within seconds
A starter kit for a flexible Prisma GraphQL server for Typescript.js - Access control for group

Requirements

You need to have the Prisma CLI installed to bootstrap your GraphQL server using primsa init:

npm install -g prisma

You can now deploy the Prisma service (note that this requires you to have Docker installed on your machine - if that's not the case, follow the collapsed instructions below the code block):

prisma deploy
I don't have Docker installed on my machine

Please follow the steps provided in the give here to install docker for mac. Once the Docker is installed, start the docker engine into your system.

Getting started

# 1. Navigate to the cloned GraphQL server in directory `prisma-group-acl`, based on `typescript-advanced` boilerplate
cd prisma-group-acl;

# 2. Install require NPM packages
npm install;

#3. Deploy the prisma...
prisma deploy;

# 4. Start server (runs on http://localhost:4000) and open GraphQL Playground
npm run dev;

Documentation

API

Commands

  • npm run start starts GraphQL server on http://localhost:4000
  • npm run dev starts GraphQL server on http://localhost:4000 and opens GraphQL Playground
  • npm run playground opens the GraphQL Playground for the projects from .graphqlconfig.yml
  • prisma <subcommand> gives access to local version of Prisma CLI (e.g. prisma deploy)

Note: We recommend that you're using npm run dev during development as it will give you access to the GraphQL API or your server (defined by the application schema) as well as to the Prisma API directly (defined by the Prisma database schema). If you're starting the server with npm run start, you'll only be able to access the API of the application schema.

To Access MySQL image in Docker

#1. This command will give the list of container with their respective container-id
docker ps;

#2. This command will take you inside the docker mysql container
docker exec -it <container-mysql-id> sh;

#3. This command will access the mysql cli
mysql -u root -p

#4. Enter mysql root user password
graphcool

#5. Access the database
use `database-name`;

Note: The database name is the name of your project repo name defined with the environment name. For ex. I am running app by name prisma-group-acl & environment is dev then database name is prisma-group-acl@dev

Project structure

File name Description

├── .env Defines environment variables
├── .graphqlconfig.yml Configuration file based on graphql-config (e.g. used by GraphQL Playground).
└── database (directory) Contains all files that are related to the Prisma database service
├── prisma.yml The root configuration file for your Prisma database service (docs)
└── datamodel.graphql Defines your data model (written in GraphQL SDL)
└── documentations (directory) Contains detailed documentation for app & dev api files
├── apis.app.graphql Contains api samples for app(ie. client)
└── apis.dev.graphql Contains api samples for devs
└── src (directory) Contains the source files for your GraphQL server
├── index.js The entry point for your GraphQL server
├── schema.graphql The application schema defining the API exposed to client applications
├── resolvers (directory) Contains the implementation of the resolvers for the application schema
└── generated (directory) Contains generated files
└── prisma.grapghql The Prisma database schema defining the Prisma GraphQL API

Contributing

Your feedback is very helpful, please share your opinion and thoughts! If you have any questions or want to contribute yourself, join the #graphql-experiments channel on our Slack.