An open API service indexing awesome lists of open source software.

https://github.com/theemperorofdaiviet/eat-commerce

The backend of a simple food delivery website.
https://github.com/theemperorofdaiviet/eat-commerce

h2-database java mysql power-bi spring-boot spring-data-jpa spring-rest stripe

Last synced: 3 months ago
JSON representation

The backend of a simple food delivery website.

Awesome Lists containing this project

README

          

Table of Contents



  1. About The Project



  2. Getting Started


  3. Key Features

  4. API Documentation

  5. Contact



# About The Project
The backend of a simple food delivery website.

## Built With
* [![Java][Java-shield]][Java-url]
* [![Spring][Spring-shield]][Spring-url]
* [![Apache Maven][Apache Maven-shield]][Apache Maven-url]
* [![Apache Tomcat][Apache Tomcat-shield]][Apache Tomcat-url]
* [![Swagger][Swagger-shield]][Swagger-url]
* [![MySQL][MySQL-shield]][MySQL-url]
* [![Stripe][Stripe-shield]][Stripe-url]
* [![Power BI][Power BI-shield]][Power BI-url]

(back to top)

# Getting Started

## Prerequisites
Before cloning and using this application, you'll need to install these things on your computer:
* [Java SE Development Kit 17](https://www.oracle.com/java/technologies/downloads/#java17): Of course you need to have Java installed to run a Java application. I used Java 17, but I think it works fine with the widely-used Java 8 (JDK 1.8), as well.
* [Spring Tool Suite 4](https://spring.io/tools): an Eclipse-based IDE to develop Spring applications.
It provides a ready-to-use environment to implement, run, deploy, and debug the application.
It validates your application and provides quick fixes for the applications.
* [Swagger 2](https://swagger.io/): an open source project used to generate the REST API documents for RESTful web services. It provides a user interface to access our RESTful web services via the web browser.
* [MySQL 8.0](https://dev.mysql.com/downloads/installer/): an open source relational database management system that was originally released in 1995. MySQL is popular among all databases, and is ranked as the 2nd most popular database, only slightly trailing Oracle Database. Among open source databases, MySQL is the most popular database in use today and known as one of the most reliable and performative databases out there.
* [H2 Database](https://www.h2database.com/html/main.html): an embedded, open-source, and in-memory database. It is a relational database management system written in Java. It is a client/server application. It is generally used in unit testing. It stores data in memory, not persist the data on disk.
* [Power BI](https://powerbi.microsoft.com/en-us/): a business analytics service provided by Microsoft that lets you visualize your data and share insights. It converts data from different sources to build interactive dashboards and Business Intelligence reports.

## Installation
You can install this application by cloning this repository into your current working directory:
```sh
git clone https://github.com/theEmperorofDaiViet/eat-commerce.git
```
After cloning the repository, you can open the project by Spring Tool Suite.

## Project Setup

### Database Settings
Open the application.properties file in [/src/main/resources](src/main/resources) to change the information about the datasource to fit your own settings. You can use H2 for testing in development, and use MySQL in production.
* Configuration for MySQL:
```sh
spring.datasource.url=jdbc:mysql://localhost:3306/dbname
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.sql.init.mode=ALWAYS
spring.jpa.hibernate.ddl-auto=update
```

* Configuration for H2:
```sh
spring.datasource.dbcp2.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
```

Open MySQL or H2 and create a empty database with the name specified above.

### Enable Swagger 2
* First, add the following dependencies in the [pom.xml](pom.xml) file:
```xml

io.springfox
springfox-swagger2
2.9.2


io.springfox
springfox-swagger-ui
2.9.2

```
* Create Docket bean in [SwaggerConfig.java](src/main/java/com/educative/ecommerce/config/SwaggerConfig.java) to configure Swagger 2 for the application. We need to define the base package to configure REST API(s) for Swagger 2.
```java
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.educative.ecommerce"))
.paths(PathSelectors.any())
.build();
}
```
* Finally, custom information about the API:
```java
public ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Ecommerce API")
.description("API Documentation for Ecommerce")
.version("1.0.0")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.contact(new Contact("theEmperorofDaiViet", "https://github.com/theEmperorofDaiViet", "Khiet.To.05012001@gmail.com"))
.build();
}
```
### Connect MySQL Database with Power BI
* Step 1: Download and install [*Power BI Desktop*](https://powerbi.microsoft.com/en-us/downloads/)
* Step 2: Open Power BI Desktop, select *Get Data* → *More* → *MySQL*
* Step 3: In the dialog appear, enter the hostname and the name of the database
* Step 4: Enter username and password of the DBMS
* Step 5: Select the tables which will be connect to Power BI.

:arrow_right_hook: Now you can visualize your data, uncover insights and make better decisions!

(back to top)

# Key Features

## Customer
* Register
* Log in/Log out
* Browse products by name or category
* View product details
* Add a product to cart
* Place and pay an order (powered by [*Stripe*](https://stripe.com/))
* Ratings and comments
* View purchase history
* Add a product to bookmark

## Merchant
* Manage categories
* Manage products
* View all orders
* View statistics and data visualization (by [*Power BI*](https://powerbi.microsoft.com/en-us/))

(back to top)

# API Documentation





(back to top)

# Contact

You can contact me via:
* [![GitHub][GitHub-shield]][GitHub-url]
* [![LinkedIn][LinkedIn-shield]][LinkedIn-url]
* ![Gmail][Gmail-shield]: Khiet.To.05012001@gmail.com
* [![Facebook][Facebook-shield]][Facebook-url]
* [![Twitter][Twitter-shield]][Twitter-url]



(back to top)

[Java-shield]: https://img.shields.io/badge/Java-ED8B00?style=for-the-badge&logo=java&logoColor=white
[Java-url]: https://www.java.com/
[Spring-shield]: https://img.shields.io/badge/spring-%236DB33F.svg?style=for-the-badge&logo=spring&logoColor=white
[Spring-url]: https://spring.io/
[Apache Maven-shield]: https://img.shields.io/badge/Apache%20Maven-C71A36?style=for-the-badge&logo=Apache%20Maven&logoColor=white
[Apache Maven-url]: https://maven.apache.org/
[Apache Tomcat-shield]: https://img.shields.io/badge/apache%20tomcat-%23F8DC75.svg?style=for-the-badge&logo=apache-tomcat&logoColor=black
[Apache Tomcat-url]: https://tomcat.apache.org/
[Swagger-shield]: https://img.shields.io/badge/Swagger-85EA2D?style=for-the-badge&logo=Swagger&logoColor=white
[Swagger-url]: https://swagger.io/
[MySQL-shield]: https://img.shields.io/badge/MySQL-005C84?style=for-the-badge&logo=mysql&logoColor=white
[MySQL-url]: https://www.mysql.com/
[Stripe-shield]: https://img.shields.io/badge/Stripe-626CD9?style=for-the-badge&logo=Stripe&logoColor=white
[Stripe-url]: https://stripe.com/
[Power BI-shield]: https://img.shields.io/badge/power_bi-F2C811?style=for-the-badge&logo=powerbi&logoColor=black
[Power BI-url]: https://powerbi.microsoft.com/en-us/

[GitHub-shield]: https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white
[GitHub-url]: https://github.com/theEmperorofDaiViet
[LinkedIn-shield]: https://img.shields.io/badge/linkedin-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white
[LinkedIn-url]: https://www.linkedin.com/in/khiet-to/
[Gmail-shield]: https://img.shields.io/badge/Gmail-D14836?style=for-the-badge&logo=gmail&logoColor=white
[Facebook-shield]: https://img.shields.io/badge/Facebook-%231877F2.svg?style=for-the-badge&logo=Facebook&logoColor=white
[Facebook-url]: https://www.facebook.com/Khiet.To.Official/
[Twitter-shield]: https://img.shields.io/badge/Twitter-%231DA1F2.svg?style=for-the-badge&logo=Twitter&logoColor=white
[Twitter-url]: https://twitter.com/KhietTo