Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions README.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@


# FastDeer Backend

> Author: [AB-programming](https://github.com/AB-programming/)

This repository contains the backend code for FastDeer. Below are other links related to the FastDeer project:

Client: [FastDeer Client](https://github.com/AB-programming/FastDeer-Client)

Admin Panels:
- School Admin Panel: [School Admin Panel](https://github.com/AB-programming/FastDeer-School-Admin)
- Admin Panel: [Admin Panel](https://github.com/AB-programming/FastDeer-Admin)

## Introduction 📦
FastDeer is a comprehensive app targeting young people and students. It integrates features such as campus bulletin posts, chatting, resource sharing, academic news, campus event publishing/receiving, campus job posting/receiving, volunteer service publishing/receiving, and platform feedback. It also comes with a web-based admin management system, along with separate web admin panels for each school, aiming to meet the diverse needs of the campus community.

Key Features:
- Forum Posts: Users can create and browse forum posts to share information and experiences.
- Chat Functionality: Users can engage in one-on-one chats, providing a convenient social communication tool.
- Academic News: Users or teachers can publish relevant academic articles and content.
- Campus Events: Schools and student organizations can publish relevant events for users to browse.
- Resource Sharing: Users can share and access learning resources such as courseware, notes, etc.
- Campus Employment: Students can access the latest campus job postings, and schools can publish recruitment information.
- Volunteer Channel: Provides volunteer service activities for students to sign up for, encouraging active participation in social service.
- Platform Feedback: Users can submit feedback to the platform, which will continuously improve based on the feedback received.

## Tech Stack (Backend) 🔬
- Spring Boot 3.1.1
- Mybatis-Plus 3.5.3
- Spring Security 6.1.1
- Spring Websocket 3.1.1
- Spring Data Redis 3.1.1
- Java JWT 3.4.0
- MySQL 8
- Redis 5.0.14

## Setup & Deployment Instructions (Backend) 🚀
### Local Setup
Prerequisites:
- JDK 17
- Maven (version >= 3.3.9 recommended)
- MySQL (version 8.0.26 recommended)
- Redis

Clone this project to your local machine. It is recommended to import it using IntelliJ IDEA.

Before starting, you need to modify the relevant configurations in `application.xml`:
```yaml
dev:
host: http://47.110.229.138:8080
mysql:
address: localhost # Change to your server address. If using a cloud database, fill in the corresponding host.
username: root # Change to your database username.
password: 12345678 # Change to your database password.
redis:
host: localhost # Change to your server address. If using a cloud database, fill in the corresponding host.
password: 12345678
database:
user-db: 0
message-db: 1
port: 6379
maxTotal: 30 # Maximum connections
maxIdle: 20 # Maximum idle connections

staticUrl: file:/usr/local/lib/static/ # This directory stores some files. Please change it to your specified directory. Note that the static directory must exist.
maxFileSize: 200
maxRequestSize: 400
avatarUpload:
uploadLocation: /usr/local/lib/static/avatar/ # This directory stores some avatar files. Please change it to your directory path.
avatarUrl: ${dev.host}/static/avatar/
postUpload:
uploadLocation: /usr/local/lib/static/post/ # This directory stores some media files. Please change it to your directory path.
postUrl: ${dev.host}/static/post/

server:
port: 8080

spring:
datasource:
url: jdbc:mysql://${dev.mysql.address}:3306/fast_deer?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${dev.mysql.username}
password: ${dev.mysql.password}


fastDeer:
jwt:
secret: fastDeer8888 # Spring Security secret key
expireTime: 120 # Token expiration time, unit - minutes
issuer: fast-deer # JWT issuer
admin:
username: user
password: 123

# For security reasons, accessKeyId and accessKeySecret are not stored in the config file but in server environment variables. Therefore, expose them in the server environment variables:
# export OSS_ACCESS_KEY_ID=
# export OSS_ACCESS_KEY_SECRET=
# Below are Alibaba Cloud OSS configurations. Please modify them to your own OSS settings. Refer to the cloud provider's documentation for endpoint, bucketName, and OSS address.
oss:
endpoint: https://oss-cn-beijing.aliyuncs.com/
bucketName: fast-deer
ossAddress: https://fast-deer.oss-cn-beijing.aliyuncs.com/
```
This project uses external databases including MySQL and Redis. You can modify the configuration file directly based on your local database setup. Relevant instructions are provided in the comments.

Additionally, this project uses object storage. It is still recommended to use Alibaba Cloud OSS. If you haven't used it before, there seems to be a 3-month free trial available, which is quite good. Just follow their official documentation.
The Alibaba Cloud OSS documentation provides two configuration methods: one is to hardcode the AccessKey ID and Secret directly into the code, and the other is to place them in the machine's environment variables. This project uses the second method.
If you wish to change the method, please refer to the Alibaba Cloud OSS documentation: [https://help.aliyun.com/zh/oss/developer-reference/oss-java-configure-access-credentials?spm=a2c4g.11186623.0.0.7b0871bfX6TY8s](https://help.aliyun.com/zh/oss/developer-reference/oss-java-configure-access-credentials?spm=a2c4g.11186623.0.0.7b0871bfX6TY8s)

You can also use OSS from other providers. I'm not entirely sure about the specific configuration, so please refer to their respective documentation. I haven't used them myself.

Regarding the database, MySQL is used. First, create the `fast_deer` database in your local MySQL instance.
Then, execute `/src/main/resources/sql/init.sql`. After execution, you can run `mock.sql` to populate some mock data (optional).

Finally, after importing the project into your IDE and waiting for dependency indexing to complete, just start it using the standard Spring Boot launch method.

## API Documentation 📚
[Backend API Address](https://d5saomu2mq.apifox.cn/)

## Future Plans 🧱
This project currently has several areas for improvement, such as permission validation, redundant controller API code, module decomposition, etc. In the future, when time permits, these will be refined and the project will be split into microservices.

If you review this project and find any shortcomings or areas for improvement, please feel free to open an issue or submit a pull request. Thank you very much! 🙏

## Acknowledgements 🌸
Creating this project was no easy task, and it might still be quite basic. If you find it useful, I would greatly appreciate a star. Thank you very much! 🙏