Skip to content

fecaps-org/financial-control-api

Repository files navigation

Financial Control Web API

Pre requisites:

Infrastructure Setup

Stateful resources are defined with Terraform, so in order to create/change the resources follow the steps below.

REQUIREMENTS:

  • In order to fully create the infrastructure in AWS it's required to setup this project within an Organization in GitHub, as Terraform has a limitation to setup a WebHook in a personal project, see more here

  • It's required to create a Personal Access Token in GitHub in order to use the environment variable repositoryAccessToken in Terraform configurations. See more here


  • Create terraform.tfvars file and update it based on your needs:
$ cd infrastructure && \
cp terraform.tfvars.dist terraform.tfvars

  • Create resources:
$ terraform validate && \
terraform init && \
terraform apply

  • Stateful resources created:

    • AWS Code Pipeline (with a GitHub WebHook)
    • AWS Code Build
    • AWS Dynamo DB
    • AWS Kinesis Data Stream
    • AWS SNS

Continuous Delivery

After running the Terraform command above, the CI/CD will be ready.

With the CI/CD in place, all pushes to master will be automatically deployed.

CI/CD

Application Setup

  • Installing dependencies:
$ npm i

  • Copy .env.dist file and edit them based on your needs:
$  cp .env.dist .env

  • Running seeders:

Obs.: The stateful resources must be created BEFORE running this seed command

Obs.1: This command must be executed only once

$ npm run seed

Architecture

Project Architecture

Debug

Intellij IDEs

  • Download workspace.xml file in the ide-configs directory

  • Copy and paste it to {{PROJECT_ROOT}}/.idea (or update your .idea/workspace.xml file)

  • Restart IDE

  • Check debugger configurations

Code Style

  • Check style:
$ npm run checkStyle

  • Fix style:
$ npm run fixStyle

Tests

  • Run tests:
$ npm test

  • Run tests with Debugger (port 9300):
$ npm run testDebugger

Usage

  • Deploying:

** Unnecessary, unless willing to deploy without pushing the code to master

$ chmod +x ./build.sh && \
./build.sh deploy dev

  • Run a function locally:
$ FUNCTION_NAME=get-categories npm run invokeFunction

Next Steps

  • After having a Web APP for the application, setup AWS Cognito
  • Change Cloudwatch logs to ELK
  • Add X-Ray
  • Check functions permissions

About

Financial Control Web API with Serverless (AWS Lambda)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published