{"id":19946897,"url":"https://github.com/nitinn77/instagram-backendapi","last_synced_at":"2026-05-15T07:32:58.049Z","repository":{"id":164025660,"uuid":"415277264","full_name":"NitinN77/Instagram-BackendAPI","owner":"NitinN77","description":"A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.","archived":false,"fork":false,"pushed_at":"2021-10-10T03:01:30.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T14:17:41.732Z","etag":null,"topics":["golang","mongodb","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/NitinN77.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":"2021-10-09T10:32:38.000Z","updated_at":"2021-10-10T03:14:57.000Z","dependencies_parsed_at":"2023-07-26T17:02:49.976Z","dependency_job_id":null,"html_url":"https://github.com/NitinN77/Instagram-BackendAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NitinN77/Instagram-BackendAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinN77%2FInstagram-BackendAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinN77%2FInstagram-BackendAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinN77%2FInstagram-BackendAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinN77%2FInstagram-BackendAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NitinN77","download_url":"https://codeload.github.com/NitinN77/Instagram-BackendAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NitinN77%2FInstagram-BackendAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33057873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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":["golang","mongodb","rest-api"],"created_at":"2024-11-13T00:33:15.576Z","updated_at":"2026-05-15T07:32:58.034Z","avatar_url":"https://github.com/NitinN77.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instagram-BackendAPI\n\nA Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.\n\n## External Dependencies\n\n- mongo-driver \n- godotenv (to handle secrets using environment variables, not required)\n\n## Directory Structure\n\n```\n├── go.mod\n├── go.sum\n├── helper\n│   └── connect.go\n├── main.go\n├── main_test.go\n└── models\n    └── models.go\n```\n- ``` go.mod, go.sum ``` Manages dependencies\n- ``` connect.go ``` Establishes a connection to the MongoDB clusters\n- ``` models.go ``` Defines the model objects\n- ``` main.go ``` Primary file to handle http requests \n- ``` main_test.go ``` Unit testing script \n\n## Endpoints\n\n#### ``` /api/posts ``` \ncreates a post using data from the POST request's body\n\n#### ``` /api/posts/\u003cid\u003e ``` \nfetches post details for the given id\n\n#### ``` /api/posts/users/\u003cid\u003e?limit={}\u0026lastid={} ``` \nfetches posts of the user with given id within a limit and with ids greater than lastid (if lastid is not null)\n\n#### ``` /api/users ```\ncreates a user and encrypts the password using ciphers before storing\n\n#### ``` /api/users/\u003cid\u003e ``` \nfetches user details of given id\n\n## Pagination\n\nThe API employs an id-based pagination for the  ``` /api/posts/users/\u003cid\u003e ``` endpoint. \nOn the initial call, the limit parameter must be passed along with the request. The API returns the requsted number of posts and the id of the last post. Subsequent calls \nfrom the front-end must also contain a ``` lastid ``` parameter with the id that was returned on the previous call. This ensures that the second call returns posts starting \nwith ids greater than the ``` lastid ``` , and that the API response doesn't explode in size.\n\n![](https://i.imgur.com/DOhl8Pc.png)\n\n## Testing\n\n![](https://i.imgur.com/vv4nVgj.png)\n\n## Usage\n\n1. clone the repo ``` git clone https://github.com/VoidlessVoid7/Instagram-BackendAPI . ```\n2. ``` go build main.go ```\n3. ``` go run ./ ```\n\n## Screenshots\n\n- Creating a post\n\n![](https://i.imgur.com/3X7lqst.png)\n\n- Fetching a post\n\n![](https://i.imgur.com/n6H3WjF.png)\n\n- Create a user\n\n![](https://i.imgur.com/f1EPfqO.png)\n\n- Fetch a user\n\n![](https://i.imgur.com/GlOGzhu.png)\n\n- Fetch posts created by a user\n\n![](https://i.imgur.com/SKz48ya.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitinn77%2Finstagram-backendapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitinn77%2Finstagram-backendapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitinn77%2Finstagram-backendapi/lists"}