The Ledger API is designed for managing ledger accounts, providing functionality for depositing funds, transferring funds between accounts, checking account balances, and retrieving the transfer history.
To get started with the Ledger API, follow the steps below:
- Docker - Make sure you have Docker installed to run the required services.
- Go - Install Go for building and running the API.
- PostgreSQL - Install PostgreSQL as the database for the API.
- Redis - Install Redis for caching purposes.
-
Clone the repository:
git clone https://github.com/julioc98/ledger.git cd ledger
-
Run the database migrations:
make migrate-up
-
Start the API:
make run
The API will be accessible at http://localhost:3000. Explore the API using Swagger documentation available at http://localhost:3000/swagger.
make docker-run
: Run the API in a Dockerized environment.make migrate-up
: Run PostgreSQL database migrations.make run
: Build and run the API.make docker-tests-up
: Set up Dockerized test environment.make migrate-tests
: Run migrations for the test database.make test
: Run the API tests.
POST /api/v1/account/{account}/deposit
Deposit funds into a ledger account.
POST /api/v1/account/{account}/transfers
Transfer funds from one ledger account to another.
GET /api/v1/account/{account}/balance
Retrieve the balance of a ledger account.
GET /api/v1/account/{account}/transfers
Retrieve the transfer history of a ledger account.
The API can be configured using environment variables.
Contributions are welcome! Feel free to open issues or submit pull requests to improve the Ledger API.