Skip to content

nkowaokwu/igbo_api

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ec4b85b Β· Jun 22, 2023
Jun 21, 2023
May 24, 2023
Jun 15, 2023
Jun 15, 2023
Jun 12, 2023
Jun 7, 2023
Dec 28, 2022
Jun 23, 2021
Jun 21, 2023
May 29, 2023
Nov 22, 2020
May 20, 2023
Jun 21, 2023
May 6, 2023
May 4, 2023
Oct 7, 2020
Feb 28, 2021
Jan 21, 2023
Jun 20, 2023
May 17, 2023
Feb 16, 2021
Jun 15, 2023
Nov 7, 2021
Jan 17, 2023
Feb 17, 2023
Jun 5, 2023
May 20, 2023
Jan 19, 2022
May 4, 2023
Jun 21, 2023
Dec 10, 2021
Dec 10, 2021
Oct 27, 2022
May 7, 2023
Jun 4, 2023

Repository files navigation

Igbo API

Deploy to Firebase Dockerize Igbo API

Contributing | Documentation | Code of Conduct | Slack Channel

Igbo is the principal native language of the Igbo people, an ethnic group of southeastern Nigeria, and is spoken by approx 45 million people with more than 20 different dialects.

Features 🧱

πŸ“š 4,500+ Igbo words, 5,000+ dialectal variations, 17,000+ Igbo example sentences

✍🏾 English and Igbo definitions

πŸ—£ Audio pronunciations for words and examples

πŸ”Ž Full-text search with diacritic support

πŸš€ Try out a demo here

Getting Started

Let's get the Igbo API running locally on your machine.

0. Prerequisites

To run this project locally, the following tools need to be installed:

1. Installation

Clone the project:

git clone https://github.com/nkowaokwu/igbo_api.git

Navigate into the project directory and install it's dependencies:

cd igbo_api/
yarn install

Build the frontend for the site:

yarn build

2. Connect Firebase Project

This project uses Firebase and requires you to create your own free Firebase project.

Please follow the Firebase Configuration Guide here

3. Local Development

Once you've configured your project, you can start the Igbo API dev server by running:

yarn dev

Navigate to localhost:8080 to see the API

Optional: Development with Replica Sets and Redis

To start the dev API server while running MongoDB Replica sets and the Redis cache, run:

yarn dev:full

To start a Redis server, run:

redis-server

Warning: Running replica sets locally is machine intensive and should only be ran for testing or specific-feature development purposes.

Reminder: You must have Redis installed on your machine in order to run the server.

Docker

If you don't want to run a local Node and MongoDB, you can use Docker

Run the following command:

yarn start:docker

Navigate to localhost:8080 to see the API

API Site

To start up the front site for the API, run:

yarn dev:site

Navigate to localhost:3000 to see the API front site

Seeding 🌱

To populate the database complete the following steps:

Option 1. Build a Dictionary

The following command places the JSON dictionaries in the build/ directory:

yarn build:dictionaries

Here's an example JSON dictionary file: ig-en/ig-en_expanded.json

Option 2. Populate the MongoDB Database

Now that the data has been parsed, it needs to be used to populate, or seed, the MongoDB database.

Start the development server:

yarn dev

Then 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.

3. (Optional) Migrate Data

The database has gone through a number of migrations since the beginning of this project. To ensure that local testing data is the same shape as the data in the production MongoDB database, run all MongoDB migration scripts with the following command:

yarn migrate-up

Testing

Frontend

Frontend tests focus specifically on the Igbo API homepage using Cypress. First, run:

yarn build

To watch frontend tests, run:

yarn cypress

Backend

Backend tests use both locally stored MongoDB and JSON data, so to spin up an instance of MongoDB and start the tests at the same time, run:

yarn test

If you want to run your MongoDB instance and tests in separate terminals, you can run:

Next Steps

Visit our πŸ“š documentation website to learn how to use the Igbo API within your own project.