{"id":27634713,"url":"https://github.com/gren-95/bank-api","last_synced_at":"2026-05-03T05:43:39.736Z","repository":{"id":285619781,"uuid":"958766729","full_name":"Gren-95/bank-api","owner":"Gren-95","description":"A robust banking API implementation that supports internal and external (B2B) transactions, following the specifications provided in SPECIFICATIONS.md.","archived":false,"fork":false,"pushed_at":"2025-04-22T17:45:41.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T18:50:24.258Z","etag":null,"topics":["api","bank","homework-assignments","openapi","openapi3","peer-to-peer","school-project"],"latest_commit_sha":null,"homepage":"https://bank.bee-srv.me/docs/","language":"JavaScript","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/Gren-95.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,"zenodo":null}},"created_at":"2025-04-01T18:18:37.000Z","updated_at":"2025-04-22T17:45:44.000Z","dependencies_parsed_at":"2025-04-01T19:32:41.004Z","dependency_job_id":"0e6f8f45-1614-491a-b5c4-ea1a14e38e0b","html_url":"https://github.com/Gren-95/bank-api","commit_stats":null,"previous_names":["gren-95/bank-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gren-95%2Fbank-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gren-95%2Fbank-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gren-95%2Fbank-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gren-95%2Fbank-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gren-95","download_url":"https://codeload.github.com/Gren-95/bank-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250497092,"owners_count":21440255,"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":["api","bank","homework-assignments","openapi","openapi3","peer-to-peer","school-project"],"created_at":"2025-04-23T19:20:27.127Z","updated_at":"2026-05-03T05:43:39.709Z","avatar_url":"https://github.com/Gren-95.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bank API\n\nA robust banking API implementation that supports internal and external (B2B) transactions, following the specifications provided in `SPECIFICATIONS.md`.\n\n## Features\n\n- **Account Management**\n  - Create and manage bank accounts\n  - Support for multiple currencies (EUR, USD, GBP)\n  - Account balance tracking\n  - Transaction history\n\n- **Transaction Processing**\n  - Internal transfers between accounts\n  - External (B2B) transfers between banks\n  - Currency conversion support\n  - Transaction status tracking\n\n- **Security**\n  - JWT-based authentication\n  - RSA key pair management\n  - JWKS (JSON Web Key Set) support\n  - Rate limiting\n  - Input validation\n\n- **Resilience**\n  - Retry logic for external transfers\n  - Comprehensive error handling\n  - Detailed logging\n  - Transaction status tracking\n\n## Prerequisites\n\n- Node.js (v14 or higher)\n- npm (v6 or higher)\n- MongoDB (for data storage)\n\n## Environment Variables\n\nCreate a `.env` file with the following variables:\n\n```env\nPORT=9000\nMONGODB_URI=mongodb://localhost:27017/bank-api\nJWT_SECRET=your-secret-key\nBANK_PREFIX=your-bank-prefix\n```\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/Gren-95/bank-api\ncd bank-api\n```\n\n1. Cope example env to production\n\n```bash\ncp .env.example .env\n```\n\n\n1. Start the server (dependencies are installed at start):\n\n```bash\nnpm start\n```\n\nThe API will be available at `http://localhost:9000`\n\n## Running as a Service (Optional)\n\nTo run the API as a systemd service, create a service file at `/etc/systemd/system/bank-api.service`:\n\n```ini\n[Unit]\nDescription=Bank API Service\nAfter=network.target\n\n[Service]\nWorkingDirectory=/public/bank-api\nExecStart=/bin/sh -c 'npm start'\nRestart=always\n\n[Install]\nWantedBy=multi-user.target\n```\n\nThen enable and start the service:\n\n```bash\nsudo systemctl enable bank-api\nsudo systemctl start bank-api\n```\n\nCheck the service status:\n\n```bash\nsudo systemctl status bank-api\n```\n\n## API Documentation\n\nAPI documentation is available at `http://localhost:9000/docs` when the server is running.\n\n### Key Endpoints\n\n- `POST /auth/login` - User authentication\n- `POST /accounts` - Create new account\n- `GET /accounts/:id` - Get account details\n- `POST /transactions/internal` - Process internal transfer\n- `POST /transactions/b2b` - Process external (B2B) transfer\n- `GET /transactions/:id` - Get transaction details\n- `GET /transactions/jwks` - Get bank's public keys (JWKS)\n\n## B2B Transaction Flow\n\n1. **Sending Bank**\n   - Creates JWT with transaction details\n   - Signs JWT with private key\n   - Sends to receiving bank\n\n2. **Receiving Bank**\n   - Verifies JWT using sender's public key\n   - Validates transaction details\n   - Processes transaction if valid\n   - Returns success/failure response\n\n## Error Handling\n\nThe API implements comprehensive error handling:\n\n- HTTP Status Codes\n  - 200: Success\n  - 201: Created\n  - 400: Bad Request\n  - 401: Unauthorized\n  - 403: Forbidden\n  - 404: Not Found\n  - 402: Payment Required\n  - 500: Server Error\n\n- Detailed Error Messages\n  - Validation errors\n  - Authentication failures\n  - Transaction processing errors\n  - External service errors\n\n## Logging\n\nThe API implements detailed logging for:\n\n- Authentication attempts\n- Transaction processing\n- External service interactions\n- Error scenarios\n- JWT verification\n- Currency conversions\n\n## Security Features\n\n- JWT-based authentication\n- RSA key pair management\n- JWKS support for B2B transactions\n- Rate limiting\n- Input validation\n- Secure password handling\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgren-95%2Fbank-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgren-95%2Fbank-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgren-95%2Fbank-api/lists"}