{"id":23388756,"url":"https://github.com/kristiyankiryakov/wall-e","last_synced_at":"2026-04-28T11:02:02.908Z","repository":{"id":269155440,"uuid":"906581741","full_name":"kristiyankiryakov/Wall-e","owner":"kristiyankiryakov","description":"Restful API - allowing users to deposit/withdraw money from their wallets","archived":false,"fork":false,"pushed_at":"2025-01-03T09:22:26.000Z","size":52689,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T09:53:44.444Z","etag":null,"topics":["java","rest-api","spring-boot","spring-security-jwt"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kristiyankiryakov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-21T09:57:59.000Z","updated_at":"2025-01-03T17:13:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"31f16387-1e21-4870-b00e-948ae901f3c7","html_url":"https://github.com/kristiyankiryakov/Wall-e","commit_stats":null,"previous_names":["kristiyankiryakov/wall-e"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiyankiryakov%2FWall-e","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiyankiryakov%2FWall-e/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiyankiryakov%2FWall-e/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kristiyankiryakov%2FWall-e/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kristiyankiryakov","download_url":"https://codeload.github.com/kristiyankiryakov/Wall-e/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247851556,"owners_count":21006776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","rest-api","spring-boot","spring-security-jwt"],"created_at":"2024-12-22T02:33:57.255Z","updated_at":"2026-04-28T11:02:02.837Z","avatar_url":"https://github.com/kristiyankiryakov.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wallet API\n\nA Spring Boot REST API that enables user management and wallet operations including creating users, managing wallets, and handling deposits/withdrawals.\n\n### API Design Notes\n\n- **User-Wallet Relationship**: There's a one-to-many relationship between users and wallets.\n\n\n## Technologies Used\n\n- Java 17\n- Spring Boot\n- PostgreSQL\n- Docker\n- JPA/Hibernate\n- Maven\n\n## Prerequisites\n\nBefore running this application, make sure you have the following installed:\n\n- Java Development Kit (JDK) 17 or later\n- Docker and Docker Compose\n- Maven\n- Git\n\n## Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/kristiyankiryakov/Wall-e.git\ncd Wall-e\n```\n\n### 2. Database Setup\n\nThe application uses PostgreSQL running in a Docker container. Start the database using Docker Compose:\n\n```bash\ndocker compose up\n```\n\nThis will start a PostgreSQL instance with the following configuration:\n- Port: 5432\n- Database: postgres\n- Username: postgres\n- Password: postgres\n\n### 3. Configure Application\n\nThe application uses profile-specific YAML configuration:\n\n- `application.yml`: Contains the base configuration and production settings\n- `application-dev.yml`: Contains development-specific settings with default JWT values\n\nThe development profile is activated by default for ease of testing.\n\nFor production deployments, ensure you provide the actual JWT configuration through environment variables:\n- JWT_SECRET\n- JWT_EXPIRATION\n\n### 4. Build and Run\n\nBuild the application using Maven:\n\n```bash\nmvn clean install\n```\n\nRun the application:\n\n```bash\nmvn spring-boot:run\n```\n\nThe API will be available at `http://localhost:8080`\n\n## API Endpoints\n\n### Authentication\n\n#### Register\n- **POST** `/api/auth/register`\n- Creates a new user account\n- Request Body (`AuthRequest`):\n  ```json\n  {\n    \"username\": \"string\",     // Required\n    \"password\": \"string\"      // Required, minimal length = 6\n  }\n  ```\n- Response (`AuthResponse`):\n  ```json\n  {\n    \"token\": \"string\"\n  }\n  ```\n\n#### Login\n- **POST** `/api/auth/login`\n- Authenticates user\n- Request Body (`AuthRequest`):\n  ```json\n  {\n    \"username\": \"string\",     // Required\n    \"password\": \"string\"      // Required\n  }\n  ```\n- Response (`AuthResponse`):\n  ```json\n  {\n    \"token\": \"string\"\n  }\n  ```\n\n### Wallets\n\n#### Create Wallet\n- **POST** `/api/wallets`\n- Creates a new wallet for a user\n- Request Body(`WalletRequest`)\n  ```json\n  {\n  \"walletName\": \"string\"     // Required\n  }\n    ```\n- Response (`WalletResponse`):\n  ```json\n  {\n    \"id\" : \"number\",\n    \"name\": \"string\",        \n    \"owner\": \"string\",       // Username of the owner\n    \"balance\": \"number\"\n  }\n  ```\n\n#### View Balance\n- **GET** `/api/wallets/{walletId}`\n- Retrieves the current wallet\n- Path Variables:\n  - `walletId`: The ID of the wallet\n- Response (`WalletResponse`):\n  ```json\n  {\n    \"id\" : \"number\",\n    \"name\": \"string\",        \n    \"owner\": \"string\",       // Username of the owner\n    \"balance\": \"number\"\n  }\n  ```\n\n#### Deposit Money\n- **PUT** `/api/wallets/{walletId}/deposit`\n- Adds funds to a wallet\n- Path Variables:\n  - `walletId`: The ID of the wallet\n- Request Body (`TransactionRequest`):\n  ```json\n  {\n    \"amount\": \"number\"    // Required, must be positive\n  }\n  ```\n- Response (`TransactionResponse`):\n  ```json\n  {\n    \"walletId\": \"number\",\n    \"userId\": \"number\",\n    \"previousBalance\": \"number\",\n    \"currentBalance\": \"number\",\n    \"transactionType\": \"string\",\n    \"transactionAmount\": \"number\"\n  }\n  ```\n\n#### Withdraw Money\n- **PUT** `/api/wallets/{walletId}/withdraw`\n- Withdraws funds from a wallet\n- Path Variables:\n  - `walletId`: The ID of the wallet\n- Request Body (`TransactionRequest`):\n  ```json\n  {\n    \"amount\": \"number\"    // Required, must be positive\n  }\n  ```\n- Response (`TransactionResponse`):\n  ```json\n  {\n    \"walletId\": \"number\",\n    \"userId\": \"number\",\n    \"previousBalance\": \"number\",\n    \"currentBalance\": \"number\",\n    \"transactionType\": \"string\",\n    \"transactionAmount\": \"number\"\n  }\n  ```\n\n### Transaction History\n\n#### View transactions of a wallet\n- **GET** `/api/transactions/{walletId}`\n- Retrieves the transactions of a wallet\n- Path Variables:\n- `walletId`: The ID of the wallet\n- Response (`List\u003cTransactionDto\u003e`):\n  ```json\n  {\n    \"id\" : \"number\",\n    \"amount\": \"number\",        \n    \"type\": \"string\",     \n    \"walletId\": \"number\"\n  }\n  ```\n\n## Testing\n\n### Running Tests\n\nExecute the test suite using Maven:\n\n```bash\nmvn test\n```\n\n### Manual Testing\n\nYou can use tools like Postman or curl to test the API endpoints. Here's an example using curl:\n\n```bash\n# Create a new user\ncurl -X POST http://localhost:8080/api/auth/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"username\": \"John_Doe\", \"password\": \"john123\"}'\n```\n\n### Authentication Required Routes\n\nThe following endpoints require authentication via Bearer token in the Authorization header:\n\n```bash\n# Wallet endpoints\ncurl -X GET http://localhost:8080/api/wallets \\\n  -H \"Authorization: Bearer your_jwt_token_here\"\n\n# Transaction endpoints\ncurl -X GET http://localhost:8080/api/transactions \\\n  -H \"Authorization: Bearer your_jwt_token_here\"\n```\n\n## CI/CD Pipeline\n\nThis project uses GitHub Actions for continuous integration and deployment. The pipeline is triggered on:\n- Push to the `main` branch\n- Pull requests to the `main` branch\n\n### Pipeline Overview\n\nThe workflow file is located at `.github/workflows/ci-cd.yml` and consists of the following steps:\n\n#### Build Job\n\nThe build job runs on Ubuntu latest and sets up a PostgreSQL service container for integration tests.\n\n##### Database Container Configuration\n- Image: postgres:latest\n- Credentials:\n  - Username: postgres\n  - Password: postgres\n  - Database: postgres\n- Port: 5432\n- Health checks configured for reliability\n\n##### Steps\n\n1. **Checkout Code**\n  - Uses: `actions/checkout@v3`\n  - Fetches the repository code\n\n2. **Setup JDK**\n  - Uses: `actions/setup-java@v3`\n  - Configures JDK 17 (Temurin distribution)\n\n3. **Cache Dependencies**\n  - Uses: `actions/cache@v3`\n  - Caches Maven dependencies to speed up builds\n  - Cache key based on pom.xml hash\n\n4. **Build Project**\n  - Runs: `mvn clean install`\n  - Compiles the code and packages the application\n\n5. **Run Tests**\n  - Runs: `mvn test -X`\n  - Executes all tests with detailed logging\n\n### Workflow File\n\n```yaml\nname: Java CI/CD Pipeline\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    services:\n      postgres:\n        image: postgres:latest\n        env:\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: postgres\n          POSTGRES_DB: postgres\n        ports:\n          - 5432:5432\n        options: --health-cmd=\"pg_isready -U user\" --health-timeout=30s --health-start-period=5s --health-retries=3\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v3\n\n      - name: Set up JDK 17\n        uses: actions/setup-java@v3\n        with:\n          java-version: 17\n          distribution: 'temurin'\n\n      - name: Cache Maven repository\n        uses: actions/cache@v3\n        with:\n          path: ~/.m2\n          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}\n          restore-keys: |\n            ${{ runner.os }}-maven\n\n      - name: Build with Maven\n        run: mvn clean install\n\n      - name: Run tests\n        run: mvn test -X\n```\n\n### Pipeline Status\n\nYou can view the status of pipeline runs in the \"Actions\" tab of the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristiyankiryakov%2Fwall-e","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkristiyankiryakov%2Fwall-e","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkristiyankiryakov%2Fwall-e/lists"}