{"id":14969198,"url":"https://github.com/nikorasu-d/rest-api-fastify","last_synced_at":"2026-02-19T05:01:17.939Z","repository":{"id":248181777,"uuid":"826656995","full_name":"Nikorasu-d/rest-api-fastify","owner":"Nikorasu-d","description":"Simple Restful API (Only Endpoints) with Node.js, MongoDB and Fastify","archived":false,"fork":false,"pushed_at":"2024-08-06T02:35:32.000Z","size":99,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-22T07:34:34.077Z","etag":null,"topics":["api-template","fastify","rest-api","rest-api-template","restful-api","web-service-api"],"latest_commit_sha":null,"homepage":"https://rest-api-fastify.onrender.com/api/v2/todos/all","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nikorasu-d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-10T06:07:39.000Z","updated_at":"2025-09-16T01:01:33.000Z","dependencies_parsed_at":"2024-07-12T22:59:48.467Z","dependency_job_id":"aaf13c58-bf90-46ed-af44-5bbc78766446","html_url":"https://github.com/Nikorasu-d/rest-api-fastify","commit_stats":null,"previous_names":["nikorasu-d/rest-api-fastify"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Nikorasu-d/rest-api-fastify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikorasu-d%2Frest-api-fastify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikorasu-d%2Frest-api-fastify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikorasu-d%2Frest-api-fastify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikorasu-d%2Frest-api-fastify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nikorasu-d","download_url":"https://codeload.github.com/Nikorasu-d/rest-api-fastify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nikorasu-d%2Frest-api-fastify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29604107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T04:38:07.383Z","status":"ssl_error","status_checked_at":"2026-02-19T04:35:50.016Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-template","fastify","rest-api","rest-api-template","restful-api","web-service-api"],"created_at":"2024-09-24T13:41:19.938Z","updated_at":"2026-02-19T05:01:17.910Z","avatar_url":"https://github.com/Nikorasu-d.png","language":"JavaScript","readme":"## Simple Restful API (Only Endpoints) with Node.js, MongoDB and Fastify\n\nThis a Simple Restful API Template Project that you can use as a reference to learn the basics of **Restful API Development** with a different framework than [ExpressJS](https://expressjs.com/) in this case using [Fastify](https://fastify.dev/) to mount a web service\n\nThis is not a Course but i will expose some useful information if you want to build and test this project with your own [MongoDB](https://mongodb.com/) database\n\n### Preview of this project on render\n\nI've deployed this app previously on render, you can open this links to see the code in action\n\n\u003e[!IMPORTANT]\n\u003eIf you notice there is delay on the reply, please wait the free web service on render may shutdown the server when there is no use\n\n- [GET ALL](https://rest-api-fastify.onrender.com/api/v2/todos/all)\n- [GET Hola Mundo desde MongoDB :)](https://rest-api-fastify.onrender.com/api/v2/todos/66a2aae01ee82cd2142b742a)\n- You need an API key to test **POST, PUT AND DELETE**, so test this locally please\n\n\u003e [!WARNING]\n\u003e I'm assuming you have a MongoDB database already mounted locally or you have a MongoDB Atlas Cluster, if you haven't, please create one\n\n### To Mount this Project you will need:\n\n- NodeJS\n- Npm\n- MongoDB Atlas Cluster or MongoDB **(Locally or in your own Server)**\n- Git\n- Text Editor **(VS Code)**\n\n## First Steps\n\n1. If you don't have it, please install Node.js [\u003e\u003e Here](https://nodejs.org)\n2. If you dont have it, please Install Git [\u003e\u003e Here](https://git-scm.com/downloads)\n\n\u003e[!Important]\n\u003eIs a must have to install this tools, then restart your PC\n\n### Once you do the Must have:\n\nYou need to create a folder where you want to clone this repo, i suggest to create a git folder on your personal user home: ```C:/users/\u003cyour_user\u003e/git```\n\nThen open the created folder and once you are in, open a **Terminal / CMD / Git Bash / Bash** and type:\n\n```bash\ngit clone https://github.com/Nikorasu-d/rest-api-fastify.git\n```\n\nThis will clone the repo and you will have access to this project locally 🍻\n\n\n### Second Steps\n\nNow you have everything installed open the Project folder, if you have done following my instructions the route will be ```C:/users/\u003cyour_user\u003e/git/rest-api-fastify```\n\nOpen a terminal and install the dependencies from the Package.json with the following command:\n\n```bash\nnpm install\n```\n\nThis is gonna create the node_modules folder, when everything is installed, execute this just in case of any problem with nodemon:\n\n```bash\nnpm install nodemon --save-dev\n```\n\n### Last Steps\n\nThen the last step to have everything ready with the backend project is to include the env file. To do this you need to open the project folder with the text editor of your preference.\n\nWhen you can see all the files you need to create a file without extension called **.env** \n\n**Will to look like this:**\n\n```bash\n./--\n    node_modules\n    src\n        config\n            env.js\n            database.js\n        model\n            todo.js\n        controller\n            todoController.js\n        routes\n            v2\n                commonRoutes.js\n        services\n            todoService.js  \n    index.js     \n    .gitignore\n    package-lock.json\n    package.json\n    README.md\n    .env  -\u003e You need to create this file\n```\n\nInside this file you need to add the following code and complete the info with the route to your database\n\n```python\n\nCON_STR = \"your_connection_string\"\nAPI_KEY = \"choose a password for post, put and delete\"\nDB = \"name of your database\"\nCOLLECTION = \"name of your collection\"\nHOST = \"default localhost\"\nPORT = \"default 3000\"\n\n```\n\n### Build your project 🍾\n\nOnce you complete the previous configuration, you're ready to test it, to do that just open a terminal inside the project folder and run any of this scripts:\n\n```bash\n\nnpm run dev  -\u003e this one gonna launch nodemon index.js\nnpm run start  -\u003e this one gonna launch node index.js\n\n```\n\u003e[!NOTE]\n\u003e If you want to develop changes over the code use dev, this one is going to use nodemon and you will be able to see changes in real time if you make a save when the server is running\n\n### For those who wants to deploy this API on [Render](render.com)\n\nMake sure to create a new repo on your github, make a push to it, create a web service on render and connect to it, i will leave a code to make the git push easier:\n\n```bash\n// Make sure to Copy this code line by line on your terminal\n\ngit remote remove origin\ngit remote add \u003cthe_url_of_your_repo\u003e\ngit add .\ngit commit -m \"First commit\"\ngit branch -M main\ngit push origin main\n```\n\u003e[!IMPORTANT]\n\u003e When you're ready please take care of include all the env variables you have on **.env** changing HOST to 0.0.0.0 into the environment variables panel when you config your web service on **RENDER**:\n\n```bash\n\nHOST = 0.0.0.0\n\n```\n\n\n### END\n\nPlease leave a star if you like this project and follow me, you can always fork this project and suggest changes if you want 🫂\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikorasu-d%2Frest-api-fastify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikorasu-d%2Frest-api-fastify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikorasu-d%2Frest-api-fastify/lists"}