ᅠ ᅠ
Developers: Daniil Livitn, Roman Soldatov
- Requirements
- API
- Database
- Google credentials
- Hosting and CI
- How to install locally
- Code analysis
- Want to contribute?
This is the repository with Backend code for the InnoTutor project. The backend is designed as REST API, so you need the frontend part to access it. Alternatively, you can use Postman or Swagger. The main description of the project is available here
Technical Stack:
- Java, Spring Framework, Firebase, Docker, PostgreSQL:
- IntelliJ IDEA IDE
For this open-source project, we used the simplest registration way via Google Firebase
- as a website user, you need to have a Google account
- as a developer, who is going to host this project version, you need to get your own Google credentials.
In case of using this project in Innopolis University we'll change authentication to innopolis email login page.
- Backend Development Team
- Developer 1 – Backend developer. Implement the backend on Java/Spring which interacts with the PostgreSQL database.
- Developer 2 – Backend developer. Implement the backend on Java/Spring which returns the result to the frontend via REST API.
- Developer 3 – Backend developer. Write tests for the Backend.
Stake: Development process
There is documentation with all requests which backend supports. You can read about API documentation here
We use Docker and PostgreSQL for the database. Here is the database diagram
- If you want to import our database, you can use restore.sql file with empty tables.
- In application.properties file specify your database's
URL
,username
andpassword
.
To log in, you need to provide your Google credentials created here.
Then open application.properties file and input your JSON Google credentials file as a single string in GOOGLE_CREDENTIALS
field.
You can use this online service to convert JSON into a string with escape characters: link
In case of any problems refer to this guide
We use Heroku to host the backend. Here is the deployed version of it.
For continuous integration, we have to make a pull request into the main
branch. Then Heroku will automatically deploy a new version on the server.
To build the project on Heroku's server you need to provide config vars: DATABASE_URL
and GOOGLE_CREDENTIALS
. Also, add this buildpack https://github.com/buyersight/heroku-google-application-credentials-buildpack.git
Guide how to work with config vars: link
- Download this project
- Open it in IntelliJ IDEA
- Set up database and Google credentials (check instructions above Database and Google credentials)
- Open
InnotutorBackendApplication
java class and pressctrl+R
Guide how to run Spring project: link
- Clone this repository to your machine using:
https://github.com/InnoTutor/Backend.git
- You need to create a database and specify the path to it in the
application.properties
. Besides this, you need to specify your username, password and google credentials.
Note: Path toapplication.properties
: application.properties
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/innotutor}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:root}
...
GOOGLE_CREDENTIALS=<Your Google Credentials>
- Using the command line, navigate to the root folder of the project and run the command:
mvn clean install
- After a successful build, you need to run the command:
java -jar .target/innotutor_backend-0.0.1-SNAPSHOT.jar
or
java -jar target/innotutor_backend-0.0.1-SNAPSHOT.jar
- The result of PMD static analyzer. Do not be scared by such a huge number of violations. We fixed all the violations that we could fix. Other violations can not be fixed due to spring framework-specific code which requires to follow special name convention, so the framework could understand fields and create particular Beans.
You can contribute to this project. Just fork the repository from the develop
branch, implement changes you want to propose and make a pull request.
Also, there are issues, so feel free to submit a new one or participate in existing.