Git Product home page Git Product logo

meteor-orgs-boilerplate's Introduction

Meteor Orgs Skeleton

This repo is intended to provide some skeleton code for creating a Meteor application as a "multi-tenant" SaaS application.

To run locally, clone the repo and run meteor npm install then meteor run.

Start by creating a user account, then create a new organisation.

Invite a new user to the organisation with the "viewer" role, then open a new browser to accept the invitation (follow the links shown in your terminal but NB you must remove the leading 3D from the URL params emailAddress and token, e.g. http://localhost:3000/invitations/8narw6CyAcoAWqKeP/[email protected]&token=3Db0uJ39gnyLSMx0zxptoWG6-Ghim8tYsqqFTWIve8_Dg must become http://localhost:3000/invitations/8narw6CyAcoAWqKeP/[email protected]&token=b0uJ39gnyLSMx0zxptoWG6-Ghim8tYsqqFTWIve8_Dg). Then you can enroll the account (again follow the link in terminal) to set the password and log in.

To demonstrate the functionality, add some example content as the admin user, and view it as the "viewer". You should see the differences in permissions.

Follow the code (NB in particular publications and methods for the ExampleContent collection, plus various client-side helpers).

Collections

The basic collections are:

  • Organisation: maintains a top-level "account" which has a list of users and roles. Other collections can reference the organisation ID.
  • User: just the default Meteor.users collection
  • ContentExample: a simple example of a collection, used to demonstrate how publications and views can interact with the organisation model

Routing

One new route is added, prompting users to "select an account" when they first log in. This is to allow a single user ([email protected]) to be attached to multiple organisations, without having to hack his way around the system by using multiple email addresses.

Most routes then have the organisation ID prepended with o/:organisationId. This allows content and publications to be handled in a straightforward way by looking up the organisation ID from the route.

User invitations

Users can be invited to join an organisation, and this functionality is exposed via the organisation settings page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.