Skip to content

A powerful RESTful API for managing Premier League players built with Spring Boot and PostgreSQL. Features comprehensive CRUD operations, flexible filtering, and robust player data management with modern API design patterns.

Notifications You must be signed in to change notification settings

khan-sk-dev/Premier-League

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Premier League Banner

โšฝ Premier League API

A powerful RESTful API for managing Premier League players

Typing SVG

Java Spring Boot PostgreSQL REST API License: MIT

Stars Forks Issues Pull Requests

line

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

  • Java JDK 11 or higher
  • Maven 3.6+ installed
  • PostgreSQL 12+ database server
  • Git for version control
  • Your favorite IDE (IntelliJ IDEA recommended)

โš™๏ธ Installation

Step Description Command
1๏ธโƒฃ Clone the repository git clone https://github.com/khan-sk-dev/Premier-League.git
cd Premier-League
2๏ธโƒฃ Configure database Edit src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/pl_data
spring.datasource.username=your_username
spring.datasource.password=your_password
3๏ธโƒฃ Build the project mvn clean install
4๏ธโƒฃ Run the application mvn spring-boot:run

๐ŸŒ API Access Point

http://localhost:8080

๐Ÿ“ API Documentation

Player Management Endpoints
Operation Endpoint Description
๐Ÿ“‹ GET /api/v1/player Retrieve players with optional filtering
โž• POST /api/v1/player Add a new player to the database
๐Ÿ”„ PUT /api/v1/player Update existing player information
โŒ DELETE /api/v1/player/{playerName} Remove a player from the database

๐Ÿ“ฅ Request Examples

๐Ÿ” Get Players (with filters)
GET /api/v1/player?team=Arsenal&position=Forward

Response (200 OK)

[
  {
    "id": 1,
    "name": "Gabriel Jesus",
    "team": "Arsenal",
    "position": "Forward",
    "nation": "Brazil"
  },
  {
    "id": 2,
    "name": "Gabriel Martinelli",
    "team": "Arsenal",
    "position": "Forward",
    "nation": "Brazil"
  }
]
โž• Add Player
POST /api/v1/player
Content-Type: application/json

Request Body

{
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Winger",
  "nation": "England"
}

Response (201 Created)

{
  "id": 3,
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Winger",
  "nation": "England"
}
๐Ÿ”„ Update Player
PUT /api/v1/player
Content-Type: application/json

Request Body

{
  "id": 3,
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Right Winger",
  "nation": "England"
}

Response (200 OK)

{
  "id": 3,
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Right Winger",
  "nation": "England"
}
โŒ Delete Player
DELETE /api/v1/player/Bukayo%20Saka

Response (204 No Content)

๐Ÿค Contributing

We welcome contributions!

Follow these steps to contribute to the Premier League API project:

    <ol align="left">
      <li>Fork the repository</li>
      <li>Create a feature branch (<code>git checkout -b feature/amazing-feature</code>)</li>
      <li>Make your changes</li>
      <li>Commit your changes (<code>git commit -m 'Add some amazing feature'</code>)</li>
      <li>Push to the branch (<code>git push origin feature/amazing-feature</code>)</li>
      <li>Open a Pull Request</li>
    </ol>
    
    <p>Please make sure your code follows our coding standards and includes appropriate tests.</p>
  </td>
</tr>

Please note that this project follows a Code of Conduct. By participating, you are expected to uphold this code.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

    <details>
      <summary>MIT License Summary</summary>
      <p>
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.
      </p>
    </details>
  </td>
</tr>

๐Ÿ”ฎ Future Enhancements


๐Ÿ” Authentication & Authorization
Implement JWT-based auth system

๐Ÿ“Š Statistical Analysis
Track player performance metrics

๐ŸŒ Team Management
Team creation and roster management

โšก Caching Layer
Redis caching for improved performance

๐Ÿงช Test Coverage
Comprehensive unit and integration tests

๐Ÿ“ข Notifications
Real-time updates for data changes
line

Connect With Me

GitHub LinkedIn Email

Developed with โค๏ธ by khan-sk-dev

Star Badge

Buy Me A Coffee

