The Igbo API Editor Platform is the admin platform used by our Igbo lexicographers to directly input word and example data into the Igbo API
The platform is deployed at https://editor.igboapi.com
Contributions are always welcome. Please first join the Nkọwa okwu volunteer community before jumping in: join here
This is an open-source project that requires that you create your own Firebase account.
To run this project locally, the following tools need to be installed:
Clone the repo:
git clone https://github.com/ijemmao/igbo-api-admin.git
If you don't have Firebase globally install, run the following command:
npm install -g firebase firebase-cli
Install the Firebase project's dependencies:
cd functions/
yarn install
And then the regular project's dependencies:
cd ../
yarn install
Then log into your Firebase account by running:
npx firebase login
This project requires there to be a production and staging Firebase project to enable authentication, functions, and firestore.
Go to Firebase and creating two new projects:
- A production project
- A staging project
Once you've created your two new projects, go to the .firebaserc
in the root directory of the project,
and replace the igbo-api-admin
and igbo-api-admin-staging
with your production project name in "default"
and your staging project name in "staging"
:
{
"projects": {
"default": "<production_project_name>",
"staging": "<staging_project_name>"
}
}
Now that you have your project aliased in .firebaserc
, we want the project to start using those projects.
Save the service accounts that you downloaded from Firebase as prod-firebase-service-account.json
and staging-firebase-service-account.json
in the top-level /functions
.
Once you save those files in /functions
, you're own Igbo API Editor Platform is ready to go!
The backend server responsible for data business logic relies on the Igbo API to be running locally.
Follow the instructions in the Igbo API and start the local development server. You should be able to interact with the API at http://localhost:8080
With API running, in another tab, start the dev project with:
yarn dev
You should now be able to access the editor platform at http://localhost:3030 🎉
Note: This will spin up a local version of the Firebase project igbo-api-admin-staging
which
is used for development purposes. Only Firebase Functions are getting emulated, so that means
that any users that create accounts and log in are stored in the project real Authentication.
If you encounter this error - Error: Cannot find module '/root-path/igbo-api-admin/functions/index.js'. Please verify that the package.json has a valid "main" entry
- build the project by running:
yarn build:dev
Then go back to step 5 above.
You can login with the email admin@example.com
and the password password
to create a new admin account.
If you don't create this account you will see the following error message
You will need local data to see how the Igbo API Editor Platform works.
For words and examples, you will need to make a POST
request to the following route:
/api/v1/test/populate
For example:
http://localhost:8080/api/v1/test/populate // POST
After about 20 seconds, if you see the ✅ Seeding successful.
message in your terminal,
then you have successfully populated your database!
If you would like to create a production build of the project, follow these steps.
Build the Firebase production project:
yarn build
Start the project:
yarn start
In another tab, start up a local instance of the Igbo API with:
cd igbo_api
yarn dev
Note This will spin up a local, production-style version of your Firebase project which can be used for production. It's not recommended to develop in this environment, but it is helpful to use for local testing purposes.
You should now be able to access the editor platform at http://localhost:3030
This project uses Cypress for frontend tests.
Start the frontend and backend server by running:
yarn dev:cypress
Running yarn dev:cypress
will start th development server with Cypress in mind, which will mock audio URIs and bypass approval minimums.
Run the Igbo API locally:
cd igbo_api
yarn dev
If you would like to watch your Cypress tests run in browser, run:
yarn cypress:open
If you want your Cypress tests to run in the terminal, run:
yarn cypress:run
http://localhost:8081
- The test result Dashboard to show all passing and failing tests
All tests run against a built development project, make sure that you've built your project with yarn build:dev
when testing.
This project uses Jest for unit frontend and backend tests.
To run both the frontend and backend tests, run:
yarn jest
To run just the frontend Jest tests, run:
yarn jest:frontend
To run jest the backend Jest tests, run:
yarn jest:backend