{"id":25556393,"url":"https://github.com/MeelisM/vmicroservices","last_synced_at":"2026-02-22T06:30:18.062Z","repository":{"id":278334329,"uuid":"934340214","full_name":"MeelisM/crud-master","owner":"MeelisM","description":"A simple microservices infrastructure. All services are encapsulated in different virtual machines. ","archived":false,"fork":false,"pushed_at":"2025-02-19T07:33:43.000Z","size":225,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-19T08:28:37.984Z","etag":null,"topics":["pm2","postman","rabbitmq","vagrant","virtualbox"],"latest_commit_sha":null,"homepage":"","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/MeelisM.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-17T17:03:12.000Z","updated_at":"2025-02-19T07:33:47.000Z","dependencies_parsed_at":"2025-02-19T08:39:42.181Z","dependency_job_id":null,"html_url":"https://github.com/MeelisM/crud-master","commit_stats":null,"previous_names":["meelism/crud-master"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MeelisM%2Fcrud-master","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MeelisM%2Fcrud-master/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MeelisM%2Fcrud-master/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MeelisM%2Fcrud-master/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MeelisM","download_url":"https://codeload.github.com/MeelisM/crud-master/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239852897,"owners_count":19707775,"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":["pm2","postman","rabbitmq","vagrant","virtualbox"],"created_at":"2025-02-20T14:26:30.004Z","updated_at":"2026-02-22T06:30:16.009Z","avatar_url":"https://github.com/MeelisM.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crud-master\n\nA simple microservices infrastructure. All services are encapsulated in different virtual machines. \u003cbr\u003e\nFor the purpose of this exercise, the .env file is included in the repository.\n\n![image](/images/diagram.jpg)\n\n## Table of contents\n\n- [Core Technologies](#core-technologies)\n- [Installation: Development](#installation-development)\n  - [billing-app](#billing-app)\n  - [inventory-app](#inventory-app)\n  - [api-gateway](#api-gateway)\n- [Database Migrations](#database-migrations)\n- [Installation: Production](#installation-production)\n  - [System Requirements](#system-requirements)\n  - [Vagrant Setup](#vagrant-setup)\n- [API Documentation](#api-documentation)\n- [Testing and Documentation Tools](#testing-and-documentation-tools)\n\n## Core Technologies\n\n- Node.js\n- PostgreSQL\n- RabbitMQ\n- VirtualBox\n- Vagrant\n- PM2\n- Postman\n\n## Installation: Development\n\nThis project can be run in either development or production mode. The mode is controlled by the `ENVIRONMENT` variable in the `.env` file.\n\nFor this exercise, a pre-filled `.env` file is included in the repository.\n\nThe easiest way to get everything up and running is to run a single script that installs all the required packages, creates databases with users, performs database migrations and starts all 3 applications. Make sure that the `.env` file `ENVIRONMENT` value is set to `DEVELOPMENT`.\u003cbr\u003e\nIf you don't have a local PostgreSQL database set up, be sure to update the `.env` file. Databases run locally for both development and production environments.\n\n```\n./scripts/setup-development.sh\n```\n\n### billing-app\n\nSet the production environment variable in the `.env` file.\n\n```bash\nENVIRONMENT=DEVELOPMENT\n```\n\nNavigate to the correct directory.\n\n```bash\ncd src/billing-app/\n```\n\nInstall the required packages.\n\n```bash\nnpm install\n```\n\nSetup the database.\n\n```bash\n cd ../.. \u0026\u0026 ./scripts/billing-app/setup-billing-db.sh\n```\n\nRun database migrations.\n\n```bash\ncd src/inventory-app/ \u0026\u0026 npm run db:migrate\n```\n\nStart the server.\n\n```bash\nnpm run start\n```\n\n### inventory-app\n\nNavigate to the correct directory.\n\n```bash\ncd src/inventory-app/\n```\n\nInstall the required packages.\n\n```bash\nnpm install\n```\n\nSetup the database.\n\n```bash\n cd ../.. \u0026\u0026 ./scripts/inventory-app/setup-inventory-db.sh\n```\n\nRun database migrations.\n\n```bash\ncd src/inventory-app/ \u0026\u0026 npm run db:migrate\n```\n\nStart the server.\n\n```bash\nnpm run start\n```\n\n### api-gateway\n\nNavigate to the correct directory.\n\n```bash\ncd src/api-gateway/\n```\n\nInstall the required packages.\n\n```bash\nnpm install\n```\n\nStart the server.\n\n```bash\nnpm run start\n```\n\n## Database Migrations\n\n`billing-app` and `inventory-app` use PostgreSQL database and have migrations set up with `Sequalize`. Make sure to be in the correct application folder.\n\nRun database migrations\n\n```bash\nnpm run db:migrate\n```\n\nRoll back the last database migration.\n\n```bash\nnpm run db:migrate:undo\n```\n\nRoll back all database migrations.\n\n```bash\nnpm run db:migrate:undo:all\n```\n\n## Installation: Production\n\n### System Requirements\n\n- Minimum 4GB RAM (for running 3 VMs).\n- ~10GB available disk space.\n- Processor with virtualization support enabled.\n\n### Vagrant Setup\n\nSet the environment variable in the `.env` file.\n\n```bash\nENVIRONMENT=PRODUCTION\n```\n\nStart the virtual machines.\n\n```bash\nvagrant up\n```\n\nThis will automatically:\n\n- Configure all three virtual machines (gateway-vm, inventory-vm, billing-vm).\n- Set up PostgreSQL databases.\n- Configure RabbitMQ.\n- Start all services using PM2.\n  You can check the status of the virtual machines and services:\n\n```bash\nvagrant status # Check VM status\nvagrant ssh \u003cvm-name\u003e # SSH into specific VM\nsudo pm2 list # Check running services\n```\n\n## API Documentation\n\nThe API is documented using OpenAPI 3.0 specification (`openapi.yaml`). The documentation includes:\n\n- Complete endpoint descriptions\n- Request/response schemas\n- Example payloads\n- Error responses\n\nThe documentation runs on the `Gateway VM` and provides a comprehensive overview of all available endpoints and their functionality.\n\n### Development Environment:\n\n```http\nhttp://localhost:8000/api-docs\n```\n\n### Production Environment:\n\n```http\nhttps://192.168.56.10:8000/api-docs\n```\n\n## Testing and Documentation Tools\n\n### Postman Collections\n\nThe project includes comprehensive Postman collections for testing all API endpoints. It also includes two sets of environment variables. These can be used to test both `production` and `development` endpoints with the same Postman collection.\n\n- Gateway Tests\n  - Movies (CRUD operations)\n  - Billing (Order creation)\n- Direct API Tests\n  - Inventory API (direct testing of movie service)\n- Test Suites\n  - Movie CRUD sequence\n    1. DELETE All Movies (Clean Start)\n    2. GET All Movies (Verify Empty)\n    3. Create Movie\n    4. Get Movie by ID\n    5. Update Movie by ID\n    6. Get Movie by Title\n    7. Delete Movie by ID\n\n[Click to view Postman image](/images/postman.png)\n\n### Testing RabbitMQ Queue\n\nTo test the billing queue functionality:\n\n- Send order while billing-app is running\n\n  - Verify order appears in database\n\n- Stop billing-app: `pm2 stop billing-api`\n\n  - Send order\n  - Verify Gateway accepts it\n\n- Start billing-app: `pm2 start billing-api`\n\n  - Verify queued order appears in database\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMeelisM%2Fvmicroservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMeelisM%2Fvmicroservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMeelisM%2Fvmicroservices/lists"}