{"id":24789959,"url":"https://github.com/andrewindeche/clientorderservice","last_synced_at":"2026-04-10T12:01:54.534Z","repository":{"id":274066967,"uuid":"921777317","full_name":"andrewindeche/clientorderservice","owner":"andrewindeche","description":"The project contains  a python service for customer orders","archived":false,"fork":false,"pushed_at":"2025-02-03T05:45:20.000Z","size":24950,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T13:13:43.396Z","etag":null,"topics":["ansible","cicd","django-rest-framework","kubernetes","postgresql","rest-api","terraform"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/andrewindeche.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}},"created_at":"2025-01-24T15:44:36.000Z","updated_at":"2025-02-03T05:38:46.000Z","dependencies_parsed_at":"2025-01-26T11:30:04.172Z","dependency_job_id":null,"html_url":"https://github.com/andrewindeche/clientorderservice","commit_stats":null,"previous_names":["andrewindeche/clientorder","andrewindeche/clientorderservice"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrewindeche/clientorderservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewindeche%2Fclientorderservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewindeche%2Fclientorderservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewindeche%2Fclientorderservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewindeche%2Fclientorderservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewindeche","download_url":"https://codeload.github.com/andrewindeche/clientorderservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewindeche%2Fclientorderservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31641492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"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":["ansible","cicd","django-rest-framework","kubernetes","postgresql","rest-api","terraform"],"created_at":"2025-01-29T18:14:09.051Z","updated_at":"2026-04-10T12:01:54.492Z","avatar_url":"https://github.com/andrewindeche.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Client Order Service\n\n|Tool                | Description                    | Tags for tools used                                                                                               |\n| ------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------- |\n| 1.GitHub| Version Control| [Version-Control]; [Repo]; [Pipeline]; [Continuous integration];[Continuous Delivery]|\n| 2.Django Rest API |  Python Based Backend Framework| [python]; [Django];|\n| 3.PostgresQl | Relational Database| [Relational Integrity]; [Database];|\n| 4.Pipenv | Package/Dependency manager| [Virtual Environment];[Dependency];|\n| 5.Ansible |Configuration Automation Tool | [Orchestration];[ configuration management]|\n| 6.Terraform | Infrastructure as Code Tool | [IaC]; [Provisioning]; [Cloud Resources];|\n| 7.Kubernetes |\tContainer Orchestration Platform | [Containers]; [Cluster Management]; [Scalability];|\n| 8.Africa’s Talking SMS Gateway |\tCommunication Platform | [SMS]; [API]; [Messaging];|\n| 9.OpenID | Connect\tAuthentication Protocol | [OAuth 2.0]; [Authentication]; [Identity Management];|\n| 10.Google Cloud Platform | Infrastructure As A Service | [Cloud Platform]; [Deployment];|\n| 11.CircleCI | continuous integration and delivery (CI/CD) Platform | [Continuous integration]; [Continuous Delivery];[CI/CD]|\n\n## \u003ch1\u003e Description\u003c/h1\u003e\nThe aim of the project is to build a DRF(Django Rest Framework) client order service that enables a client to make orders.\n\n## \u003ch1\u003e Set up Instructions\u003c/h1\u003e\n\u003cp\u003e\u003cb\u003eGithub\u003c/b\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e Download the Zip file from the code tab on github to get the project Zip files (Recommended)\u003c/li\u003e\n\u003cli\u003e Clone the project using ```bash git clone https://github.com/andreindeche/clientorderservice.git'.```\u003c/li\u003e\n\u003cli\u003e Unzip the file and add the Project folder to your IDE/Compiler\u003c/li\u003e\n\u003c/ul\u003e\n\n1. Create an .env environment on the Django root folder and add the recessary environment variables. \n\u003cp\u003eUse \u003cb\u003e[env example](./env.example)\u003c/b\u003e as a guide for environment variables.\u003c/p\u003e\n\n\u003cp\u003e\u003cb\u003eKubernetes\u003c/b\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eCreate a Docker Image\u003c/li\u003e\n\n    ```bash\n     docker build -t your-django-project .\n    ```\n\u003cli\u003eRun the Docker container:\u003c/li\u003e\n\n    ```bash\n    docker run -p 8000:8000 myproject\n    ```\n\n\u003cli\u003ePush image to a container registry\u003c/li\u003e\n\n  ```bash\n  docker tag my-django-app your-username/my-django-app:latest\n  docker push your-username/my-django-app:latest\n  ```\n\n\u003cli\u003e Create a configmap.yaml for environment variables\u003c/li\u003e\nMake sure to define your environment variables in this file.\n\n\u003cli\u003eApply Kubernetes configuration for your Kubernetes cluster\u003c/li\u003e\n\n    ```bash\n    kubectl apply -f configmap.yaml\n    kubectl apply -f deployment.yaml\n    kubectl apply -f service.yaml\n    ```\n\n\u003cli\u003eIf you're testing locally, you can use Minikube to create a local Kubernetes cluster\u003c/li\u003e\n\n    ```bash\n    minikube start\n    ```\n\n    ```bash\n    explorer.exe \"http://192.168.39.84:30095\"\n    ```\n\u003c/ul\u003e\n\n\u003cp\u003e\u003cb\u003eDjango\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003eThe project uses pipenv, django and postgresql backend\u003c/p\u003e\n\n1. Install pipenv using the command \n```bash\npip install pipenv\n```\n\n2. Activate your virtual enviromnment\n```bash\npipenv shell \n```\n\n3. Naviagte to your Django project and use  in  the directory path: \u003cb\u003e[requirements](./requirements.txt)\u003c/b\u003e to install the required django dependencies \n```bash\npipenv install -r requirements.txt\n```\n\n4. Create an .env on the Django root folder and add the recessary environment variables. \nUse [example env](backend\\env.example) as a guide for environment variables \u003c/li\u003e\n\n5. Create a Super User using \n```bash\npython manage.py createsuperuser\n```\n\n6. Migrate your DB using \n```bash\npython manage.py migrate\n```\n\n7. To run the project outside of a shell environment use: \n```bash\npipenv run python manage.py runserver\n```\n or while in the shell environment use:\n```bash\npython manage.py runserver\n```\n\n8. To Run Tests (Tests include Security Tests): \n```bash\npython manage.py test\n```\n\n9.Generate Coverage report\n\n```bash\ncoverage run --source='.' manage.py test\n```\n```bash\ncoverage report\n```\n```bash\ncoverage html\n```\n\n\u003cp\u003e\u003cb\u003eAfrica's Talking\u003c/b\u003e\u003c/p\u003e\n\u003cp\u003e Africa's talking has been used as the SMS/Communication gateway for the project to enable SMSes on order or update of the orders.\n1. Create an account on the site https://africastalking.com/sms.\n2. Generate an api key and set it on the environment variable 'YOUR_API_KEY'.\n\n\u003cp\u003e\u003cb\u003eEndpoints\u003c/b\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003ePreferably Use POSTMAN or any API tool to test the endpoints after login.\u003c/li\u003e\n\u003cli\u003eOrders can only be made by authenticated users.\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003cp\u003e\u003cb\u003eAuthentication\u003c/b\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eAuthenticate to register as a user and interact with the API Endpoints.\u003c/li\u003e\n\u003cli\u003eFor logins, click on the link and authenticate on a browser.\u003c/li\u003e\nURL = 'http://localhost:8000'\n\u003c/ul\u003e\n\n1.Login.\n```bash\nhttp://{URL}/accounts/login/ or http://{URL}/accounts/google/login/\n```\n\n2.Register\n```bash\nhttp://{URL}/accounts/signup/\n```\n\n3.View Customer code:\n```bash\nhttp://{URL}/accounts/account_page/\n```\n\n4.Logout navigate to:\n```bash\nhttp://{URL}/accounts/google/login/\n```\nSelect Logout\n\n5.Generate Tokens for transactions:\n    \u003cul\u003e\n   \u003cli\u003e Fields: \"username\", \"password\",\u003c/li\u003e\n\n    \u003cli\u003e  POST:/api/token/ \u003c/li\u003e\n\n     \u003cli\u003e POST:/api/token/refresh/  to refresh token \u003c/li\u003e\n    \u003c/ul\u003e\n\n6.Create Order\n```bash\n    POST:http://{URL}/api/create_order/\n        Headers: Content-Type: application/json\n        Authorization: Add Token\n        Example:Json payload:{\n        \"customer_code\": \"CUST123\",\n        \"item\": \"Laptop\",\n        \"amount\": 500\n        }\n```\n\n7.Update Order\n```bash\n   PUT:http://{URL}/api/update_order/\u003cuuid:order_id\u003e/\u003c/p\u003e\n```\nTo get UUID via Python shell for ORM :\n\n```bash\n    python3 manage.py shell\n```\n```bash\n    from orders.models import Order\n    order = Order.objects.first() \n    print(order.order_id)\n```\n    or start psql:\n\n```bash\n    SELECT order_id FROM orders;\n```\n\n8. Use GraphQl for querying:\n    Navigate to: http://127.0.0.1:8000/graphql/\n\n\u003cp\u003e\u003cb\u003eGraphQl Mutations:\u003c/p\u003e/\u003cb\u003e\n\nGenerate Token.\n\n```bash\n\nmutation {\n  generateToken(username: \"your_username\", password: \"your_password\") {\n    access\n    refresh\n  }\n}\n\n\n```\n\n\u003cp\u003e\u003cb\u003eRefresh Token.\u003c/p\u003e/\u003cb\u003e\n\n```bash\nmutation {\n  refreshToken(refresh: \"your_refresh_token\") {\n    access\n  }\n}\n\n```\n\n\u003cp\u003e\u003cb\u003eCreate Order\u003c/p\u003e/\u003cb\u003e\n\n```bash\n\nmutation {\n  createOrder(input: {\n    customerCode: \"CUST216204\",\n    item: \"Laptop\",\n    amount: 500.0\n  }) {\n    order {\n      customer {\n        code\n      }\n      item\n      amount\n    }\n    message\n    smsMessage\n    smsStatus\n  }\n}\n\n```\n\n\u003cp\u003e\u003cb\u003eUpdate Order\u003c/p\u003e/\u003cb\u003e\n\n```bash\n\nmutation {\n  updateOrder(orderId: \"128a3b7f-d146-4793-a3c1-b5ee04d21316\", item: \"New Item Name\", amount: \"150.00\") {\n    order {\n      customer {\n        code\n      }\n      item\n      amount\n    }\n  }\n}\n\n```\n\nTo get UUID via Python shell for ORM :\n\n```bash\n    python3 manage.py shell\n```\n```bash\n    from orders.models import Order\n    order = Order.objects.first() \n    print(order.order_id)\n```\n    or start psql:\n\n```bash\n    SELECT order_id FROM orders;\n```\n\n## \u003ch1\u003e Terraform \u003c/h1\u003e\n\u003cp\u003eTerraform has been used and configurations set for [Render](https://render.com/)\u003c/p\u003e\n\u003cp\u003eThe configurations located are in: [text](terraform/main.tf).\u003c/p\u003e\n\n## \u003ch1\u003e Ansible \u003c/h1\u003e\n\u003cp\u003eThe Ansible playbook has been written for consistent installations across local environments and can be used to configure various local machines\u003c/p\u003e\n\n\u003cp\u003eUse this command to tun a playbook:\u003c/p\u003e\n\n```bash\nansible-playbook -i hosts.ini local_tasks.yml\n```\n\n\u003cp\u003eTo run as a sudo or admin user:\u003c/p\u003e\n\n```bash\nansible-playbook playbook.yml --ask-become-pass\n```\n## \u003ch1\u003e Author \u003c/h1\u003e\nBuilt by \u003cb\u003eAndrew Indeche\u003c/b\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewindeche%2Fclientorderservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewindeche%2Fclientorderservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewindeche%2Fclientorderservice/lists"}