Giter Site home page Giter Site logo

monetr / rest-api Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 3.9 MB

REST API powering our budgeting application.

Home Page: https://docs.monetr.dev

License: Other

Go 94.81% Dockerfile 0.15% Makefile 2.05% Shell 0.30% Smarty 0.28% PLpgSQL 0.19% HCL 0.49% HTML 1.73%
budgeting finance

rest-api's Introduction

rest-api

Gitlab pipeline status (self-hosted) DeepSource DeepSource FOSSA Status

image

This is the REST API behind monetr's budgeting application.

API documentation can be found here: https://docs.monetr.dev/

Documentation is automatically generated with each commit to the main branch.

Developing Locally

This is still a work in progress, but the entire REST API stack can be run locally and entirely in minikube. This has been mostly automated and can be initiated by running the following command:

make init-mini

You will be prompted once for your password in a window; this is to add the certificate as trusted to macOS.

This will allow you to access the REST API via https://api.monetr.mini.

NOTE: This is still being tuned and is subject to change significantly. This also requires the following to be installed on your computer.

  • minikube
  • docker (Docker for Desktop not required)
  • hyperkit
  • kubectl
  • openssl (not the LibreSSL version)

To my knowledge this also only currently works on macOS. But I plan on making it work on Linux in the future as well. There are some other tools that this make target relies on, but if they are not already present on your computer then they will be downloaded and installed into you $API_PROJECT_FOLDER/bin directory.

Running init-mini will also create a certificate to be used for TLS locally. On macOS this is added to your keychain as a trusted certificate so that way TLS will work locally as if it were in a real environment. This and anything else that is done as part of running init-mini can be un-done by running the following command:

make clean-mini

This will remove all of the generated files, trusted certificates, and dependencies that were pulled for running locally. It will also delete your minikube cluster to make sure the environment is completely clean.

Seeing Your Changes

As you make changes to the code you can deploy your changes to the local minikube cluster by running:

make deploy-mini-application

This will build a new docker image from your current code as well as evaluate any changes made to the values.local.yaml file in your project directory and push those changes to minikube.

If you want to do step debugging there is a shortcut in the makefile to do so. You will need to create a config.yaml file in your project directory with all the same settings you have specified in your values.local.yaml for everything to work properly. Once you have done that you can run the command below:

make local-api

This will spawn a new tmux window with a minikube tunnel in it. This is needed for the API to talk to the services it needs within the minikube cluster. This will also swap out the target for the API service in kubernetes with an endpoint pointed at your computer and at port 4000. This way you can run a REST API instance locally through something like GoLand or VSCode and step debug API requests directly.

Testing Webhooks

The API is meant to receive webhooks from both Plaid and Stripe as part of its normal functionality. To help make development for these APIs easier I have added an ngrok deployment that will allow external services to send requests to your local REST API instance running in minikube.

To enable this for local development run:

make webhooks-mini NGROK_AUTH=${YOUR_NGROK_TOKEN}

This will deploy ngrok locally within the minikube cluster and will forward traffic to the REST API service. You can see the ngrok inspector at https://ngrok.monetr.mini after this command has been run.

To disable webhooks if you have enabled them:

make disable-webhooks-mini

This will update the values.local.yaml in your project directory and disable the webhook settings, it will then redeploy the REST API to minikube using the updated values file. Then it will delete the ngrok service that was previously deployed.

License

FOSSA Status

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.