Back to Top

โ”œโ”€โ”€ ๐Ÿ“‚ model/ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ Player.java โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“‚ repository/ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ PlayerRepository.java โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“‚ service/ โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ PlayerService.java โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ PlayerServiceImpl.java โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“‚ exception/ โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ GlobalExceptionHandler.java โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“„ PremierLeagueApplication.java โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ resources/ โ”‚ โ”‚ โ”œโ”€โ”€ ๐Ÿ“„ application.properties โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ static/ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ test/ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ java/ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ com/ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ premierleague/ โ”‚ โ””โ”€โ”€ ๐Ÿ“‚ tests/ โ”œโ”€โ”€ ๐Ÿ“„ .gitignore โ”œโ”€โ”€ ๐Ÿ“„ mvnw โ”œโ”€โ”€ ๐Ÿ“„ mvnw.cmd โ”œโ”€โ”€ ๐Ÿ“„ pom.xml โ””โ”€โ”€ ๐Ÿ“„ README.md

๐Ÿš€ Getting Started

Prerequisites

  • JDK 11 or higher
  • Maven 3.6+
  • PostgreSQL 12+

Installation

  1. Clone the repository

    git clone https://github.com/khan-sk-dev/Premier-League.git
    cd Premier-League
  2. Configure database

    Edit src/main/resources/application.properties:

    spring.datasource.url=jdbc:postgresql://localhost:5432/pl_data
    spring.datasource.username=your_username
    spring.datasource.password=your_password
  3. Build the project

    mvn clean install
  4. Run the application

    mvn spring-boot:run

    The API will be accessible at http://localhost:8080

๐Ÿ“ API Documentation

Player Endpoints

Get Players

GET /api/v1/player

Query Parameters:

  • team - Filter by team name
  • name - Filter by player name
  • position - Filter by position
  • nation - Filter by nation

Example:

GET /api/v1/player?team=Arsenal&position=Striker

Add Player

POST /api/v1/player

Request Body:

{
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Winger",
  "nation": "England"
}

Update Player

PUT /api/v1/player

Request Body:

{
  "name": "Bukayo Saka",
  "team": "Arsenal",
  "position": "Right Winger",
  "nation": "England"
}

Delete Player

DELETE /api/v1/player/{playerName}

Example:

DELETE /api/v1/player/Bukayo%20Saka

๐Ÿ”ง Project Structure

Premier-League/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main/
โ”‚   โ”‚   โ”œโ”€โ”€ java/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ com/
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ premierleague/
โ”‚   โ”‚   โ”‚           โ”œโ”€โ”€ controller/
โ”‚   โ”‚   โ”‚           โ”œโ”€โ”€ model/
โ”‚   โ”‚   โ”‚           โ”œโ”€โ”€ repository/
โ”‚   โ”‚   โ”‚           โ”œโ”€โ”€ service/
โ”‚   โ”‚   โ”‚           โ””โ”€โ”€ PremierLeagueApplication.java
โ”‚   โ”‚   โ””โ”€โ”€ resources/
โ”‚   โ”‚       โ””โ”€โ”€ application.properties
โ”‚   โ””โ”€โ”€ test/
โ”‚       โ””โ”€โ”€ java/
โ”‚           โ””โ”€โ”€ com/
โ”‚               โ””โ”€โ”€ premierleague/
โ”‚                   โ””โ”€โ”€ tests/
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ mvnw
โ”œโ”€โ”€ mvnw.cmd
โ”œโ”€โ”€ pom.xml
โ””โ”€โ”€ README.md

๐Ÿค Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some 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 file for details.

๐Ÿ“Š Future Enhancements

  • ๐Ÿ” Authentication and authorization
  • ๐Ÿ“Š Statistical analysis of player performance
  • ๐ŸŒ Team management functionality
  • โšก Caching for improved performance
  • ๐Ÿงช Comprehensive test coverage

Developed with โค๏ธ by khan-sk-dev

About

A powerful RESTful API for managing Premier League players built with Spring Boot and PostgreSQL. Features comprehensive CRUD operations, flexible filtering, and robust player data management with modern API design patterns.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages