The Koi Care System is a web-based platform designed to manage and care for Koi fish in a pond. The system allows users to create accounts, add their Koi fish, and manage them effectively. It also provides functionality for shop owners to list and sell products related to Koi fish care.
- User Authentication: Supports JWT-based authentication, with roles such as Guest, Member, Shop, and Admin.
- Role Management: Assigns default roles on registration, with different permissions for each role.
- Koi Fish Management: Members can create, add, or remove Koi fish in the pond.
- Shop Functionality: Users with the "Shop" role can post products for sale, and perform CRUD operations on tags and blogs.
- Google & GitHub Login: OAuth2 integration for Google and GitHub login.
- Email Verification: Upon registration, users must verify their email before becoming a full Member.
- Backend: Spring Boot 3, Spring Security, Spring Data JPA
- Frontend: React
- Database: SQLServer
- Authentication: JWT, OAuth2 (Google and GitHub)
- Email: Spring Mail (Gmail)
- Cloud: Azure
- Clone the repository:
git clone [https://github.com/yourusername/koi-care-system.git](https://github.com/locleabcd/SWP391.git)
- Navigate to the project directory:
cd koi-care-system
- Set up the MySQL database:
- Create a database named
koi-care-system
. - Configure the database connection in
application.properties
:spring.datasource.url=${DB_URL} spring.datasource.username=${DB_NAME} spring.datasource.password=${DB_PASSWORD}
- Create a database named
- Run the application:
./mvnw spring-boot:run
- Visit the application at
http://localhost:8080/api
. - Register as a new user or log in with Google/GitHub.
- Explore features based on your role (Guest, Member, Shop, Admin).
The system uses a relational database schema with the following main tables:
users
(id, username, email, password, role)koi_fish
(id, name, weight, user_id)products
(id, name, description, price, shop_id)
- Guest: Default role for new users.
- Member: Users who have verified their email can manage their Koi fish.
- Shop: Users with the "Shop" role can list products, and manage tags and blogs.
- Admin: Admins have full control over all operations in the system.
Method | Endpoint | Description |
---|---|---|
POST | /api/auth/register |
Register a new user |
POST | /api/auth/login |
Log in a user |
GET | /api/koi |
Get all Koi fish for the logged-in user |
POST | /api/koi |
Add a new Koi fish |
PUT | /api/koi/{id} |
Update a Koi fish by ID |
DELETE | /api/koi/{id} |
Remove a Koi fish by ID |
POST | /api/shop/products |
Add a new product (Shop role only) |
GET | /api/shop/products |
Get all products |
This project is licensed under the MIT License - see the LICENSE file for details.