Rolebase is the online headquarter for liberated companies.
It's an open source SaaS that helps various organizations implement Holacracy, Sociocracy and other forms of governance.
Install npm dependencies in webapp and functions
npm i
Rolebase's backend is built with Nhost. Follow these steps to set it up (MacOS, Linux):
Create an account on nhost.io : https://app.nhost.io.
Install Nhost CLI (https://docs.nhost.io/platform/overview/get-started-with-nhost-cli)
sudo curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
Set up for Windows users :
Download Ubuntu from Microsoft store or anywhere else where you can find it.
Upgrade for WSL 2.
On Ubuntu install git, nvm, npm and node (https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl).
Clone project on Ubuntu environment and open project from Ubuntu terminal to VSCode.
If Docker permissions got denied, follow this step to add new user : https://stackoverflow.com/questions/47854463/docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socke , also verify in docker desktop > settings > resources > WSL integration > Enable Ubuntu for wsl distro and apply.
nhost login
nhost up
npm run dev
You can preview and test some components in Storybook.
cd packages/webapp
npm run storybook
Rolebase uses Mailjet to send some of its mail.
Add your account API keys in your environment variables
MAILJET_PUBIC_KEY
: API Key displayed by Mailjet upon account creation or when resetting secret tokensMAILJET_PRIVATE_KEY
: Secret Key displayed by Mailjet upon account creation or when resetting secret tokensTo use the search engine across an organization, you need to configure an Algolia index.
Create an Algolia application
Create an index and import config:
algolia-docs.json
present in this repoRolebase also uses Stripe for it's subscription feature. You'll need to install the cli first.
Once done, run the following command:
stripe listen --forward-to https://local.functions.nhost.run/routes/subscriptions/stripeWebhook
It'll should output your Stripe webhook endpoint secret.
Write Nhost secrets in the file .secrets
:
# Nhost config
NHOST_WEBHOOK_SECRET = nhost-admin-secret
HASURA_GRAPHQL_ADMIN_SECRET = nhost-admin-secret
HASURA_GRAPHQL_JWT_SECRET = # Generate a password
GRAFANA_ADMIN_PASSWORD = # Generate a password
MAILJET_SMTP_PASSWORD = # MailJet private key
# Env variables injected in nhost.toml
MAILJET_PUBIC_KEY = # MailJet public key. You can find it here: https://app.mailjet.com/account/api_keys
MAILJET_PRIVATE_KEY = # MailJet private key
SECURITY_INVITATION_TOKEN = # Secret token used to validate invitations. You can generate a token with Lastpass for example
ALGOLIA_APP_ID = # Algolia application ID
ALGOLIA_SEARCH_API_KEY = # Algolia search API key
ALGOLIA_ADMIN_API_KEY = # Algolia admin API key
STRIPE_STARTUP_PLAN_PRICE_ID = # Price id of the startup plan inside stripe
STRIPE_ENDPOINT_SECRET = # Stripe webhook endpoint secret: https://dashboard.stripe.com/test/webhooks
STRIPE_PRIVATE_KEY = # Stripe API private key: https://stripe.com/docs/keys#obtain-api-keys
Webapp configuration can be written in settings.ts
:
Note: This file also specifies configuration for local environment. You should not edit those (unless you know what you're doing).
The server config is localized in functions/_src/utils/settings.ts
. You can edit in it:
Note: Like previous configuration, do avoid editing values for local environment. You should also not edit configurations using environment variables those are to be configured in .env
).
You can forward the port with VSCode or ngrok.
With VSCode:
Set resulting URL in .secrets
(only locally):
BACKEND_URL = 'https://XXXXX.devtunnels.ms'
Finally, restart local server (yarn dev
).
All email templates are React components using react-emails
in the folder functions/_src/emails
To preview emails:
cd functions
npm run emails:preview
Then open http://localhost:8090/
Email templates for Nhost are defined in nhost/emails
folder.
Check the documentation to learn more about it.
We generate them with the template functions/_src/emails/templates/NhostEmail.tsx
Translations are in functions/_src/i18n/locales
To build body.html
and subject.txt
files, run:
cd functions
npm run emails:build
Fonts used in emails are included here as static files to be loaded in emails by functions/_src/emails/common/Layout.tsx
Icons we're using in emails are compiled in PNG at build time by packages/webapp/src/buildEmailsIcons.js
script.
This script contains the list of icons to include.
To test in dev mode, you can update icons with:
cd packages/webapp
npm run build-emails-icons
nhost down
sudo nhost sw upgrade
@nhost/nhost-js
.Any pull request is welcome to be submitted on this Github project!
Before committing, please:
git diff
npm run tsc
npm run lint
Before sending your pull request, please:
git fetch origin main:main && git rebase main
If you're having an issue with Rolebase, feel free to contact us or to open an issue on this Github project.