{"id":22121566,"url":"https://github.com/anantzoid/ostrich","last_synced_at":"2025-07-25T13:32:08.685Z","repository":{"id":24248687,"uuid":"101013404","full_name":"anantzoid/Ostrich","owner":"anantzoid","description":"E-commerce Rental Platform written in Flask \u0026 React","archived":false,"fork":false,"pushed_at":"2022-12-26T19:46:50.000Z","size":30709,"stargazers_count":52,"open_issues_count":14,"forks_count":25,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-17T07:27:17.254Z","etag":null,"topics":["api","e-commerce","elasticsearch","flask","mvp","product","python","react","web"],"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/anantzoid.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}},"created_at":"2017-08-22T02:43:05.000Z","updated_at":"2024-02-03T19:49:25.000Z","dependencies_parsed_at":"2022-08-30T15:02:25.226Z","dependency_job_id":null,"html_url":"https://github.com/anantzoid/Ostrich","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anantzoid%2FOstrich","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anantzoid%2FOstrich/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anantzoid%2FOstrich/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anantzoid%2FOstrich/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anantzoid","download_url":"https://codeload.github.com/anantzoid/Ostrich/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227581805,"owners_count":17789311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","e-commerce","elasticsearch","flask","mvp","product","python","react","web"],"created_at":"2024-12-01T14:41:48.763Z","updated_at":"2024-12-01T14:41:49.288Z","avatar_url":"https://github.com/anantzoid.png","language":"Python","readme":"![Logo](app/static/img/watermark.png)\n\n# Ostrich: E-commerce rental platform\n\nOstrich was built as a physical book rental platform which enables users to order books to their doorstep, track the delivery status, rate, review and return books. The complete e-commerce ecosystem surrounds the core feature providing the users with an end-to-end experience via strategic and timely push notification and mailers, Google authentication, automated updation of items and inventory and user behaviour tracking to understand preferences to name a few. \n\nThe architecture follows a lightweight, intuitive design pattern inspired by the beautiful [flamejam](https://github.com/svenstaro/flamejam) project for the backend and [flux](https://facebook.github.io/flux/docs/overview.html) architecture for the React frontend. The platform is written in a simple and generic manner and can be customized to suit various business solutions. \n\n\u003cbr\u003e\n\n![Homepage](app/static/img/screens/homepage_ss.png)\n\n\u003cbr\u003e\n\nScroll to the bottom to checkout more screenshots.\n\n\u003cbr\u003e\u003cbr\u003e\n\n## Tech Stack\n\n- [Flask](http://flask.pocoo.org/): Backend, api and rendering initial pages\n- [ReactJS](https://facebook.github.io/react/): Frontend (built using [Webpack](https://webpack.github.io/))\n- [Python-React](https://github.com/markfinger/python-react/tree/master/examples/frontend-rendering-with-webpack): Bridge between Flask and React\n- [Celery](http://www.celeryproject.org/): Crons, Automation, Crawling\n- [Redis](https://redis.io/): Caching via Memcached, Broker for Celery\n- [Mongodb](https://www.mongodb.com/): Backup \u0026 Logging\n- [MySQL](https://www.mysql.com/)\n- [Elasticsearch](https://www.elastic.co/)\n- [Apache Server](https://httpd.apache.org/)\n- [NodeJS server](https://nodejs.org/en/)\n- [AWS](https://aws.amazon.com): EC2, ES, Route 53, S3, CDN, RDS\n\n\u003cbr\u003e\n\n## Installation\n\nThe installations steps have been tested on a linux machine (Ubuntu) and might vary for other OS in terms of setting up the dependencies.\n\n1. Clone the repo and `cd` into it.\n2. Install MySQL.\n\t\n\t```\n\tsudo apt-get install mysql-server\t\n\tsudo apt-get install libmysqlclient-dev\n\t```\n\n\tCreate database ostrichdb. Import the sample data dump. One way to do this is:\n\t\n\t```\n\tmysql -u root -p ostrichdb \u003c docs/ostrichdb.sql\n\t```\n3. Install python dependecies\t\n\n\t```\n\txargs -a docs/requirements.txt -n 1 pip install\n\t```\n\tAs opposed to `pip install -r docs/requirements.txt`, this method skips over errors while installation.\n\n4. Copy the config file.\n\n\t```\n\tcp -R docs/ostrich_conf /etc/ostrich_conf\n\t```\n\tAlternatively, you can change the location of the config file in `app/__init__.py` and `app/views/v1/website.py (line 144)`.\n\t\n5. Make appropriate changes in the `ostrich_conf/app_config.cfg.template` file, removing the `.template` extension.\n\n6. Installing frontend components:\n\n\t```\n\tcd app/static/js\n\tnpm install\n\tnpm run pack\n\t```\n7. [Install redis](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04). Follow the steps in the link till *Build and Install Redis*. Then start the redis server.\n\n\t```\n\tredis-server\n\t```\n7. Start the node server\n\n\t```\n\tnode render_server.js\n\t```\n8. Start the flask server\n\n\t```\n\tpython run.py\n\t```\n\u003cbr\u003e\n\n### Optional Setups\nThe following are other things to setup that application makes use of to provide a richer experience.\n\n1. ### Elasticsearch\nProdcut Searches can be made in two different ways using the same APIs: Elasticsearch and MySQL. This switch can be controlled from the config file. The schema for ES lies in `docs/search_mapping.json` and items can be indexed in ES by calling the `python manage.py indexer`.\n\n2. ### Google Auth\nAlthough there is a manual signup API, the web application uses Google Authentication as it's default signin technique. To enable this, get a `client_id` and paste it in `ostrich_conf/google_client_secrete.json`.\n\n3. ### Celery\nMany background tasks run to perform tasks like keeping the db updated (by crawling new listings and updating the existing ones), sending notifications and mails to users for returning the book and upselling products etc. These tasks are run by [Celery](http://www.celeryproject.org/) and can be reviewed in `scheduler.py`.\n\n4. ### Supervisor\nTo manage independenly running tasks like Celery schedulers, node servers etc., [Supervisor](http://supervisord.org/) can be setup.\n\n5. ### Mixpanel\nTracking has been setup to keep a counter of views on different activities by the user. All that needs to be done is save the Mixpanel credentials in the config file.\n\n6. ### Arbor: B2B model\nApart from serving the consumers directly, Ostrich also had a B2B business model where organizations would signup and have a stocked book rack placed in their lobby. The people working over there could access a different interface and search and borrow books from the stock free of charge. The accesspoint is `/arbor` but I still need to work on the other parts of the B2B ecosystem to prepare for public release.\n\n\u003cbr\u003e\n\n## API endpoints\nThe API endpoints cater to various user and admin facing features that correpond to both the web and mobile app. Relevant information is cached within API calls. The following is a non-exhaustive list highlighting some of the relevant ones:\n\n### Search\n- [Search String](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/search.py#L18)\n- [Report Search fail](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/search.py#L68)\n- [Categories](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/search.py#L59)\n- [Most Searched items](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/search.py#L85)\n- [Related/Recommended Items](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/search.py#L81)\n\n### Orders\n- [Order/Rent Item](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/order.py#L25)\n- [Lend Item](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/order.py#L77)\n- [Order Details](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/order.py#L97)\n- [Order Status](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/order.py#L131)\n- [Time Slots for delivery](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/order.py#L196)\n\n### User\n- [Signup](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L72)\n- [User Details](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L35)\n- [Edit Details](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L155)\n- [Add Address](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L104)\n- [Get Delivery areas](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L224)\n- [Validate Delivery area](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L133)\n- [Order History](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L186)\n- [Wishlist Items](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L201)\n- [Referral Code](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L235)\n- [Reviews](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/review.py#L6)\n- [Delete User](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L331)\n- [Mass notification to user groups](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/user.py#L338)\n\n### Admin\n- [Inventory detail](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/admin.py#L24)\n- [All Orders](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/admin.py#L19)\n- [Update Order Status](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/admin.py#L72)\n- [Crawl](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/admin.py#L95)\n- [Send push notification](https://github.com/anantzoid/Ostrich/blob/master/app/views/v1/admin.py#L8)\n\n\u003cbr/\u003e\u003cbr/\u003e\n\n## Bonus Goodies\n\n### SEO by rendering React pages through Flask\nWe know good SEO is acheived if pages are rendered via server initially. But here lies a challenge since the backend here is Flask, and only Node can render React pages from server side. Hence, with the help of [Python-React](https://github.com/markfinger/python-react), an intermediate Node server is setup that receives payload from flask depending on the url/query and renders the React template to normal string accordingly. This plain string is then passed pack to Flask which returns it to the browser. Of course, there a number of intricacies that needs to be taken care of which I've isolated in this design pattern [here](https://github.com/markfinger/python-react/tree/master/examples/frontend-rendering-with-webpack). Also, note that this mechanism was implemented in Spring 2016 and there might have been considerable developments done in the area since then.\n\n\n### Responsive\nThe CSS has been written in a fully responsive manner to support all kinds of media resolutions.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"app/static/img/screens/responsive_homepage.gif\" alt=\"Responsive\" style=\"width: 255px;\"\u003e\u003c/p\u003e\n\n\u003cbr\u003e\n\n### Mentions\n\nOstrich appeared in a [local lifestyle blog](https://lbb.in/bangalore/ostrich-app-forlending-and-borrowing-books/) eons ago.\n\n\n### Supporting apps and dashboards\n\nApart from the main product codebase, Ostrich comprises of a suite of complementing tools consisting of:\n\n- Admin Dashboard\n\t- Track and update orders\n\t- Crawl and add items\n\t- Monitor user activity\n\t- Control homepage and app content\n- Slack app\n- Android app\n- Arbor (Business Solution)\n\nI'm still working on refining the docs and make them easily installable on any machine. Contributions are welcome.\n\n## Product Preview\n\n### Catalog Page\n\u003cdiv style=\"text-align:center\"\u003e\u003cimg src=\"app/static/img/screens/item.png\" alt=\"Item\" style=\"max-width:100%;width: 600px;\"\u003e\u003c/div\u003e\n\n\u003cbr/\u003e\n\n### Order Dialog\n\u003cdiv style=\"text-align:center\"\u003e\u003cimg src=\"app/static/img/screens/order.png\" alt=\"Order\" style=\"max-width:100%;width: 600px;\"\u003e\u003c/div\u003e\n\n\u003cbr/\u003e\n\n### Add address Dialog\n\u003cdiv style=\"text-align:center\"\u003e\u003cimg src=\"app/static/img/screens/address.png\" alt=\"Address\" style=\"max-width:100%;width: 600px;\"\u003e\u003c/div\u003e\n\n\u003cbr/\u003e\n\n### Responsive Catalog Page\n\u003cp align=\"center\"\u003e\u003cimg src=\"app/static/img/screens/responsive_product.gif\" alt=\"Catalog\" style=\"width: 255px;\"\u003e\u003c/p\u003e\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanantzoid%2Fostrich","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanantzoid%2Fostrich","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanantzoid%2Fostrich/lists"}