Backend API for JustJava-Android, a mock food ordering and delivery application for a coffee shop.
Latest development: https://dev.justjava.store/
Latest release: https://api.justjava.store/
Used to store the API's data.
- Create a PostgreSQL database
- Get the url in the form
postgres://username:password@host:port/database
Used to store sessions.
- Create a Redis instance
- Get the url in the form
redis://:password@host:port/0
Used for notifications.
- Create a project on the Firebase console
- Create and download a service account key
- Upload it to a public url.
Used for Google Sign In and uploading product images.
- Create a project on GCP.
- Take note of the project id.
- Create OAuth client ID credentials with "Web Application" as the application type.
- Take note of the client ID.
- Create a bucket on Cloud Storage
Used for M-Pesa payments
- Create an account on Daraja.
- Create an app.
- Get the
consumerKey
andconsumeSecret
.
Used to automatically update the order status when a payment has been completed.
- Clone the repository MarkNjunge/justjava-worker
- Follow installation instructions.
Used for logs
Used for card payments
-
Create an account and business on Ravepay sandbox
-
Go to API settings and get the pubnlic key and secret key.
Used for sending password reset emails. If this is disabled, the token will be returning in the HTTP response.
-
Create an account on Mailgun and complete the setup.
-
Create an email template called
reset-password
that has aname
andtoken
parameter.
- Clone the repository
$ git clone https://github.com/MarkNjunge/justjava-api.git
- Make a
./config/local.json
file based on./config/default.json
.
Alternatively, make a.env
file. See environment variable mappings in custom-environment-variables.json.
$ cp ./config/default.json ./config/local.json
- Install dependencies
$ yarn install
- Start the server
$ yarn run start
# watch mode
$ yarn run start:dev
- Go to
/docs
to view routes documentation.
Build docker images
docker build -t justjava-api .
or use docker-compose
docker-compose up -d
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov