https://github.com/stpfeffer/transaction-api
Projeto em Java com Spring Boot de uma simples API de pagamento, utilizando arquitetura limpa e banco de dados em memória H2.
https://github.com/stpfeffer/transaction-api
clean-architecture h2-database java spring spring-boot
Last synced: about 2 months ago
JSON representation
Projeto em Java com Spring Boot de uma simples API de pagamento, utilizando arquitetura limpa e banco de dados em memória H2.
- Host: GitHub
- URL: https://github.com/stpfeffer/transaction-api
- Owner: StPfeffer
- Created: 2023-11-12T06:57:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-15T02:28:33.000Z (over 2 years ago)
- Last Synced: 2025-02-28T05:59:52.975Z (over 1 year ago)
- Topics: clean-architecture, h2-database, java, spring, spring-boot
- Language: Java
- Homepage:
- Size: 294 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.en-US.md
Awesome Lists containing this project
README
# Transaction API
_Read this in other languages_:
[Português](README.md)
## Overview
This project is an API for transactions between users, built using the principles of clean architecture to ensure modularity, flexibility, and scalability. By adopting this approach, the code is organized into independent layers, promoting the separation of concerns and facilitating maintenance.
The chosen technologies for implementation are:
- **Java**: The robust and versatile programming language, chosen for its widespread adoption in the development community and its ability to provide performance and reliability.
- **Spring Boot**: A framework that simplifies the development of Java applications, providing a comprehensive set of tools and conventions for the rapid creation of services and RESTful APIs. Spring Boot also easily integrates with other technologies and libraries, speeding up the development cycle.
- **Jakarta Persistence API (JPA)**: A standard data persistence API for Java, which facilitates interaction with relational databases. By adopting JPA, the project gains in portability and flexibility, allowing for a more seamless switch between database vendors.
- **H2**: An in-memory database that offers a lightweight and efficient solution for development and testing. The choice of H2 streamlines the development process, allowing developers to test and validate API functionality without the need to set up a more robust database during the initial stages of the project.
## Key Features
### Transaction Creation:
- Allows users to create new transactions by providing details such as sender, recipient, and amount.
### Transaction Listing:
- Presents a comprehensive view of all completed transactions.
- Enables filtering by sender, recipient, and other criteria.
### Real-time Notifications:
- Sends automatic notifications to users involved in a successful transaction through an external service.
### Transaction Authorization:
- Incorporates an external authorization service to validate transactions before completion.
## Project Structure

## How to Use
### Java and Maven
Firstly, ensure you have [Java](https://www.oracle.com/java/technologies/downloads/) and [Maven](https://maven.apache.org/download.cgi) installed.
### Install Dependencies
- Spring Boot
- H2 Database
- Jakarta Persistence API
```
mvn clean install
```
### Database
Configure the database properties in the src/main/resources/application.properties file.
*Note*: By default, an in-memory H2 database is configured.
### Postman
[
](https://app.getpostman.com/run-collection/25630504-041b878b-1a1b-48ca-b1db-ec3e63343d71?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D25630504-041b878b-1a1b-48ca-b1db-ec3e63343d71%26entityType%3Dcollection%26workspaceId%3Dcfd8052d-40cd-44c6-b0f0-a2325f1f5430)
In the project directories, there is a folder named postman, containing a collection with all API endpoints.
To use it, copy the content of the postman/collections/Transaction API.json file and paste it into Postman:

If you use IntelliJ, you can make HTTP requests directly from the IDE:

### Run the Application:
To start the application, use the command:
```
mvn spring-boot:run
```
By default, the application will start on port 8080.