{"id":22678412,"url":"https://github.com/web2solutions/arithmetic-calculator-api","last_synced_at":"2026-04-11T01:04:08.257Z","repository":{"id":177113982,"uuid":"659031935","full_name":"web2solutions/arithmetic-calculator-api","owner":"web2solutions","description":"REST API built Serverless, Typescript, Node, MongoDB, Redis, Jest, AWS Lambda, Docker, etc","archived":false,"fork":false,"pushed_at":"2024-03-16T12:27:57.000Z","size":2396,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-04T13:44:41.279Z","etag":null,"topics":["aws","aws-lambda","javascript","jest","mongodb","nodejs","serverless","serverless-framework","tdd","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/web2solutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-27T02:32:37.000Z","updated_at":"2024-12-21T23:13:53.000Z","dependencies_parsed_at":"2023-11-22T23:24:15.511Z","dependency_job_id":"7aa8d79d-49cc-4393-9579-2c1d2db14897","html_url":"https://github.com/web2solutions/arithmetic-calculator-api","commit_stats":null,"previous_names":["web2solutions/arithmetic-calculator-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web2solutions%2Farithmetic-calculator-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web2solutions%2Farithmetic-calculator-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web2solutions%2Farithmetic-calculator-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web2solutions%2Farithmetic-calculator-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web2solutions","download_url":"https://codeload.github.com/web2solutions/arithmetic-calculator-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246187242,"owners_count":20737462,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","javascript","jest","mongodb","nodejs","serverless","serverless-framework","tdd","typescript"],"created_at":"2024-12-09T18:15:12.931Z","updated_at":"2026-04-11T01:04:08.213Z","avatar_url":"https://github.com/web2solutions.png","language":"TypeScript","readme":"\n# Arithmetic Calculator API\n\nThis is a simple REST API built as coding challenge made for [TrueNorth](https://www.truenorth.co/).\n\nSee the [requirement's list](./TrueNorth_LoanPro_Coding_Challenge.pdf).\n\n`CircleCI status:`\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/web2solutions/arithmetic-calculator-api/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/web2solutions/arithmetic-calculator-api/tree/main) main\n\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/web2solutions/arithmetic-calculator-api/tree/dev.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/web2solutions/arithmetic-calculator-api/tree/dev) dev\n\n`Coverage`\n\n\u003ca href=\"https://codecov.io/gh/web2solutions/arithmetic-calculator-api\" \u003e \n \u003cimg src=\"https://codecov.io/gh/web2solutions/arithmetic-calculator-api/branch/main/graph/badge.svg?token=MC5LUHIUGS\"/\u003e \n \u003c/a\u003e\n\n[![codecov](https://codecov.io/gh/web2solutions/arithmetic-calculator-api/branch/main/graphs/sunburst.svg?token=MC5LUHIUGS)](https://codecov.io/web2solutions/arithmetic-calculator-api)\n\n\n\n## Stack\n\n* Node.js\n* TypeScript\n* MongoDB and Mongo Atlas as Database\n* Redis and Redis Labs as Cache layer\n* Jest\n* AWS lambda\n* Eslint\n* Docker\n* serverless and serverless-offline\n\n## Preparing the development environment using your current NodeJS installation\n\nYou need to install the project first:\n\n```bash\nnpm install\n```\n\nBefore running the API, you must have Mongo and Redis installed first.\n\nYou can manually install them, or, you can use docker to install it by running:\n\n```bash\nnpm run docker:compose:daemon\n```\n\n### Testing using local Mongo and Redis services\n\nYou probably want to run the current test suite implementation:\n\n```bash\nnpm test:dev \n```\n\n### Running the application on local environment\n\n`It is recommended to set the NODE_ENV env var value to 'dev'`\n\n```bash\nexport NODE_ENV=dev\n```\n\nAdd some users and operations to the database:\n\n```bash\nnpm run data:seed:dev\n```\n\nAn then you can start the dev environment by running:\n\n```bash\nnpm run local:start:dev\n```\n\nYou can do login as admin user through the API by using curl:\n\n```bash\ncurl -X POST http://localhost:3000/dev/users/login -H \"Content-Type: application/json\" -d '{\"username\": \"admin@admin.com\", \"password\": \"123456\"}'  \n```\n\n## Managing Mongo and Redis using Docker\n\n```bash\nnpm run docker:compose:daemon\n```\n\n`Stop Docker environment`\n\n```bash\nnpm run docker:stop\n```\n\n`Restart Docker environment`\n\n```bash\nnpm run docker:restart\nnpm run docker:clean\n```\n\n`Clean Docker environment`\n\n```bash\nnpm run docker:clean\n```\n\n## Testing on CI\n\nWhen running on CI, the API connects to Mongo Atlas and Redis Labs.\n\nPlease make sure you have the proper accounts.\n\nYou can create for free, both accounts at https://redis.com/try-free/ and https://www.mongodb.com/cloud/atlas/register .\n\nSetup the following env vars on CI platform:\n\n```bash\n  NODE_ENV=\"ci\"\n  \n  CODECOV_TOKEN=\"xxxxxxx\" # for codecov service\n  \n  TOKEN_KEY=\"mysecret\" # for jwt token\n\n  REDIS_HOST_LABS=\"redis-16050.c10.us-east-1-2.ec2.cloud.redislabs.com\"\n  REDIS_PASSWORD_LABS=\"........\"\n  REDIS_PORT_LABS=16050\n\n  MONGO_ATLAS_URL=\"mongodb+srv://username:password@cluster0.mie7dav.mongodb.net/?retryWrites=true\u0026w=majority\"\n  MONGO_DATABASE=\"arithmetic_calculator_api\"\n```\n\nRun the default `npm test command` to run the test suite for CI.\n\n```bash\nnpm test\n```\n\n## Deploy\n\n### Environment Config\n\nBy default the application will assume the following stage names and config files:\n\n* test\n* prod\n* stg\n\nEach one of those will required a related config file:\n\n* ./config/.env.test\n* ./config/.env.prod\n* ./config/.env.stg\n\nUse the following template:\n\n```bash\nTOKEN_KEY=mysecret\n\nREDIS_HOST_LABS=\"redis-16050.c10.us-east-1-2.ec2.cloud.redislabs.com\"\nREDIS_PASSWORD_LABS=\"password\"\nREDIS_PORT_LABS=16050\n\nMONGO_ATLAS_URL=\"mongodb+srv://username:password@cluster0.mie7dav.mongodb.net/?retryWrites=true\u0026w=majority\"\nMONGO_DATABASE=\"arithmetic_calculator_api\"\n```\n\n### Deploy on AWS, simply run\n\n```bash\n$ npm run deploy\n\n# or\n\n$ serverless deploy\n```\n\n## Usage\n\nsend an HTTP request directly to the endpoint using a tool like curl\n\n```bash\ncurl https://je6x0x8fa6.execute-api.us-east-2.amazonaws.com/test/users\n```\n\n## Scaling\n\nBy default, AWS Lambda limits the total concurrent executions across all functions within a given region to 1000. The default limit is a safety limit that protects you from costs due to potential runaway or recursive functions during initial development and testing. To increase this limit above the default, follow the steps in [To request a limit increase for concurrent executions](http://docs.aws.amazon.com/lambda/latest/dg/concurrent-executions.html#increase-concurrent-executions-limit).\n\n## Project Tech Debits\n\n1. Improve code coverage\n2. Implement test suite for unit testing.\n3. Implement test suite for e2e testing.\n4. Adopt the Data Repository Pattern.\n5. 100% Ensure the SOLID principles.\n6. Implement API documentation - swagger OAS.\n7. APM with datadog - custom error classes in 2 levels: service and controller\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb2solutions%2Farithmetic-calculator-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb2solutions%2Farithmetic-calculator-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb2solutions%2Farithmetic-calculator-api/lists"}