{"id":16762163,"url":"https://github.com/mirceaalexandru/startershell-mongo","last_synced_at":"2026-04-19T10:33:17.356Z","repository":{"id":148449424,"uuid":"236746312","full_name":"mirceaalexandru/startershell-mongo","owner":"mirceaalexandru","description":"A simple starter shell project using node.js and mongo","archived":false,"fork":false,"pushed_at":"2020-02-10T18:02:53.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T22:21:49.286Z","etag":null,"topics":["docker","docker-compose","hapijs","hapijs-backend","joi","joi-validation","minikube","mongodb","starter-template"],"latest_commit_sha":null,"homepage":null,"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/mirceaalexandru.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":"2020-01-28T13:52:56.000Z","updated_at":"2020-02-10T18:02:55.000Z","dependencies_parsed_at":"2023-05-20T06:00:20.280Z","dependency_job_id":null,"html_url":"https://github.com/mirceaalexandru/startershell-mongo","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/mirceaalexandru%2Fstartershell-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirceaalexandru%2Fstartershell-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirceaalexandru%2Fstartershell-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirceaalexandru%2Fstartershell-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirceaalexandru","download_url":"https://codeload.github.com/mirceaalexandru/startershell-mongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243853124,"owners_count":20358373,"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":["docker","docker-compose","hapijs","hapijs-backend","joi","joi-validation","minikube","mongodb","starter-template"],"created_at":"2024-10-13T04:44:11.600Z","updated_at":"2026-04-19T10:33:12.308Z","avatar_url":"https://github.com/mirceaalexandru.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple starter shell project using Node.js, Hapi.js \u0026 MongoDB\n\nTable of Contents\n=================\n\n   * [Simple micro-service](#simple-micro-service)\n   * [Table of Contents](#table-of-contents)\n      * [Project description](#project-description)\n      * [Starting the service](#starting-the-service)\n      * [Features](#features)\n         * [Configuration](#configuration)\n         * [Swagger documentation](#swagger-documentation)\n         * [Endpoint validation](#endpoint-validation)\n         * [Logging](#logging)\n         * [Database](#database)\n         * [Docker](#docker)\n         * [Docker Compose](#docker-compose)\n         * [Minikube](#minikube)\n         * [Linting](#linting)\n         * [Testing](#testing)\n\n## Project description\n\nA template management system. This is a proof of concept. Entities are categories and templates. \nEach category or template can belong to an existing category. This micro-service exposes API for:\n * create a template\n * create a category\n * move a template to a category\n * move a category to another category\n * delete a template\n * delete a category - it will delete all child categories and templates recursively.\n\n## Starting the service\n\n * Clone project locally\n \n`git clone git@github.com:mirceaalexandru/startershell-mongo.git`\n\n * Prepare configuration: \n   * Copy `.env_sample` as `.env`. Change any environment variable to match your environment configuration.\n   * Copy `.env-variables.sample` as `env-variables.env`. Change any environment variable to match your environment configuration. This file contains the configuration required by docker-compose.\n\n You can start you service in one of these 4 ways:\n * Start your service using an external Mongo replicaset. Just need to provide correct DB URI in `.env` (or as environment variable).\n * Start your service using the MongoDB replicaset started with docker-compose. You need to start docker-compose (`docker-compose up --build --scale service=0`) and then you can start your service on local host. This will start multiple Mongo nodes and configure them as replicaset.\n * Start your service and MongoDB using docker-compose. You can start docker compose (`docker-compose up --build`). This will start multiple Mongo nodes, configure them as replicaset and then start the service. \n\n## Features\n\n### Configuration\n\n * Configuration is loaded from environment variables.\n * Support for loading from an `.env` file is provided. However the `dotenv` is added as dev dependency making sure that `.env` is not loaded in production as this will be a bad practice.\n * Before service is started a strict schema validation is applied on configuration object. This is required to make sure the application is started with a valid configuration, at least from structure point of view.\n * There are no configuration defaults. This will enforce creating proper environment variables for all configuration parameters.\n \n### Swagger documentation\n\n * Swagger documentation for implemented API is exposed automatically on `/documentation` endpoint.\n * This documentation is created automatically using the HapiJs endpoint validation so is up-to-date and automatically updated when API is changed.\n * This documentation is exposed automatically only for `development` environments, in `staging` or `production` it will no exposed API documentation. \n * Project can be started also using minikube.\n \n### Endpoint validation\n\n * All endpoints have a strict validation implementing using JOI.\n * This implementation will be automatically described in the Swagger documentation.\n * Validation errors details are not exposed in the HTTP response. The validation error reason is only exposed in log.\n \n### Logging\n\n * Logging is done using 'hapi-pino', one of the fastest logger available for HapiJs.\n * Logger uses a pretty log style only in development environments.\n \n### Database\n\nMongoDB is used for this project. Because I wanted to use transactions I needed to use a Mongo replicaset.\nThe docker-compose provided in this project is creating the required MongoDB replicaset.\n\n### Docker\n\nDocker files are provided for:\n * development environment - `Dockerfile.dev`. This is using nodemon for automatically reloading the service when changes are made.\n * production environment - `Dockerfile`\n\n### Docker Compose\n\nA docker compose is provided. This docker compose contains our service and also a MongoDB replicaset. The docker-compose will:\n * start multiple Mongo nodes\n * configure them as a replicaset\n * start service\n \n### Minikube\n\nThe project can also be started using minikube. The instructions are available here (TBD).\n \n### Linting\n\nPlease run `npm run lint` for linting.\n\n### Testing\n\nPlease run `npm run test` for running both integration and unit tests. ATM only integration tests are provided.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirceaalexandru%2Fstartershell-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirceaalexandru%2Fstartershell-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirceaalexandru%2Fstartershell-mongo/lists"}