The main purpose to develop this project is that practice the tools such as SpringBoot, MySQL, Mybatis, Mybatis-Plus, and Redis.
SpringBoot
Spring Boot is an open-source Java-based framework used to create a micro Service.
MySQL
MySQL is an open-source relational database management system (RDBMS).
Mybatis
MyBatis is a first-class persistence framework with support for custom SQL, stored procedures, and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces, and Java POJOs (Plain Old Java Objects) to database records.
mybatis-plus
Mybatis plus is an enhanced tool of Mybatis. After using Mybatis plus, we can not only use the unique functions of Mybatis-plus but also use the native functions of Mybatis normally.
Redis
Redis is an open-source, in-memory data store used by millions of developers as a database, cache, streaming engine, and message broker.
Front-end and back-end separation architecture
Front-end: React
Back-end: Spring-Boot
In the decoupled web architecture, frontend and backend code are separate, with no shared resources. The two codebases communicate, but each has its server instance. The backend application serves data via an API (application programming interface) using a framework such as JSON (JavaScript Object Notation). A decoupled approach is advantageous for facilitating changes, enabling individual services and components to be independently scaled up or down or removed entirely without disrupting the entire application. Additionally, decoupling allows frontend and backend developers to optimize their portions without fear of how their work impacts the rest of the system. Developers in general prefer the decoupled approach as it tends to remove production bottlenecks, simplify testing and make for a more easily reusable backend codebase.
Authentication
After the user logs in, the authentication token will be returned to the user, which is required to be carried in the header of subsequent requests. The token is stored in Redis, the key is the token, value is user information.
Application of Cache Service
We have access to Redis to provide us with the caching service.
Https
Our requests are all made through HTTPS, in which we use the domain name and the certificate service provided by AWS.
Soap and Restful
We combine restful service with soap service. The framework is spring boot and spring WS.
Data Encryption
We use md5 + salt
to encrypt sensitive information, such as passwords.
Major modules
We have 4 modules:
-
Login: contains login, register, and logout.
-
User: contains add, update, delete, and page list with search.
-
Inventory: contains add, update, delete, and page list with search.
-
Subscribe: contains add, update, cancel, and page list with search.
-
Appointment: contains add, update, cancel and page list with search.
Service Architecture Load balance: The backend service is deployed on AWS Elastic Beanstalk, so we config load balance with AWS Elastic Beanstalk. We have two pods to process the request.
Redis: The Redis server is installed on AWS EC2, we use Redis to save token and user information.
RDS: we use Google RDS - MySQL as our data storage.
AWS Email: we use AWS Email Service to send emails to users
Twilio: we use Twilio to send text messages to users.
Timer: The timer is used to realize the function of sending reminders regularly.
Code Architecture For the design of code, we use Spring Boot Framework and Spring WS. The layout is below.
Controller: the controller is the portal of the service. The main work is to check and parse the parameter, and check the user token for security.
Service: The service is the main part of handling logical transactions.
Mapper: The mapper is responsible for the interaction with the database. His dependency is mybatis framework.
Util: Util contains a lot of tool classes, which is a lower level.
Sample Diagram It is the login and register module.
Class Architecture
There is a snapshot diagram of the classes, which contains most of the classes and their connection.
Component Diagram The component diagram depicts how components are wired together to form larger components or software systems.
There are three components: Web service, Warehouse and Subscribe center. Component Diagram
Sequence Diagram The sequence diagram shows such a process:
- The user logs in or registers the system.
- Users browse the cultural relics in the museum collection and find them through search.
- The user initiates the attention subscription for the cultural relic.
- The system sends a reminder message (exhibition time and place) to the user through SMS or e-mail.
Please click the link to review the Web API Design.
We tried multiple platforms for deployment.
Back-end: AWS Elastic Beanstalk and AWS EC2.
Front-end: AWS Amplify and Google App Engine.
Database: RDS on Google Cloud Platform and RDS on AWS.
Redis: AWS EC2.
This is an example of how you may give instructions on setting up the project locally. To get a local copy up and running follow these simple example steps.
Install Java 1.8 at https://www.oracle.com/java/technologies/downloads/
Install Maven 3.8.4. at https://maven.apache.org/install.html
run maven command at project directory/ims
mvn install
run maven command at project directory /ims
mvn spring-boot:run
the root is com.gc.ims
the main class is ImsApplication.class
application.properties
contains configuration, such as the database connection information.
sql/sql.sql
contains the DML for the database table and data.
the IDE is intelliJ IDEA
.
View demo here:https://youtu.be/03hlfeOkhHE