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.
Also, take a look at the Frontend repository.
- 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.
- 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/
Note that docker may take a long time building images for the first time.
- Install Docker
- Run:
docker compose up
- Try requesting http://localhost:8080
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
Use your OS's intialization program, for Ubuntu, one can use systemctl.
sudo systemctl start mongod
sudo systemctl status mongod
sudo apt-get install default-jre
sudo apt-get install default-jdk
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
- 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
- Set devlopment environment variables.
source env-dev.sh
- Build and Run a dev instance and specify the
dev
profile so that application-dev.yml is used instead of application.yml.
./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.
(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.
The application code is licensed under MIT LICENSE.