Skip to content

Fundraiser Tracker implemented as AWS Lambda with ability to manage through Slack and autosync with Monobank and Privatbank

License

Notifications You must be signed in to change notification settings

yuriytkach/fundraiser-tracker

Repository files navigation

Fundraiser Tracker

An AWS Lambda application written in Quarkus uses DynamoDB as storage, exposes REST interface to get data and Slack command REST interface to manipulate data. Application supports currency conversion with rates obtained from Monobank API.

Additionally, application supports automatic synchronization of donations using Monobank and Privatbank sync by reacting to REST calls.

Codacy Badge Codacy Badge

Supported Slack commands

If you add a slash command to Slack (for example /fund) then the following commands are supported by the application.

Create new fund:

/fund create car eur 5000 /Banderomobil/ blue

Creates new fund with short name car (will be used to track donations) with goal of €5000, with full description Banderomobil and color blue (used in UI tracker)

/fund create dron usd 7000

Creates a new fund with short name and description dron with goal of $7000 and default color green on UI

Supported currencies: UAH, USD, EUR, PLN, GBP, CHF

Update fund:

/fund update car open|close curr:eur goal:5000 desc:/Banderomobil/ color:blue bank:account

Updates the attributes of fund with name car by specifying their names, colon and new values (see example above). All attributes are optional so that you can update only needed, but provider then in the above order.

  • open or close perform either enabling or disabling of fund.
  • bank can specify several accounts coma-separated.

Updatable attributes: currency(curr), goal(goal), description(desc), color(color), bank accounts(bank)

List all funds:

/fund list

Displays all created funds with status (how much raised)

Track donation:

/fund track car eur 500 Ivan 2022-05-12 14:15
/fund track car uah 500 Ivan 14:15             - track for today's date
/fund track car usd 500 Ivan                   - track for today's date and time
/fund track car usd 500                        - track for noname person

This will track donation for fund with short name car.

  • Any supported currency is allowed. Currency conversion takes place.
  • Date and time is optional.
  • Person name is optional. If not supplied, then noname is used.

Delete fund: Warning! This action cannot be undone! Use with caution!

/fund delete car

This will delete fund car with all recorded donations. Warning! - Cannot be undone!

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./gradlew quarkusDev

NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.

Packaging and running the application

The application can be packaged using:

./gradlew build

It produces the quarkus-run.jar file in the target/quarkus-app/ directory. Be aware that it’s not an über-jar as the dependencies are copied into the build/quarkus-app/lib/ directory.

The application is now runnable using java -jar build/quarkus-app/quarkus-run.jar.

If you want to build an über-jar, execute the following command:

./gradlew build -Dquarkus.package.type=uber-jar

The application, packaged as an über-jar, is now runnable using java -jar build/*-runner.jar.

Creating a native executable

You can create a native executable using:

./gradlew build -Dquarkus.package.type=native

Or, if you don't have GraalVM installed, you can run the native executable build in a container using:

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true

You can then execute your native executable with: ./build/code-with-quarkus-1.0.0-SNAPSHOT-runner

Running in AWS

You can manually create Lambda function in AWS from generated function.zip. Add the API Gateway for function's REST API.

You should also create DynamoDB funds table with indexes.

Additionally, you should create secret for Slack token and Privatbank token in AWS Systems Manager.

If you want to sync Privatbank on a regular basis then you can create Event in the AWS EventBridge that will call Lambda.

Related Guides

  • REST Client Classic (guide): Call REST services
  • YAML Configuration (guide): Use YAML to configure your Quarkus application
  • AWS Lambda Gateway REST API (guide): Build an API Gateway REST API with Lambda integration
  • Amazon DynamoDB (guide): Connect to Amazon DynamoDB datastore
  • RESTEasy Classic (guide): REST endpoint framework implementing Jakarta REST and more
  • Amazon Secrets Manager (guide): Connect to Amazon Secrets Manager