{"id":15591082,"url":"https://github.com/rokt33r/aws-eb-typescript-app","last_synced_at":"2025-09-27T15:30:57.627Z","repository":{"id":89071319,"uuid":"103933503","full_name":"Rokt33r/aws-eb-typescript-app","owner":"Rokt33r","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-12T12:01:02.000Z","size":15,"stargazers_count":27,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T08:12:11.061Z","etag":null,"topics":["aws","elasticbeanstalk","typescript"],"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/Rokt33r.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":"2017-09-18T12:01:38.000Z","updated_at":"2024-01-24T06:02:55.000Z","dependencies_parsed_at":"2023-06-13T19:30:12.124Z","dependency_job_id":null,"html_url":"https://github.com/Rokt33r/aws-eb-typescript-app","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/Rokt33r%2Faws-eb-typescript-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rokt33r%2Faws-eb-typescript-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rokt33r%2Faws-eb-typescript-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rokt33r%2Faws-eb-typescript-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rokt33r","download_url":"https://codeload.github.com/Rokt33r/aws-eb-typescript-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234444567,"owners_count":18833657,"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":["aws","elasticbeanstalk","typescript"],"created_at":"2024-10-02T23:39:57.736Z","updated_at":"2025-09-27T15:30:57.179Z","avatar_url":"https://github.com/Rokt33r.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typescript app deployment against AWS EB\n\nTo deploy an app built with Typescript, we have to deploy its artifacts rather than source code managed by git.\n\n## 0 - Install EB CLI\n\nTo manipulate Elasticbeanstalk, we need to use EB CLI, written in Python. We install this with PIP.\n\n```sh\npip install awsebcli --upgrade --user\n```\n\n\u003e If you don't have Python, you can download from https://www.python.org/. Any version above v2.7 or v3.4 should work.\n\u003e\n\u003e Also, you have to install `pip`. Check this link too. https://pypi.python.org/pypi/pip/\n\n## 1 - Prepare package\n\n### `package.json`\n\n```sh\n# Generate package.json\nnpm init -y\n\n# Install dependencies\nnpm i -D typescript @types/node @types/express\nnpm i express\n```\n\n### `tsconfig.json`\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"es6\",\n    \"module\": \"commonjs\",\n    \"rootDir\": \"src\",\n    \"outDir\": \"build\"\n  }\n}\n```\n\n## 2 - Create App\n\n`src/index.ts`\n\n```ts\nimport express = require('express')\n\nconst app = express()\n\napp.use((req, res) =\u003e {\n  res.send('hi')\n})\n\napp.listen(process.env.PORT, () =\u003e {\n  console.log('server is ready.')\n})\n```\n\n## 3 - Build typescript and check\n\nAdd `build` and `start` scripts to `package.json`.\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"start\": \"node build/index.js\"\n  }\n}\n```\n\nCompile and run our app with the scripts\n\n```sh\n# Compile typescript\nnpm run build\n\n# Run with compiled javascript\nPORT=3000 npm run start\n```\n\nCheck our app actually working at http://localhost:3000\n\n### 4 - Prepare Artifact\n\n`scripts/dist.sh`\n\n```sh\n# If the directory, `dist`, doesn't exist, create `dist`\nstat dist || mkdir dist\n# Archive artifacts\nzip dist/$npm_package_name.zip -r build package.json package-lock.json\n```\n\nAdd `dist` script\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"start\": \"node build/index.js\",\n    \"dist\": \"sh ./scripts/dist.sh\"\n  }\n}\n```\n\n### 5 - Deploy app\n\n```sh\n# Initialize app to EB\neb init\n\n# Initialize environment\neb create\n```\n\nAdd the below 2 lines to the bottom of `.elasticbeanstalk/config.yml`.\n\n```yml\ndeploy:\n  artifact: dist/aws-eb-typescript-app.zip\n```\n\nDeploy again\n\n```sh\neb deploy --staged\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frokt33r%2Faws-eb-typescript-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frokt33r%2Faws-eb-typescript-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frokt33r%2Faws-eb-typescript-app/lists"}