{"id":22083607,"url":"https://github.com/dockerbound-immortal/pern","last_synced_at":"2026-04-10T15:01:55.091Z","repository":{"id":43808067,"uuid":"511671867","full_name":"Dockerbound-Immortal/PERN","owner":"Dockerbound-Immortal","description":"Postgres, Nginx, React, \u0026 Node development stack utilising Webpack.","archived":false,"fork":false,"pushed_at":"2022-07-07T21:05:19.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T19:03:51.205Z","etag":null,"topics":["adminer","docker","nginx","nodejs","postgres","react","webpack"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/Dockerbound-Immortal.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}},"created_at":"2022-07-07T20:55:13.000Z","updated_at":"2022-07-07T21:10:12.000Z","dependencies_parsed_at":"2022-09-15T01:53:20.799Z","dependency_job_id":null,"html_url":"https://github.com/Dockerbound-Immortal/PERN","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/Dockerbound-Immortal/PERN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FPERN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FPERN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FPERN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FPERN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dockerbound-Immortal","download_url":"https://codeload.github.com/Dockerbound-Immortal/PERN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dockerbound-Immortal%2FPERN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259704412,"owners_count":22898858,"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":["adminer","docker","nginx","nodejs","postgres","react","webpack"],"created_at":"2024-12-01T00:16:27.753Z","updated_at":"2025-12-30T20:07:40.993Z","avatar_url":"https://github.com/Dockerbound-Immortal.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PERN Microservices\n\nA simplified microservices template for use with docker-compose.\nEach service is separated by a network, ensuring local services\nonly have access to their local database within their own network.\n\nServices are expected to communicate over their APIs, maintaining\na copy of their own database entries if necessary. This means\neach service built within the architecture is modular, it can be\nremoved or replaced and still allow the other services to function.\n\nAn Nginx gateway routes to different services on different ports\nusing the Nginx configuration. Not only is this method of direct\nrouting faster, it also acts as protection from the greater web.\n\n## Usage\n\nTo get started, make sure you have [Docker installed](https://docs.docker.com/docker-for-mac/install/) on your system, and then clone this repository.\n\nContainers can be brought up with the docker-compose.dev.yml by running the following command: \u003ccode\u003edocker-compose -f docker-compose.dev.yml up --build -d\u003c/code\u003e\n\nonly exposed endpoints are available from your localhost, using: \u003ccode\u003edocker ps\u003c/code\u003e you can see which ports are available from your localhost\nby the 0.0.0.0 address. Other ports are only available within the docker networks, these can communicate via their container names over the docker\nnetwork, but it is not necessary to expose them to the localhost.\n\nData is persisted to the database via volumes. You can add more services by adding them to the docker-compose file, along wth updating\nthe nginx.conf file to include the routes to expose. By default this is set up for a single service, you may wish to set up routes\nfor each service named as ````/service````. This is performed\nin the nginx conf by using the container name followed by the port:\n\n\u003cpre\u003e\n\u003ccode\u003e\n    location /api/ {\n        proxy_pass http://artemis-api:4000/;\n    }\n\u003c/code\u003e\n\u003c/pre\u003e\n\nTo add more services you may wish to change the config to something more like:\n\n\u003cpre\u003e\n\u003ccode\u003e\nserver {\n    listen 80;\n\n    server_name localhost;\n\n    location / {\n        proxy_set_header Host $http_host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_http_version 1.1;\n        proxy_set_header Connection $http_connection;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;\n        proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;\n        proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;\n        proxy_cache_bypass $http_upgrade;\n        proxy_read_timeout 900;\n        client_max_body_size 0;\n        proxy_buffering off;\n        add_header X-Accel-Buffering no;\n\n        proxy_pass http://gateway-service:3000/;\n    }\n\n    location gateway/api/ {\n        proxy_pass http://gateway-service-api:4000/;\n    }\n}\n\u003c/code\u003e\n\u003c/pre\u003e\n\n## Package Manager\n\nThe package manager used by default is ````yarn````. Yarn is somewhat faster than ```npm``` when initially installing a large number of packages. We also prefer the syntax since you no longer need the ````run```` keyword like you do when using ````npm````.\n\n## Exposed Ports\n\n- **nginx** - `:8080`\n- **adminer** - `:8081`\n\n## Commands\n\n- ````docker-compose -f docker-compose.dev.yml up --build -d ````\n\n## Technologies Included\n\n- React\n- Node\n- TypeScript\n- Webpack\n\n## Git Setup\n\nWe recommend using different repositories for each service, and\nthen having separate repositories for the API and Client. Whilst each\nservice is packaged together with the API and Client, it is important\nto recognise that these themselves are separate modular sub-services. The API\nshould not be dependent on the client of vice-versa. You can achieve this by initialising each as it's own repo, then reinisitalising the main repo.\n\nFor a basic application we recommend keeping the Client and Server as separate services. This is how the repository is configured as default. For a more advanced setup (when multiple services are invovled) I would recommend creating a directory for each service in the \u003ccode\u003eservices\u003c/code\u003e folder, you should then create your \u003ccode\u003eclient\u003c/code\u003e and \u003ccode\u003eapi\u003c/code\u003e for each of these services within their own project folders, changing the paths within the \u003ccode\u003edocker-compose.yml\u003c/code\u003e as required. To add more services you can easily duplicate the \u003ccode\u003eclient\u003c/code\u003e\nand \u003ccode\u003eapi\u003c/code\u003e services, I recommend naming each service as \u003ccode\u003e{service-name}-client}\u003c/code\u003e and \u003ccode\u003e{service-name}-api\u003c/code\u003e respectively.\n\nWhen adding services you will also need to update the nginx.config to route the request on a per-service basis. We use Nginx as our gateway for requests, this is set up as reverse proxy to keep our internal requests secure.\n\n## Child Repositories\n\nThese repositores are the subrepositories used in this tempalte. These are setup to work out of the box\nwith the PERN stack. You can use these as templates for your own services, or create our own from scratch.\n\n- [Node API](https://github.com/PlanetDebug/PERN-API)\n- [React Client](https://github.com/PlanetDebug/PERN-CLIENT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockerbound-immortal%2Fpern","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdockerbound-immortal%2Fpern","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdockerbound-immortal%2Fpern/lists"}