hasAnybodySeenHarry / expenses

Expenses Service: Part of the Debt Tracker ecosystem, this service handles user and debt management. It interfaces with the mailer, throttler, and notifier services.
Other
15 stars 0 forks source link

Debt Tracker

A simple platform designed to keep track of debts; how much you owe, how much is expected to be received, and the history of debts given and received. This project consists of five applications, four of which are written in Go, and the frontend is built with React.

System Architecture

graph TD
    style ReactApp fill:#2196F3,stroke:#1976D2,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style ReverseProxy fill:#2196F3,stroke:#1976D2,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Expenses fill:#66BB6A,stroke:#388E3C,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Throttler fill:#FFB74D,stroke:#F57C00,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Mailer fill:#AB47BC,stroke:#8E24AA,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Notifier fill:#A1887F,stroke:#6D4C41,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Postgres fill:#B3E5FC,stroke:#039BE5,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Redis fill:#FFCDD2,stroke:#E57373,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style MongoDB fill:#FFE082,stroke:#FFC107,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style AMQP fill:#FFF59D,stroke:#FBC02D,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style Kafka fill:#CE93D8,stroke:#AB47BC,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style RedisPubSub fill:#FFCDD2,stroke:#E57373,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10
    style CloudEmail fill:#EF9A9A,stroke:#E57373,stroke-width:2px,color:#333,font-size:14px,rx:10,ry:10

    subgraph Frontend
        ReactApp[React Client]
    end

    subgraph Backend
        ReverseProxy[Reverse Proxy]
        Expenses[Expenses Service]
        Throttler[Throttler Service]
        Mailer[Mailer Service]
        Notifier[Notifier Service]
    end

    subgraph Databases
        Postgres[Postgres Database]
        Redis[Redis]
        MongoDB[MongoDB]
    end

    subgraph Messaging
        AMQP[AMQP Proxy]
        Kafka[Kafka]
        RedisPubSub[Redis Pub/Sub]
    end

    subgraph ExternalServices
        CloudEmail[Cloud Email Service]
    end

    %% Define connections with labels and directions
    ReactApp -- HTTP --> ReverseProxy
    ReverseProxy -- HTTP --> Expenses
    Expenses -- User Data --> Postgres
    Throttler -- gRPC --> Expenses
    Throttler -- Rate Limit Buckets --> Redis
    Mailer -- Fetch Jobs --> AMQP
    Expenses -- AMQP --> AMQP
    Mailer -- Send Emails --> CloudEmail
    Expenses -- Send Events --> Kafka
    Notifier -- Consume Events --> Kafka
    Notifier -- Store Notifications --> MongoDB
    Notifier -- Pub/Sub --> RedisPubSub
    ReactApp -- WebSocket --> ReverseProxy
    ReverseProxy -- WebSocket --> Notifier
    Notifier -- gRPC --> Expenses
    Notifier -- WebSocket --> ReactApp
    ReverseProxy -- HTTP --> Throttler
    Expenses -- HTTP --> ReactApp

    %% Style links
    linkStyle 0 stroke:#1976D2,stroke-width:2px
    linkStyle 1 stroke:#1976D2,stroke-width:2px
    linkStyle 2 stroke:#388E3C,stroke-width:2px
    linkStyle 3 stroke:#F57C00,stroke-width:2px
    linkStyle 4 stroke:#F57C00,stroke-width:2px
    linkStyle 5 stroke:#8E24AA,stroke-width:2px
    linkStyle 6 stroke:#388E3C,stroke-width:2px
    linkStyle 7 stroke:#8E24AA,stroke-width:2px
    linkStyle 8 stroke:#388E3C,stroke-width:2px
    linkStyle 9 stroke:#6D4C41,stroke-width:2px
    linkStyle 10 stroke:#6D4C41,stroke-width:2px
    linkStyle 11 stroke:#6D4C41,stroke-width:2px
    linkStyle 12 stroke:#1976D2,stroke-width:2px
    linkStyle 13 stroke:#1976D2,stroke-width:2px
    linkStyle 14 stroke:#6D4C41,stroke-width:2px
    linkStyle 15 stroke:#6D4C41,stroke-width:2px
    linkStyle 16 stroke:#1976D2,stroke-width:2px
    linkStyle 17 stroke:#388E3C,stroke-width:2px

Table of Contents

Overview

This platform allows users to manage their debts and transactions efficiently. Users can record debts, monitor what is owed, and see a detailed history of transactions. The backend services are containerized and orchestrated using Kubernetes, with Helm Charts facilitating deployment.

Applications

Expenses Service

The Expenses Service is the core of the platform. It handles:

Mailer Service

The Mailer Service is responsible for sending emails, such as OTPs, to users. It:

Throttler Service

The Throttler Service provides centralized rate limiting. It:

Notifier Service

The Notifier Service handles real-time notifications. It:

Frontend Application

The Frontend Application is a React-based web application. It serves as the user interface, allowing users to interact with the platform. This app communicates primarily with the Expenses Service for user and debt management routed via a reverse proxy.

Infrastructure

The platform's infrastructure is containerized and deployed on Kubernetes. Key components include:

CI/CD Pipeline

Future Plans

Getting Started

To set up the project locally, follow these steps:

1. Clone the Repository

First, clone the repository using Git:

git clone https://github.com/hasAnybodySeenHarry/cluster
cd cluster

2. Install ArgoCD

Before deploying the infrastructure, you need to install ArgoCD. Follow the official ArgoCD installation guide for instructions.

3. Install Helm

Ensure Helm is installed on your system. You can find installation instructions on the Helm website.

4. Install Helm Templates

Navigate to the application-infrastructure directory and install the Helm templates:

cd application-infrastructure
helm install my-infrastructure .

This will set up the necessary application infrastructure and associated secrets.

5. Deploy Kubernetes Manifests

Deploy the Kubernetes manifests located in the .init/ directory:

cd ..
kubectl apply -f .init/

These manifests will monitor and install the charts appropriately.

Alternative: Automated Setup

For a quicker setup, you can use the terra.sh script, which performs all the above steps automatically:

chmod +x terra.sh
./terra.sh

This script will handle everything from installing Argo, setting up the application dependencies, and deploying applications and necessary resources for you.

Contributing

Thank you for your interest in contributing to the Debt Tracker project. At this time, we are not accepting external contributions due to limited resources for code review and project maintenance. We appreciate your understanding.

We hope to reopen contributions in the future as resources allow.

License

This project is licensed under the GNU General Public License (GPL) v3.0. This means:

For more details, see the LICENSE file.

Acknowledgements

We would like to thank the following projects and organizations for their contributions and support:

Contact

For any questions or feedback, please contact us at harryd.io@proton.me.