Red Drop API is a comprehensive donation application designed to facilitate blood and monetary donations. It provides RESTful endpoints for managing donors, receivers, donations, and organizations. This API is built using Spring Boot and supports both H2 database for local setup and PostgreSQL for production environments.
- Manage donors and receivers
- Track blood and monetary donations
- View and update organization details
- Check blood type compatibility
- Create and manage users
- Comprehensive testing with over 85% test coverage
- Swagger for API documentation
- Java 21
- Maven
- PostgreSQL (optional, for production setup)
-
Clone the repository:
git clone https://github.com/ramialkaro/red-drop-api.git cd red-drop-api
-
Run the application:
mvn spring-boot:run
By default, the application uses an H2 in-memory database for local development.
-
Access H2 Console:
- URL:
http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:testdb
- Username:
sa
- Password:
password
- URL:
-
Configure PostgreSQL: Update the
application.properties
orapplication.yml
with your PostgreSQL configuration.spring.datasource.url=jdbc:postgresql://localhost:5432/reddrop spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update
-
Run the application:
mvn spring-boot:run
To run the application using Docker, use the provided docker-compose.yaml
file. This setup includes both the application and a PostgreSQL database.
-
Clone the repository:
git clone https://github.com/ramialkaro/red-drop-api.git cd red-drop-api
-
Run Docker Compose:
docker-compose up
-
Access the application:
- The API will be accessible at
http://localhost:8080
- The PostgreSQL database will be accessible at
localhost:5432
- The API will be accessible at
The Red Drop API uses Swagger for API documentation. Once the application is running, you can access the Swagger UI at:
http://localhost:8080/swagger-ui.html
To run the tests and check the coverage, use the following command:
mvn test
Test coverage reports are generated and can be viewed in the target/site/jacoco
directory.
This project uses GitHub Actions for CI/CD. The configuration file is located at .github/workflows/maven.yml
and includes steps for building the project and running tests.
- Controller Layer: Handles incoming HTTP requests and responses.
- Service Layer: Contains business logic.
- Repository Layer: Interacts with the database.
- Model Layer: Defines the data structures.
Contributions are welcome! Please fork the repository and submit a pull request.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
Happy coding! Thank you for using Red Drop API.