{"id":22893616,"url":"https://github.com/sergeylukin/justt-another-assignment-solution","last_synced_at":"2025-03-31T22:36:42.918Z","repository":{"id":40416021,"uuid":"488753566","full_name":"sergeylukin/justt-another-assignment-solution","owner":"sergeylukin","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-25T18:48:05.000Z","size":3411,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T01:25:56.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://justt.sergeylukin.com/","language":"TypeScript","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/sergeylukin.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-05-04T21:53:55.000Z","updated_at":"2022-05-08T08:58:15.000Z","dependencies_parsed_at":"2022-08-09T19:50:15.073Z","dependency_job_id":null,"html_url":"https://github.com/sergeylukin/justt-another-assignment-solution","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/sergeylukin%2Fjustt-another-assignment-solution","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeylukin%2Fjustt-another-assignment-solution/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeylukin%2Fjustt-another-assignment-solution/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergeylukin%2Fjustt-another-assignment-solution/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergeylukin","download_url":"https://codeload.github.com/sergeylukin/justt-another-assignment-solution/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246552975,"owners_count":20795835,"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":[],"created_at":"2024-12-13T23:14:54.671Z","updated_at":"2025-03-31T22:36:42.897Z","avatar_url":"https://github.com/sergeylukin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JUSTT\n\n## Live demos\n\nAPI Swagger:\n\nhttps://justt.sergeylukin.com/api/\n\nLIVE demo (auto synced with `main` branch)\n\nhttps://justt.sergeylukin.com/\n\n## Quick start\n\nFor quick start, run\n\n```bash\n# copy project environment variables and spin up\ncp .env.example .env \u0026\u0026 docker-compose up\n```\n\nand visit `http://localhost/`\n\nTo make it more bullet-proof during\ndevelopment process, use following command instead:\n\n```bash\ndocker-compose up --remove-orphans --build\n```\n\nThe `--remove-orphans` is here to prevent sibling projects with same\nname and services from interfering with each other (not likely to happen but\nhey, we love bullet-proof solutions don't we).\n\nThe `--build` flag makes sure docker images are re-built and are\nup-to-date (should be fast assuming docker layers are cached by default).\n\n## Advanced usage\n\nFor more control over the deployment, keep on reading.\n\n### Architecture\n\nIn it's simplest form (which is expected to be used in production), project\nconsists of an NGINX webserver, APP (front end business logic), API (back end business logic)\nand a DB. Each piece can be scaled both vertically and horizontally:\n\n\u003cimg src=\"./architecture-prebuilt-optimized-docker-containers.png\" alt=\"Optimized docker production architecture\" width=\"350\" /\u003e\n\n## Development\n\nWhile it's great to keep things simple, development environment requires more\npieces in order to dynamically respond to code modifications:\n\n\u003cimg src=\"./architecture-dev-docker-infra.png\" alt=\"Docker development infra\" width=\"550\" /\u003e\n\n### docker-composer cluster\n\nAs mentioned in **Quick Start**, the easiest way to set up development\nenvironment is to run:\n\n```bash\ndocker-compose up --remove-orphans --build\n```\n\nhowever, it's not the only way to spin up the project...\n\n### run docker images manually\n\nIn order to have full control over cluster setup, you could build each docker\nimage separately and orchestrate them anyway you see fit. Please find the\ninstructions below on how to build and run each docker image separately.\n\n- First, make sure to have environment variables in place\n\n  ```bash\n  cp .env.example .env\n  ```\n\n- Build\n\n  ```bash\n  DOCKER_BUILDKIT=1 docker build -t justt/api -f apps/api/Dockerfile .\n  # Pay attention we're targetting builder stage specifically! All we need here\n  # is `npm install` so that we could run `npm run serve:web` to develop the\n  # app rather than having nginx serving static dist/ folder\n  DOCKER_BUILDKI=1 docker build --target builder -t justt/app -f apps/front-website/Dockerfile .\n  ```\n\n- Finally, run all the things:\n\n  ```bash\n  # DB\n  docker run -it --rm -e POSTGRES_DB=prisma -e POSTGRES_USER=prisma \\\n  -e POSTGRES_PASSWORD=prisma -p 5432:5432 --name=justt-db \\\n  --mount type=bind,source=\"$(pwd)/tmp/postgres\",destination=/var/lib/postgresql/data postgres:14-alpine\n\n  # API - please notice we're loading environment variables from .env and then we overwrite the DB_HOST value - it's required unless both api and db are on same network - I prefer to create less stuff so I'm fine with this overwrite vs network setup. Oh and it will only work on OS X and Linux, Windows has some other resolvable hostname, please check docs\n  docker run -it --rm --env-file .env -e DB_HOST=host.docker.internal -p 3333:3333 --name justt-api justt/api\n\n  # APP\n  docker run -it --rm -p 4200:4200 --name justt-app justt/app npm run serve:web\n\n  # NGINX webserver\n  docker run -it --rm -e APP_HOST=host.docker.internal -e APP_PORT=4200 \\\n   -e API_HOST=host.docker.internal -e API_PORT=3333 -p 80:80 --name=justt-web \\\n   --mount type=bind,source=\"$(pwd)/nginx.conf.dev.template,destination=/etc/nginx/templates/default.conf.template\" nginx:1.19.2\n\n  ```\n\n### docker-less\n\nIn order to run NodeJS part of application directly\nfrom your host machine, perform following steps:\n\n- Make sure you have DB and Nginx, for example you could use existing configuration\n\n  ```bash\n  docker-compose up webserver postgres --remove-orphans --build\n  ```\n\n- Install NPM dependencies and run development servers:\n\n  ```bash\n  npm install \u0026\u0026 npm run serve:all\n  ```\n\n### On premise Production\n\nRegardless to which deployment method you choose for on premise production, you'd probably need to build optimized docker images. For optimized docker images you'd need to:\n\n- make sure to setup DB and fill in production values in `.env` file\n\n- Build and run API:\n\n  ```bash\n  DOCKER_BUILDKI=1 docker build -t justt/api -f apps/api/Dockerfile .\n  docker run -it --rm --env-file .env -p 443:443 --name justt-api justt/api\n  ```\n\n- Build and run app (with nginx built-in):\n\n  ```bash\n  DOCKER_BUILDKI=1 docker build -t justt/web -f apps/front-website/Dockerfile .\n  docker run -it --rm -p 443:443 -e API_HOST={YOUR API DOMAIN NAME} -e API_PORT=443 --name justt-web justt/web\n  ```\n\n### Managed production\n\nYay! Check out https://render.com/ and out of the box working [cluster\nconfiguration](./render.yaml) of this project ([LIVE DEMO](https://justt.sergeylukin.com/)).\n\n## Tips for development\n\n### NPM dependencies versioning\n\nIn order to avoid surprises with dependencies, it's recommended to keep\nversioning locked. You can use this script to lock your versions in\n`package.json` as they appear in `package-lock.json`:\n\n```\n$ bash \u003c(curl -s https://raw.githubusercontent.com/sergeylukin/npmlock.sh/main/npmlock.sh)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeylukin%2Fjustt-another-assignment-solution","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergeylukin%2Fjustt-another-assignment-solution","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergeylukin%2Fjustt-another-assignment-solution/lists"}