{"id":13989678,"url":"https://github.com/dashersw/cote-workshop","last_synced_at":"2025-04-09T11:12:57.541Z","repository":{"id":29332580,"uuid":"32866310","full_name":"dashersw/cote-workshop","owner":"dashersw","description":"Microservices case study with cote.js","archived":false,"fork":false,"pushed_at":"2022-04-14T11:04:27.000Z","size":128,"stargazers_count":255,"open_issues_count":4,"forks_count":58,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T09:08:20.122Z","etag":null,"topics":["microservices","nodejs","zero-configuration"],"latest_commit_sha":null,"homepage":"http://github.com/dashersw/cote","language":"JavaScript","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/dashersw.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":"2015-03-25T13:29:46.000Z","updated_at":"2024-11-19T18:52:44.000Z","dependencies_parsed_at":"2022-08-22T06:31:10.071Z","dependency_job_id":null,"html_url":"https://github.com/dashersw/cote-workshop","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashersw%2Fcote-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashersw%2Fcote-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashersw%2Fcote-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashersw%2Fcote-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashersw","download_url":"https://codeload.github.com/dashersw/cote-workshop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248027411,"owners_count":21035594,"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":["microservices","nodejs","zero-configuration"],"created_at":"2024-08-09T13:01:56.934Z","updated_at":"2025-04-09T11:12:57.523Z","avatar_url":"https://github.com/dashersw.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Microservices case study with cote.js\n\nThis project aims to show a microservices architecture built with [cote.js](https://github.com/dashersw/cote), an auto-discovery mesh network framework for building fault-tolerant and scalable applications.\n\nIt's an example e-commerce application with a complete feature set from admin interface to end user interface, and 4 different microservices for dealing with payments, products, purchases and user management.\n\nThe admin interface is implemented on a REST server to demonstrate how cote.js would work within an existing express-based application. Product, user and purchase management is done via REST calls to the admin server, where they are then forwarded to respective microservices.\n\nThe client interface is implemented entirely in cote; the server only serves a single index.html. It's a breakthrough implementation, which basically means you can host your website statically (on for example, S3), and have all the benefits of a server and the microservices architecture.\n\n## Installation\n\nRun the following commands:\n\n```\ngit clone https://github.com/dashersw/cote-workshop\ncd cote-workshop\nnpm install\nnode init-db.js\n```\n\n## Getting the system up and running\n\nThere are four backend services, an admin interface and an end-user interface.\n\n### Quickstart\n\nFor the quickest start, have [PM2](http://pm2.keymetrics.io) installed globally and then just type:\n\n```\npm2 start cote-workshop.json\n```\n\nThis will run all the 6 services you need, and you can monitor your services with `pm2 monit` or use any pm2 commands at your disposal.\n\nAdmin interface will be available in [http://localhost:5000](http://localhost:5000)\n\nEnd user interface will be available in [http://localhost:5001](http://localhost:5001)\n\nMonitoring will be available in [http://localhost:5555](http://localhost:5555)\n\nNavigate to the admin and (multiple) end user interfaces and add / delete / buy some products to see everything updating in real time!\n\n### Manual start\n\nRun the admin interface:\n\n```\nnode admin/server\n```\n\nAdmin interface will be available in [http://localhost:5000](http://localhost:5000)\n\nRun the end user interface in a separate terminal window (or tab):\n\n```\nnode end-user/server\n```\n\nEnd user interface will be available in [http://localhost:5001](http://localhost:5001)\n\nNow run the services in separate terminal windows (or tabs):\n\n```\nnode services/payment-service\nnode services/product-service\nnode services/purchase-service\nnode services/user-service\n```\n\nNavigate to the admin and (multiple) end user interfaces and add / delete / buy some products to see everything updating in real time!\n\n## Monitoring\n\nThere's a built-in monitor service which lets you visualize the connections between microservices. The monitoring service is automatically started via pm2, or if you want to manually start it, run:\n\n```\nnode monitor.js\n```\n\nIt's a simple monitoring GUI, and will be available in [http://localhost:5555](http://localhost:5555)\n\n## Running locally with host names\n\nThis repo includes a proxy service which binds on port 80 to host the application via certain host names.\n\nThe proxy supports these virtual hosts;\n\n`http://local-admin.cotejs.org` for the admin interface and redirects requests to `localhost:5000`.\n\n`http://local-end-user.cotejs.org` for the end user interface and redirects requests to `localhost:5001`.\n\n`http://local-monitoring.cotejs.org` for the monitoring interface and redirects requests to `localhost:5555`.\n\nThen you have to modify your `/etc/hosts` file to include `127.0.0.1 local-admin.cotejs.org local-end-user.cotejs.org local-monitoring.cotejs.org`. Now when you visit either of these addresses in your browser, you will be redirected to the respective service.\n\n## Docker installation\n\nThis repository includes a full-featured `docker-compose.yml` to start all the necessary services including a PostgreSQL database via Docker.\n\nRun the following to launch all services;\n```\ndocker-compose up\n```\n\nThis will build necessary local images and then launch a cluster of services. If you edit your `/etc/hosts` file to accomodate the given domain names, you can interact with the application via your browser.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashersw%2Fcote-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashersw%2Fcote-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashersw%2Fcote-workshop/lists"}