{"id":28311121,"url":"https://github.com/pradeepjaiswar/event-based-service-example","last_synced_at":"2026-04-25T21:31:55.505Z","repository":{"id":140470540,"uuid":"164316318","full_name":"PradeepJaiswar/event-based-service-example","owner":"PradeepJaiswar","description":"Python bases event-based service example. Upload an image on S3 bucket and create thumbnail asynchronously with Redis event push.","archived":false,"fork":false,"pushed_at":"2019-03-01T08:28:09.000Z","size":111,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T06:35:59.921Z","etag":null,"topics":["event-driven","event-service","redis","redis-queue","redis-server","resized-images","worker-rq","workers"],"latest_commit_sha":null,"homepage":"","language":"Python","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/PradeepJaiswar.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,"zenodo":null}},"created_at":"2019-01-06T14:45:13.000Z","updated_at":"2023-11-20T10:06:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"6106bd36-508c-40f2-b996-d2b9230e99e6","html_url":"https://github.com/PradeepJaiswar/event-based-service-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PradeepJaiswar/event-based-service-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PradeepJaiswar%2Fevent-based-service-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PradeepJaiswar%2Fevent-based-service-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PradeepJaiswar%2Fevent-based-service-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PradeepJaiswar%2Fevent-based-service-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PradeepJaiswar","download_url":"https://codeload.github.com/PradeepJaiswar/event-based-service-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PradeepJaiswar%2Fevent-based-service-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32278249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: 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":["event-driven","event-service","redis","redis-queue","redis-server","resized-images","worker-rq","workers"],"created_at":"2025-05-24T12:10:32.370Z","updated_at":"2026-04-25T21:31:55.499Z","avatar_url":"https://github.com/PradeepJaiswar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Event based service example\n\n### Event based services for uploading images to AWS S3 bucket. Resizing uploaded images to thumbnail, uploading them into separate S3 bucket folder and listing down the resized images.\n\n## How it works?\n\nUpload service uploads the original image to AWS S3 bucket and returns the message saying that image is uploaded and sent for resizing. At the same time upload service adds a job in Redis queue that new image is ready for resizing. Image resize worker which is listening for the new job from Redis, picks up the job and does the resizing of original image and uploads back to AWS S3 in a separate folder. After the worker is done with resizing and uploading it also sends a message to a web socket server that new image is being resized in the system. On receiving the message from web worker web socket server tell all subscribed client that new resized image is added in the system, update your UI\n\n## Architecture Diagram\n![architecture-diagram](https://raw.githubusercontent.com/PradeepJaiswar/event-based-service-example/master/architecture-diagram.png)\n\n## Service components\n\n### REST API\n\n#### Pre-requisites\ninstalled python and pip\n\n#### Install dependencies\n\n```\n$ pip install virtualenv  #make sure you do this\n$ virtualenv .pyenv\n$ source .pyenv/bin/activate\n$ pip install -r requirements.txt\n```\n\n#### Run\n\n```\n$ python run.py\n* Running on http://localhost:7000/ (Press CTRL+C to quit)\n```\n#### API's\n\nPORT :: 7000\n\nUpload API \n\n`http://localhost:7000/api/upload` - POST\n\nparams:\n```\n name : file\n Form Data: file(binary)\n```\nHeader:\n```\nContent-Type: multipart/form-data\n```\nList resized images API\n\n`http://localhost:7000/api/images` - GET \n\n#### AWS SE bucket access credentials\n\nInstall and configure aws cli\n\nhttps://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html\n\nhttps://docs.aws.amazon.com/cli/latest/reference/configure/\n\n#### Enviroment variable\n\nCreate a .env file on each enviroment in root of repo\n```\nTMP_FILE_PATH = ''; # tmp file storage path on server\nS3_BUCKET_NAME = ''; # S3 bucket name\nS3_BASE_URL = ''; # S3 bucket base url \nWEB_SOCKET_PATH = ''; # websocket server path\n```\n\n\n### Redis Server \n\n#### Install dependencies\n\ninstall redis https://redis.io/topics/quickstart\n\n#### Run redis server\n```\nredis-server\n```\n\n### Queue and Worker\nRQ (Redis Queue) :: A simple Python library for queueing jobs and processing them in the background with workers. \n\n#### Install dependencies\n\nAlready include in the project requirements.txt file\n\nWorker file is at https://github.com/PradeepJaiswar/event-based-service-example/blob/master/worker.py\n\n#### Run rq worker\n\n```\ncd event-based-service-example\nrq worker\n```\n### WebSocket\nPORT :: 8080\n\ne.g ws://localhost:8080/\n\n#### Prerequisites\ninstalled node and npm\n\n#### Install dependencies\n```\ncd event-based-service-example\nnpm install ws\n```\nWebsocket server file is at https://github.com/PradeepJaiswar/event-based-service-example/blob/master/socket-server.js\n\n#### Run websocket server\n\n```\ncd event-based-service-example\nnode socket-server.js or nodejs socket-server.js\n```\n\n## Web applicatios\n\nCheck https://github.com/PradeepJaiswar/event-based-service-example-frontend\n\n## Test \n\nTODO\n\n## Code \n\nAPi's are written Flaskframewoek http://flask.pocoo.org/ using blueprints http://flask.pocoo.org/docs/1.0/blueprints/ for modular code structure\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpradeepjaiswar%2Fevent-based-service-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpradeepjaiswar%2Fevent-based-service-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpradeepjaiswar%2Fevent-based-service-example/lists"}