This document provides instructions on how to set up and start a running instance of talawa-admin
on your local system. The instructions are written to be followed in sequence so make sure to go through each of them step by step without skipping any sections.
- Talawa-admin installation
- Table of contents
- Set up talawa-api
- Clone this repository
- Change directory into the cloned repo
- Creating .env file
- Setting up REACT_APP_TALAWA_URL in .env file
- Setting up REACT_APP_RECAPTCHA_SITE_KEY in .env file
- Setting up yarn
- Installing required packages/dependencies
- Running talawa-admin
- Accessing talawa-admin
- Sign up on talawa-admin
- Elevate the permissions for created account
- Sign in to talawa-admin
- Running tests
- Linting code files
- Setting up Talawa-Admin and API for Talawa App
Talawa-admin needs URL endpoint to a running instance of talawa-api
graphql service to perform its operations. You need to set up a local instance of talawa-api on your system.
Follow the installation guide on talawa-api repo to set it up.
First you need a local copy of talawa-admin
. Run the following command in the directory of choice on your local system.
git clone https://github.com/PalisadoesFoundation/talawa-admin
This will download a local copy of talawa-admin
in that directory.
Right after cloning the repo you can change the directory of your current terminal(shell)
to the root directory of cloned repository using this command:-
cd ./talawa-admin
NOTE:- All the commands we're going to execute in the following instructions will assume you are in the root directory of the cloned talawa-admin project. If you fail to do so, the commands will not work.
A file named .env is required in the root directory of talawa-admin for storing environment variables used at runtime. It is not a part of the repo and you will have to create it. For a sample of .env
file there is a file named .env.sample
in the root directory. Create a new .env
file by copying the contents of the .env.sample
into .env
file. Use this command:-
cp .env.example .env
This .env
file must be populated with the following environment variables for talawa-admin
to work:-
Variable | Description |
---|---|
REACT_APP_TALAWA_URL | URL endpoint for talawa-api graphql service |
REACT_APP_RECAPTCHA_SITE_KEY | Site key for authentication using reCAPTCHA |
Follow the instructions from section Setting up REACT_APP_TALAWA_URL in .env file up to and including section Setting up REACT_APP_RECAPTCHA_SITE_KEY in .env file to set up these environment variables.
Make sure to go through this section on talawa-api's
installation docs.
Copy/paste the endpoint for accessing talawa-api graphql service to the variable named REACT_APP_TALAWA_URL
in .env
file.
REACT_APP_TALAWA_URL="http://localhost:4000/graphql/"
Make sure to go through this section on talawa-api's
installation docs.
Talawa-admin
needs the reCAPTCHA site key
for the reCAPTCHA
service you set up during talawa-api
installation as shown in this screenshot:-
Copy/paste this reCAPTCHA site key
to the variable named REACT_APP_RECAPTCHA_SITE_KEY
in .env
file.
REACT_APP_RECAPTCHA_SITE_KEY="this_is_the_recaptcha_key"
If you've followed the previous steps you should have already set up node.js on your system. Click here for the official setup guide for yarn.
Run the following command to install the packages and dependencies required by talawa-admin
:-
yarn
Run the following command to start talawa-admin
development server:-
yarn serve
By default talawa-admin
runs on port 3000
on your system's localhost. It is available on the following endpoint:-
http://localhost:3000/
The first time you navigate to the running talawa-admin's website you'll land at talawa-admin sign up page. Sign up using whatever credentials you want and create the account. Make sure to remember the email and password you entered because they'll be used to sign you in later on.
You have to manually elevate your account's permissions to make it admin approved
and make it have SUPERADMIN
privileges.
For the account you created:-
-
Set
adminApproved
field totrue
:-adminApproved: true
-
Set
userType
field toSUPERADMIN
:-userType: "SUPERADMIN"
Now sign in to talawa-admin using the email
and password
you used to sign up.
You can run the tests for talawa-admin
using this command:-
yarn test
You can lint your code files using this command:-
yarn lint
Talawa mobile app requires talawa-api running locally or remotely, which will be used as an organisation url
.
You need to setup your own local instance of Talawa-API and Talawa-admin. The advantage is that you'll be working with the latest code.
- You need to first setup the 2 supporting projects locally. Please refer the INSTALLATION.md of the respective repository for further guidance.
- Create a user account in talawa-admin. The user account is necessary for creating the first organization which will be needed during your development time.
- Enter your MongoDB dashboard to start the process of editing the
users
collection. This is done so that you will get authorized to create and manage an organization. Refer the images below as needed.
- Enter your MongoDB dashboard to start the process of editing the
- After you have created the talawa-admin user account, you'll need to create an organization.
- Login to your talawa-admin account and create an
organization
- Click the
Create Organization
button on the top corner
- Login to your talawa-admin account and create an
- Install talawa Please refer the INSTALLATION.md of the respective repository for further guidance.
- Then use the URL (Organization URL) in this form:
- http://(IP-address):4000/graphql (See the below example)
- Example : http://10.0.2.2:4000/graphql
- Then use the URL (Organization URL) in this form: