+
Skip to content

abnercarleto/wallet-api

Repository files navigation

Wallet API

A Java-based wallet API for managing digital wallet operations. This project is structured as a Gradle application and follows best practices for modular, testable, and maintainable code.

Features

  • Digital wallet management
  • Event sourcing and persistence
  • RESTful API endpoints
  • Integration and unit tests
  • Database migrations (Flyway)

Technical Choices

  • Event Sourcing: The architectural model is well-suited to requirements for full traceability of operations and allows for precise and auditable retrieval of historical balances.
  • Hexagonal Architecture: The separation between business rules and adapters makes future changes in communication with external systems easier, making the system more flexible and testable.
  • Spring Boot: Chosen due to the team's familiarity with the framework and its excellent community support, which accelerates development and facilitates maintenance.

Project Structure

src/
  main/
    java/com/abnercarleto/    # Main Java source code
    resources/                 # Application properties and migrations
  test/
    java/com/abnercarleto/     # Test source code
    resources/                 # Test resources
build.gradle                   # Gradle build file

Getting Started

Prerequisites

  • Java 21 or higher
  • Gradle 7+
  • Docker (for running database locally)

Running the Application

  1. Clone the repository:
    git clone <repository-url>
    cd wallet-api
  2. Start dependencies (e.g., database):
    docker-compose -f src/docker/docker-compose.dev.yml up -d
  3. Build and run:
    • On Linux/macOS:
      ./gradlew bootRun
    • On Windows (use Command Prompt or PowerShell):
      gradlew.bat bootRun

Running Tests

  • On Linux/macOS:
    ./gradlew test
  • On Windows:
    gradlew.bat test

Configuration

  • Main configuration: src/main/resources/application.properties
  • Test configuration: src/test/resources/application.properties

Database Migrations

  • Managed by Flyway.
  • Migration scripts: src/main/resources/db/migration/

API Documentation

  • API endpoints are exposed via REST (see controller classes under com.abnercarleto.walletapi.web.controller).
  • Swagger/OpenAPI integration can be added for interactive docs.
  • If enabled, access the API docs at http://localhost:8080/swagger-ui/index.html.

How to Use

  • The API exposes endpoints for wallet operations (see controller classes for details).
  • Example (using curl):
    curl -X GET http://localhost:8080/api/wallets
  • For more endpoints, refer to the controller classes or Swagger UI if enabled.

Troubleshooting

  • Database not running: Ensure Docker is running and the database container is up.
  • Port conflicts: Make sure port 8080 (API) and the database port are free.
  • Gradle issues: Try running ./gradlew clean (or gradlew.bat clean on Windows) if you encounter build errors.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载