{"id":16412827,"url":"https://github.com/script47/motorway-tech-test","last_synced_at":"2025-07-12T19:38:20.640Z","repository":{"id":199799009,"uuid":"703593498","full_name":"Script47/motorway-tech-test","owner":"Script47","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-11T23:25:29.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-10T02:48:16.405Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Script47.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}},"created_at":"2023-10-11T14:29:53.000Z","updated_at":"2023-10-11T16:33:03.000Z","dependencies_parsed_at":"2023-10-12T14:25:14.587Z","dependency_job_id":null,"html_url":"https://github.com/Script47/motorway-tech-test","commit_stats":null,"previous_names":["script47/motorway-tech-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2Fmotorway-tech-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2Fmotorway-tech-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2Fmotorway-tech-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2Fmotorway-tech-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Script47","download_url":"https://codeload.github.com/Script47/motorway-tech-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232698395,"owners_count":18562874,"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-10-11T06:49:54.449Z","updated_at":"2025-01-06T09:20:35.959Z","avatar_url":"https://github.com/Script47.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Preface\n\nThis is my first time using Nest.js, I came across it a few months ago but never got the chance to try it out, and so I\nthought this might be the perfect opportunity - or not!\n\n### Assumptions \u0026 Guiding Principles\n\n- We will be able to dictate to the API consumers how we expect dates e.g. pass dates as encoded strings\n- Skinny controllers, skinny repositories, fat services\n- If you have limited time, prefer e2e tests over integration/unit specifically for APIs\n\n### Repo\n\nI've reorganised things to make it neater following a clear mono-repo strategy.\n\n### Setup\n\nI've setup a network so all containers can communicate with each other but we only surface up `nginx:80` for public\nuse:\n\n- `nginx`\n    - Web server, port 80,\n    - Reverse proxy setup with upstream possibility to setup multiple instances\n- `api`\n    - Nest.js API, no external ports,\n- `db`\n    - DB, no external ports\n- `redis`\n    - Redis, no external ports\n\n### API\n\n- `GET http://localhost/vehicle-states/3?timestamp=2022-09-12%2010%3A00%3A00%2B00`\n\n**Response:**\n\n```json\n{\n  \"vehicleId\": 3,\n  \"state\": \"selling\",\n  \"timestamp\": \"2022-09-11 23:21:38+00\"\n}\n```\n\n## App\n\n- `./api`\n    - Setup the `.env` file from the `.env.example` - if it hasn't been done so already\n- `./db`\n    - Setup the `.env` file from the `.env.example` - if it hasn't been done so already\n\n**Run:**\n\n```\ndocker-compose up -d --build\n```\n\n## Tests\n\nFor brevity, my focus was on the e2e tests, though, I did go back and add unit/integration tests, you'll need to set `api` target to dev, rebuild, and then run:\n\n**Run:**\n\n```\nnpm run test # unit + integration\nnpm run test:e2e # e2e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript47%2Fmotorway-tech-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscript47%2Fmotorway-tech-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript47%2Fmotorway-tech-test/lists"}