Start kit repository using:
- Meteor (build tool, backend/frontend setup)
- GraphQL with Apollo (apollo server and apollo react client)
- React + Redux (front-end design pattern)
- Material-UI (UI component library)
The goal of this project is to implement a realtime Meteor application that simultaneously exposes a GraphQL API usable for other applications. The application uses "traditional" Meteor/Mongo pub/sub and Meteor Methods. The Magic part is that those methods and subscriptions are automagically wired into redux stores/actions -AND- automagically generated into GraphQL schema. This means that we write data schemas, data manipulation methods, and data access subscriptions ONCE.
meteor npm install && npm run mgp
npm start
meteor npm run style
To control access to resources, this boilerplate implements auth centered around Meteor's own accounts system.
Once you are logged in, you will be able to grab your user id via
Meteor.userId()
anywhere on the front/back-end except for in publish functions.
In a publish function, use this.userId
in place of Meteor.userId()
Add a userId
prop to mongo documents, set it to the current user's id using Meteor.userId(). See imports/api/tasks/methods.js
for examples.
To enforce that a resource is being retrieved by the correct user, add { userId: this.userId }
to the graphQL query in the resource publication. See imports/api/tasks/server/publications.js
for an example.
meteor-redux
uses Meteor login tokens to manage user sessions and login- Setting
{ auth: true }
on a Meteor method will- Pass up the user's loginToken from the clientside to server through GQL and
- Once on the server, will check the token against what is saved to the user.
This is done by adding a graphQL field
token
on methods. Seeimports/api/tasks/methods
for an example.
Follow these steps:
- Open an issue with what you think will be good to have
- Mention a maintainer
- Discuss with the maintainer on the solution until you reach consensus
- Let clear on the issue what is the result expected to consider this issue done
Follow these steps:
- Open an issue with what you want to do and how you would do
- Mention any maintainer
- Agree with the maintainer on the solution
- Fork the repo
- Let crystal clear that you will start to work on that
- it is important to avoid two people doing the same thing at the same time
- Start a Pull Request
- watch how to do it in the first 15 minutes of this video
- Send your code
- don't forget to format your code before commit and have zero eslint erros/warnings
- commit message should contains the issue id with #
- Warn the maintainer that you are done
- Wait for the merge
- Start again :)
If you get an error that references not being able to find yarn:meteor-apollo-accounts
- You can remedy this by running
npm run mgp
then starting the app again.