{"id":24288632,"url":"https://github.com/ppodds/url-shortener","last_synced_at":"2026-04-24T05:39:08.217Z","repository":{"id":103819525,"uuid":"476274694","full_name":"ppodds/url-shortener","owner":"ppodds","description":"A simple URL shortener written in Nest.js","archived":false,"fork":false,"pushed_at":"2022-04-01T09:15:07.000Z","size":553,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-16T10:33:12.688Z","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/ppodds.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":"2022-03-31T11:25:00.000Z","updated_at":"2022-03-31T11:25:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"77d3ff73-9373-49aa-a725-1cc187bc637e","html_url":"https://github.com/ppodds/url-shortener","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/ppodds%2Furl-shortener","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppodds%2Furl-shortener/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppodds%2Furl-shortener/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppodds%2Furl-shortener/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppodds","download_url":"https://codeload.github.com/ppodds/url-shortener/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242123866,"owners_count":20075447,"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":"2025-01-16T10:20:12.958Z","updated_at":"2026-04-24T05:39:03.182Z","avatar_url":"https://github.com/ppodds.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# url-shortener\n\nThis is a [homework](https://drive.google.com/file/d/1AreBiHDUYXH6MI5OqWpKP-f6-W0zA8np/view) of Dcard backend intern.\n\n## Installation\n\n### Environment Variables\n\nCreate a new env file and edit environment variables.\n\n`.env`\n\n```env\nAPP_URL = \"http://localhost:3000\"\n\nDB_TYPE = mariadb\nDB_HOST = 127.0.0.1\nDB_PORT = 3306\nDB_USER = url-shortener\nDB_PASSWORD = secret\nDB_NAME = url-shortener\n```\n\n### Install Dependencies\n\n```bash\nnpm i\n```\n\n### Run Server\n\n```bash\n# Development\nnpm run start:dev\n\n# Production\nnpm run build\nnpm run start:prod\n```\n\n## Introduction\n\n### Tech Stack\n\n- Framework\n  - Nest.js (Express Backend)\n    - Progressive backend framework written in TypeScript\n- Database\n  - MySQL / MariaDB\n    - Relational database\n- Third Party Library\n  - typeorm\n    - TypeScript library for ORM\n  - mysql2\n    - TypeORM mysql / mariadb driver\n  - helmet\n    - Protect the app from some well-known web vulnerabilities by setting HTTP headers\n  - husky / lint-staged\n    - Pre-commit hook\n  - prettier\n    - Code formatter\n  - eslint\n    - TypeScript linter\n\n### Routes\n\n#### POST `/api/v1/urls`\n\n##### Request Body\n\n```typescript\n{\n  url: string,\n  expireAt: string\n}\n```\n\nexpireAt must be a string in ISO 8601 format.\n\n##### Response\n\n- 201 Created\n\n  ```typescript\n  {\n    id: string,\n    shortUrl: string\n  }\n  ```\n\n- 400 Bad request\n\n  ```json\n  {\n    \"statusCode\": 400,\n    \"message\": [\"expireAt must be a valid ISO 8601 date string\"],\n    \"error\": \"Bad Request\"\n  }\n  ```\n\n#### GET `/:id`\n\n##### Parameters\n\n- `id`: string\n  - short URL id\n\n##### Response\n\n- 302 Redirect to original URL\n- 404 original URL not found or expired\n\n  ```json\n  {\n    \"statusCode\": 404,\n    \"message\": \"Url not found\",\n    \"error\": \"Not Found\"\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppodds%2Furl-shortener","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppodds%2Furl-shortener","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppodds%2Furl-shortener/lists"}