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

https://github.com/maugus0/yushan-backend

Backend API for Yushan - A gamified web novel reading platform built with Spring Boot, PostgreSQL, and modern Java practices.
https://github.com/maugus0/yushan-backend

gamification java jwt-authentication maven postgresql rest-api spring-boot webnovel

Last synced: 3 months ago
JSON representation

Backend API for Yushan - A gamified web novel reading platform built with Spring Boot, PostgreSQL, and modern Java practices.

Awesome Lists containing this project

README

          

# Yushan Backend

> ๐Ÿ“š **Backend API for Yushan** - A gamified web novel reading platform that transforms reading into an engaging, social experience.

## ๐Ÿš€ Tech Stack

- **Framework**: Spring Boot 3.x
- **Language**: Java 17+
- **Database**: PostgreSQL (Production) | H2 (Development)
- **Build Tool**: Maven
- **Security**: Spring Security with JWT
- **Testing**: JUnit 5, Testcontainers

## โœจ Key Features

### ๐Ÿ“– Core Platform
- Novel management and chapter organization
- User authentication and authorization
- Full-text search across novels and content
- Reading progress tracking
- Bookmarks and favorites system

### ๐ŸŽฎ Gamification
- XP and leveling system
- Achievement and badge system
- Reading streaks and milestones
- Leaderboards and competitions
- Social features (following, reviews)

### ๐Ÿ”ง Technical Features
- RESTful API design
- JWT-based authentication
- Database migration support
- Comprehensive error handling
- API documentation with OpenAPI
- Caching for performance optimization

## ๐Ÿ—๏ธ Project Structure

```
com.yushan.backend/
โ”œโ”€โ”€ controller/ # REST API endpoints
โ”œโ”€โ”€ service/ # Business logic layer
โ”œโ”€โ”€ repository/ # Data access layer
โ”œโ”€โ”€ entity/ # JPA entities (database models)
โ”œโ”€โ”€ dto/ # Data Transfer Objects
โ”œโ”€โ”€ config/ # Application configuration
โ””โ”€โ”€ exception/ # Custom exception handling
```

## ๐Ÿšฆ Getting Started

### Prerequisites
- Java 17 or higher
- Maven 3.6+
- PostgreSQL (for production)

### Quick Setup
```bash
# Clone the repository
git clone https://github.com/your-username/yushan-backend.git
cd yushan-backend

# Run with H2 database (development)
./mvnw spring-boot:run

# Run tests
./mvnw test
```

### Database Configuration
```properties
# Development (H2 - auto-configured)
spring.profiles.active=dev

# Production (PostgreSQL)
spring.profiles.active=prod
spring.datasource.url=jdbc:postgresql://localhost:5432/yushan
```

## ๐Ÿ“ก API Endpoints

### Authentication
- `POST /api/auth/register` - User registration
- `POST /api/auth/login` - User login
- `POST /api/auth/refresh` - Token refresh

### Novels
- `GET /api/novels` - List novels
- `POST /api/novels` - Create novel
- `GET /api/novels/{id}` - Get novel details
- `GET /api/novels/{id}/chapters` - Get chapters

### User & Gamification
- `GET /api/users/profile` - User profile
- `GET /api/users/progress` - Reading progress
- `GET /api/leaderboard` - User rankings

## ๐Ÿงช Development

### Running Tests
```bash
# Unit tests
./mvnw test

# Integration tests with Testcontainers
./mvnw verify
```

### Database Migration
```bash
# Generate migration scripts
./mvnw flyway:migrate
```

## ๐Ÿ› ๏ธ Built With

- [Spring Boot](https://spring.io/projects/spring-boot) - Application framework
- [Spring Security](https://spring.io/projects/spring-security) - Authentication & authorization
- [Spring Data JPA](https://spring.io/projects/spring-data-jpa) - Data persistence
- [PostgreSQL](https://www.postgresql.org/) - Primary database
- [H2 Database](https://www.h2database.com/) - Development database
- [Maven](https://maven.apache.org/) - Dependency management

## ๐Ÿค Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐ŸŒŸ Roadmap

- [ ] Advanced search with filters
- [ ] Real-time notifications
- [ ] Social features (comments, discussions)
- [ ] Mobile app API support
- [ ] Advanced analytics dashboard
- [ ] Multi-language support

---

**Yushan Backend** - Powering the future of gamified reading experiences ๐Ÿš€