Skip to content

reiosantos/tembea

Repository files navigation

tembea

CircleCI

Maintainability

Test Coverage

Trip management at it's best for Andela.

Description

Tembea is the our solution for making trip request, scheduling, reporting and analytics very easy at Andela.

Table of Contents

Documentation

/api/v1/slack : our slack integration is our MVP

Setup

Dependencies

  • NodeJS - A JavaScript runtime environment
  • Express - A web application framework for NodeJS
  • PostgreSQL - A relational database management system that extends SQL
  • Sequelize - A promise-based ORM for NodeJS

Getting Started

Follow these steps to set up the project in development mode

  • Install Nodejs

  • Install and setup PostgreSQL

  • Clone the repository by running the command

    git clone https://github.com/andela/tembea.git
    
  • Run cd tembea to enter the application's directory

  • Install the application's dependencies by running the command

    yarn install
    
  • Create the .env or .env.development file by running cp .env.sample .env or cp .env .env.development

  • Populate the env file created above by obtaining valid values for the environment variables. (Consult your teammates).

  • Setup the database and migrations (see database setup)

  • Start the application by running

    yarn run start:dev
    

    The application should now be running at http://127.0.0.1:5000

Database and ORM

  • Create a database in PostgreSQL and name it tembea

  • Set the following environment variables in .env (to be created in the env directory):

    • DATABASE_USERNAME - this is the database username
    • DATABASE_PASSWORD - this is the database password. Ignore if you don't have a database password
    • DATABASE_NAME - set this to tembea
  • Run database migrations

    yarn run db:migrate
    
  • Check the database and confirm that the users table has been created

More about environmental variables

After setting up your .env from the template provided in the env/.env.sample file; to use these environment variables anywhere in the app, simply:

process.env.MY_ENV_VARIABLE

Run the Service Using Docker

NOTE: Make sure no service is running on port 5000 and ensure there is a .env file with all the necessary environment variables.

To run the application just type: make start

this would run your application inside a container which you can easily access using localhost:5000.

To stop the application, you can just hit ^c.

To delete the containers: make stop

WARNING: Running below command will make you loose all your data including data in the database!

To cleanup all the containers + volumes: make clean

NOTE: The below commands should be run when the application is running inside container

To migrate database: make migrate

To seed database: make seed

To rollback migrations: make rollback

To get inside the container: make ssh

HINT: To use docker, ensure that your .env file does not contain DATABASE_URL as it conflicts with the value in docker-compose.yml

Testing

Jest is used as the testing framework for both the unit tests and integration tests. To execute all tests, run the command

  yarn test or make test

Deployment

TODO - add deployment commands

Docker for Local development