Skip to content

A Spring boot application that is a backend for a mobile application for Muslims to help them challenge and motivate themselves and their friends to do good deeds in a fun way.

License

Notifications You must be signed in to change notification settings

tanafaso/tanafaso-backend

Repository files navigation

🔥 تنافسوا

Build, Test & Package

A Spring boot application that is a backend for a mobile application for Muslims to help them challenge and motivate themselves and their friends to read Azkar in a fun way.

On Play Store & On App Store

Also, take a look at the Frontend repository.

Screenshot_1639467611 Screenshot_1639467257 Screenshot_1639467166
Screenshot_1639466941 Screenshot_1639466636 Screenshot_1639466561

Code Structure

  • configs/: Contains classes annotated with @Configuration, which means that those classes declares beans. Those beans will either be used when needed throughout the code, e.g. in CategoriesCacher or will be scanned by a library and used on startup, e.g. in MongobeeConfig.
  • controllers/: Contains the logic that is applied when every kind of request is received, e.g. FriendshipController contains the logic for every endpoint related to friendship, like requesting/accepting/rejecting a friendship.
  • entities/: Contains the definitions of all of the models used in the application, e.g. User.
  • payload/: Contains the definition of the structure of every request and every response, e.g. UpdateChallengeRequest and UpdateChallengeResponse.
  • repos/: Contains interfaces that are all annotated by @Repository and will be scanned on startup to create beans for every repository that can later be @Autowired and used throughout the code to interact with the Mongo database.
  • services/: Contains interfaces that are all annotated by @Service and can be used throughout the code to provide some utilities, e.g. NotificationsService can be used to send a notification to a user.

Get Started Guide

Clone Repository

  • Navigate to the location you want to save Tanafaso's backend at.
  • Clone the repository: git clone https://github.com/tanafaso/tanafaso-backend.git
  • Change directory: cd tanafaso-backend/

1. Run the server using Docker

Note that docker may take a long time building images for the first time.

2. Setup & Run without Docker

2.1. Setup MongoDB

For this please follow the official MongoDB installation guide.

As an example for Ubuntu 16.04:

    wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    sudo apt-get install gnupg
    wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
    sudo apt-get update
    sudo apt-get install -y mongodb-org

2.2. Start Mongo

Use your OS's intialization program, for Ubuntu, one can use systemctl.

    sudo systemctl start mongod
    sudo systemctl status mongod

2.3. Install Java

    sudo apt-get install default-jre
    sudo apt-get install default-jdk

2.4. Build & Start Server

Build tanafaso's package and skip running tests for now. Note that in the first time you will try to run the package command it may take a long time to pull all of the project's maven dependencies but those dependencies will be cached by maven so that future builds are faster.

        ./mvnw -Dmaven.test.skip=true package

Now you should find the same jar used by tanafaso's server at target/tanafaso.jar

2.5. Run Local Server Instance

Only One-time Setup
  • Enter the mongo shell.
        mongo
  • Create the user that will be used by the server. The user creation command is saved in mongo-init.js file.
        mongo < ./mongo-init.js
Everytime Setup
  • Set devlopment environment variables.
        source env-dev.sh
        ./mvnw spring-boot:run -Dspring-boot.run.profiles=dev

You should find a log line like Tomcat started on port(s): 8080 (http).

Congratulations! You have a local instance of the server running and listening for requests at http://localhost:8080.

Contributing

(Optionally) join Tanafaso's discord server to give feedback, propose new features or ask for help.

There are a lot of ways you can contribute to this project. You can filter issues by good first issue label to get started with an issue that is easy to fix.

  • Suggest new features by filing an issue.
  • Report bugs by filing an issue.
  • Add code documentation, so that it is easier for future contributers to ramp-up.
  • Add tests.
  • Refactor the code to make it more readable, maintainable and scalable.
  • Add pull requests with bug fixes.
  • Add pull requests with new features.

License

The application code is licensed under MIT LICENSE.

About

A Spring boot application that is a backend for a mobile application for Muslims to help them challenge and motivate themselves and their friends to do good deeds in a fun way.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages