{"id":50927459,"url":"https://github.com/skatesham/api-users-node-mongo","last_synced_at":"2026-06-17T00:04:24.913Z","repository":{"id":63907919,"uuid":"378266707","full_name":"skatesham/api-users-node-mongo","owner":"skatesham","description":"API with Node and Mongoose","archived":false,"fork":false,"pushed_at":"2022-11-28T18:25:03.000Z","size":182,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-07T06:17:29.538Z","etag":null,"topics":["express","heroku","mongodb","mongoose","node","rest-api","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/skatesham.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}},"created_at":"2021-06-18T21:18:27.000Z","updated_at":"2022-11-28T18:13:30.000Z","dependencies_parsed_at":"2022-11-28T22:46:29.565Z","dependency_job_id":null,"html_url":"https://github.com/skatesham/api-users-node-mongo","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/skatesham/api-users-node-mongo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatesham%2Fapi-users-node-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatesham%2Fapi-users-node-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatesham%2Fapi-users-node-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatesham%2Fapi-users-node-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skatesham","download_url":"https://codeload.github.com/skatesham/api-users-node-mongo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skatesham%2Fapi-users-node-mongo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34428199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["express","heroku","mongodb","mongoose","node","rest-api","swagger-ui"],"created_at":"2026-06-17T00:04:24.084Z","updated_at":"2026-06-17T00:04:24.895Z","avatar_url":"https://github.com/skatesham.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Node and MongoDB with connection using Mongoose\nAPI with Node and Mongoose.  \n- The default production git branch is `master`.\n- The web server is running with Node and Express.\n- The database configured is MongoDB and \"driver\" is Mongoose.\n- The authentication is JWT (Json Web Token).\n- The web listener only starts after database connect.\n- The New Relic dependency is added, and so on if you don't want configure remove `require` of new relic on `app.js`.\n\n## 1. Deployment\n\n### Deploy to heroku with heroku ClI\n\nInstalling Heroku CLI:\n```bash\nsudo snap install --classic heroku\n```\n\nLogin on Heroku CLI, configure project and star deploy. You must change every app name `bcg-node-mongo-api` as a unique name.\n```bash\nheroku login\nheroku create bcg-node-mongo-api\ngit push heroku master\n```\n##### Obs: If already created heroku dyno you can configure as `heroku git:remote -a bcg-node-mongo-api` \n\n### Configure Heroku Dyno environment variables\nMust configure on Heroku Dashboard the configured environment variables or with Heroku CLI as `heroku config:set ATTRIBUTE_NAME=value`\n\n### Configure New Relic on Heroku \nConfiguring without the newrelic.js file, can be done by following config environment variable, with properly attributes.  \n##### Obs: Add-on New Relic from Heroku has a free mode that is called \"wayne\".\n```bash\nheroku addons:create newrelic:wayne -a bcg-domain-core\n\nheroku config:set NEW_RELIC_LICENSE_KEY=\u003cAdd your license key\u003e\nheroku config:set NEW_RELIC_APP_NAME=\u003cInsert your app name\u003e\n```\n\n## 2. Development\n\n### Running local database\nRun command on project source folder as following:\n```bash\ndocker-compose up -d\n```\n\n### Configure Environment Variable\nYou can create environment variables manually or create a file `.env` copy as `.env.example` and fulfill as needed.\n\nOn for configure `MONGO_URI` follow the file `env.example` and you should configure the IP Address of container docker. For this, run:\n\n```bash\ndocker inspect \u003cid or name container\u003e | grep \"IPAddress\"\n```\nGet the value as `172.25.0.3` and replace ip on `MONGO_URI`.  \n\n##### Observation: Find docker container id or name on `docker ps` identified with image `mongo`.\n\n### Configure database credentials\nWe'll go inside docker container, connect to MongoDB as root, create a user for app connection. Run this command:\n```bash\ndocker exec -i -t \u003cid or name container\u003e /bin/bash\n\nmongodb -u- root -p\n# password: example\n\nuse bcg\ndb.createUser(\n{\n    user: \"user_db\",\n    pwd: \"password_db\",\n    roles: [ \n        { role: \"readWrite\", db: \"bcg\" }\n    ]\n})\n```\n\n### Running application\n\nGenerate Swagger Documentatio and run as dev\n```bash\nnpm run swagger\n```\n \nRun as monitor\n```bash\nnpm run dev\n```\n\n### Swagger URL\nThe port can change as the `PORT` environment variable changes.  \nhttp://localhost:3000/docs\n\n### Manage database data with GUI mode\n\nManagement with MongoDB Express, available on http://localhost:8081/.\n\n### Available scripts\n\n```json\n{\n    \"dev\": \"nodemon app.js\",\n    \"start\": \"node app.js\",\n    \"swagger-autogen\": \"rm -rf swagger-api-specification.json \u0026\u0026 node swagger.js\",\n    \"swagger\": \"npm run swagger-autogen \u0026\u0026 npm run dev\"\n}\n```\n\n## 3. Monitoriment\n\nReporting throght New Relic.  \n You'll must search for the app on New Relic APM Dashboard.\n Access on https://newrelic.com/, or direct link to [Dashbord ATM](https://one.newrelic.com/-/0LkjnPvq1wo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskatesham%2Fapi-users-node-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskatesham%2Fapi-users-node-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskatesham%2Fapi-users-node-mongo/lists"}