{"id":20930056,"url":"https://github.com/kasim95/web_backend_project_2","last_synced_at":"2026-04-16T04:02:01.423Z","repository":{"id":67676857,"uuid":"254761373","full_name":"kasim95/Web_Backend_Project_2","owner":"kasim95","description":"Backend API to save, retrieve and filter posts \u0026 votes built using Python, DynamoDB \u0026 Redis and served using a Reverse Proxy Server","archived":false,"fork":false,"pushed_at":"2020-05-06T01:12:24.000Z","size":39971,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-31T22:43:37.748Z","etag":null,"topics":["dynamodb","python","python3","redis","rss"],"latest_commit_sha":null,"homepage":"","language":"Python","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/kasim95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-04-11T00:14:37.000Z","updated_at":"2020-12-05T07:48:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"3cb82bf5-faab-43e2-a2e5-fdcce32f1597","html_url":"https://github.com/kasim95/Web_Backend_Project_2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kasim95/Web_Backend_Project_2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FWeb_Backend_Project_2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FWeb_Backend_Project_2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FWeb_Backend_Project_2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FWeb_Backend_Project_2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kasim95","download_url":"https://codeload.github.com/kasim95/Web_Backend_Project_2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kasim95%2FWeb_Backend_Project_2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["dynamodb","python","python3","redis","rss"],"created_at":"2024-11-18T21:28:37.154Z","updated_at":"2026-04-16T04:02:01.395Z","avatar_url":"https://github.com/kasim95.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPSC 449 Web Backend Engineering\r\n## Project-2\r\n### Project Members:\r\n* Mohammed Kasim Panjri (kasimp@csu.fullerton.edu) | Role: Dev 1\r\n* Harlik Shah (shahharlik@csu.fullerton.edu) | Role: Dev 2\r\n* Raj Chhatbar (chhatbarraj@csu.fullerton.edu) | Role: Dev 3\r\n\r\n\r\nHere we have used Reddit API to retrieve posts from Reddit. These posts are used to populate the DynamoDB posts table and Redis votes table key-value store.\r\n\r\nThe uuid used is generated using Python uuid module and then converted to base36 encoding similar to how Reddit generates their ids.\r\nAll other attributes are retrieved from the API itself.\r\n\r\nAttributes for post database in DynamoDB\r\n```\r\nuuid (unique ID) | username | title | url | description | published (timestamp) sort_key | community_name\r\n```\r\nAttributes for vote database in Redis\r\n```\r\nuuid (unique ID) | score (upvote-downvote) sort_key | community_name | published (timestamp) sort_key\r\n```\r\n\r\nNames of communities available in database\r\n```\r\ncsuf | news | Coronavirus | Python | computerscience | bitcoin\r\n```\r\n\r\nTotal number of posts in database: 10,000\r\n\r\n#### Note\r\n\r\nWe have found inconsistent behavior of DynamoDB local populated on one computer having issues running on another computer.\r\n\r\nIn order to fix it, \r\n1) delete all the files in dynamodb/ dir\r\n2) replace it with files from dynamodb_local_latest.zip\r\n3) Run dynamodb instance in 1 terminal using dynamo.sh script\r\n4) Run `flask init` on another terminal. This will repopulate the DynamoDB posts table.\r\nThe whole process will take around 20 minutes on a HDD and 5 minutes on an SSD.\r\n\r\n\r\n#### -----------------Dev 1 - Porting the posting microservice to Amazon DynamoDB Local----------------------\r\n* Create a new post\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"title\":\"Test post\", \"description\":\"This is a test post\", \"username\":\"some_guy_or_gal\", \"community_name\":\"449\", \"uuid\":\"9H1TQXRQQ8JAL7HE1OSWN6K5Z\", \"published\":\"1588265108\"}' http://localhost:5100/create\r\n```\r\n* Delete an existing post\r\n```shell script\r\ncurl -i -X DELETE http://localhost:5100/delete?uuid=9H1TQXRQQ8JAL7HE1OSWN6K5Z\u0026published=1588265108\r\n```\r\n* Retrieve an existing post\r\n```shell script\r\ncurl -i http://localhost:5100/get?uuid=CFXBWE9BP5VO51HNA0DE1QNIV\r\n```\r\n* List n most recent posts to a particular community\r\n```shell script\r\ncurl -i http://localhost:5100/get?n=10\u0026community_name=csuf\u0026recent=True\r\n```\r\n* List n most recent posts to any community\r\n```shell script\r\ncurl -i http://localhost:5100/get?n=10\u0026recent=True\r\n```\r\n* Retrieve multiple posts using a list of uuids\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"uuid\":[\"CQHYO2LBB1GFRIYVTH28TUEMV\", \"BAOL4MNKJWB2L04BC48IMKE53\", \"BAOL4EZ1LALJXK49HTOL84FBR\", \"CYBDDVCRY049BOWC2G0U2432V\", \"C36AVEOBBYY9BVV6LQBF74H3R\"]}' http://localhost:5100/get_uuids\r\n```\r\n\r\n#### ---------------------Dev 2 - Porting to the voting microservice to Redis---------------------------\r\n1. Upvote a post\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"uuid\":\"QWERTYMXW3TICIOQBCND86Z0D3\"}' http://localhost:5200/upvotes\r\n```\r\n2. Downvote a post\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"uuid\":\"QWERTYMXW3TICIOQBCND86Z0D3\"}' http://localhost:5200/downvotes\r\n```\r\n3. Report the number of scores (downvotes-upvotes) for a post:\r\n```shell script\r\ncurl -i -X GET 'http://localhost:5200/get?uuid=HARLIKMXW3TICIOQBCND86Z0D3'\r\n```\r\n4. List the n top-scoring posts to any community:\r\n```shell script\r\ncurl -i -X GET 'http://localhost:5200/get?n=25\u0026community_name=csuf'\r\n```\r\n5. Given a list of post identifiers, return the list sorted by score.:\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"n\":3, \"sorted\":\"True\", \"uuid\":[\"HARLIKMXW3TICIOQBCND86Z0D3\", \"C59OGYZWADQVRCCOREWSOUP3R\", \"ASD3C3PH204FAQ2EEHZY8IG7R\"]}' http://localhost:5200/getlist;\r\n```\r\n6. Create operation\r\n```shell script\r\ncurl -i -X POST -H 'Content-Type:application/json' -d '{\"uuid\":\"HARLIKMXW3TICIOQBCND86Z0D3\", \"community_name\":\"csuf\", \"score\":\"0\", \"published\":\"15058265108\"}' http://localhost:5200/create_vote\r\n```\r\n7. Delete operation\r\n```shell script\r\ncurl -i -X DELETE 'http://localhost:5200/delete_vote?uuid=CAEPJIPK49FSWZ4K02JBAFYJB'\r\n```\r\n8. Retrieve all operations\r\n```shell script\r\ncurl -i -X GET 'http://localhost:5200/get_all'\r\n```\r\n\r\n\r\n#### ---------------------Dev 3 - Aggregating posts and votes with a BFF---------------------------\r\n* As mail reader was giving output scored by published date, I have used a crome extension called \"Slick RSS\" to verify the RSS feeds.\r\n\r\n1) Use this code for generating 1 instance each for post_db, post_api, vote_api and front_BFF\r\n```shell script\r\nforeman start -m post_db=1,post=1,vote=1,front=1\r\n```\r\n\r\n2) Use the following URL to get RSS feeds\r\n\r\n  * The 25 most recent posts to a particular community\r\n```\r\nhttp://localhost:5000/get?n=25\u0026community_name=csuf\r\n```\r\n![rss_e_5](https://user-images.githubusercontent.com/33519807/81129401-0b8cd000-8ef9-11ea-8f93-2c5bf6bedf39.PNG)\r\n\r\n  * The 25 most recent posts to any community\r\n```\r\nhttp://localhost:5000/get?n=25\r\n```\r\n![rss_e_4](https://user-images.githubusercontent.com/33519807/81129399-0891df80-8ef9-11ea-9443-d9de7005b7dd.PNG)\r\n  * The top 25 posts to a particular community, sorted by score\r\n```\r\nhttp://localhost:5000/get_sorted?n=25\u0026community_name=csuf\r\n```\r\n![rss_e_2](https://user-images.githubusercontent.com/13769406/81118357-8d6f0000-8edd-11ea-8daa-d2532512b85a.PNG)\r\n\r\n\r\n  * The top 25 posts to any community, sorted by score\r\n```\r\nhttp://localhost:5000/get_sorted?n=25\r\n```\r\n![rss_e_1](https://user-images.githubusercontent.com/13769406/81118367-8fd15a00-8edd-11ea-8526-5711d9498d71.PNG)\r\n  * The hot 25 posts to any community, ranked using Reddit’s “hot ranking” algorithm.\r\n```\r\nhttp://localhost:5000/get_hot?n=25\r\n```\r\n![rss_e_3](https://user-images.githubusercontent.com/13769406/81118346-8b0ca600-8edd-11ea-8462-718c9c08a310.PNG)\r\n\r\n\r\n## License\r\n[MIT](https://choosealicense.com/licenses/mit/)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasim95%2Fweb_backend_project_2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkasim95%2Fweb_backend_project_2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkasim95%2Fweb_backend_project_2/lists"}