{"id":17068787,"url":"https://github.com/tommedema/serverless-mono-example","last_synced_at":"2025-08-24T16:14:11.063Z","repository":{"id":141762914,"uuid":"145451857","full_name":"tommedema/serverless-mono-example","owner":"tommedema","description":"Example repo on how to use yarn workspaces together with the serverless framework.","archived":false,"fork":false,"pushed_at":"2018-08-29T23:19:15.000Z","size":121,"stargazers_count":123,"open_issues_count":4,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-21T13:16:34.477Z","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/tommedema.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}},"created_at":"2018-08-20T17:51:07.000Z","updated_at":"2025-06-05T12:37:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"bca49ff0-3766-4511-b617-3c26a8190fa7","html_url":"https://github.com/tommedema/serverless-mono-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tommedema/serverless-mono-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommedema%2Fserverless-mono-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommedema%2Fserverless-mono-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommedema%2Fserverless-mono-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommedema%2Fserverless-mono-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tommedema","download_url":"https://codeload.github.com/tommedema/serverless-mono-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tommedema%2Fserverless-mono-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271901644,"owners_count":24841120,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-14T11:14:56.847Z","updated_at":"2025-08-24T16:14:11.027Z","avatar_url":"https://github.com/tommedema.png","language":"TypeScript","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"# Serverless Mono Repo Typescript References example\n\nExample repo on how to use yarn workspaces together with the serverless framework. Utilizes [Typescript references](https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/#project-references).\n\n## Stack\n\n- Typescript (with references)\n- Lerna\n- Yarn Workspaces\n- Serverless Framework\n\n## Features\n\n- Typescript: all code is written in Typescript\n- Async lambda: the lamda exposes an async function to be run in node 8.10 on AWS\n- Pkg deploy: command to deploy a serverless service in a package\n- Package test without compilation: test packages using ts-node without having to compile\n- Mono repo packaging: mono repo packages can be depended upon by serverless services, and should be packaged in the serverless artifact prior to being uploaded to AWS\n- Root build: compile all package in an intelligent order based on a dependency graph from the mono repo root\n- Root test without compilation: test all packages from the root folder\n- Root deploy: one command to deploy all serverless services in the mono repo root based on dependency graph\n- External typeroots: allows you to define types for external packages to be used throughout the mono-repo\n- Lint in-editor (with tslint extension for visual studio code)\n- Prettier + lint root command\n- Prettier + lint on commit\n\n### Adding a repo\n\nSimply create a new folder in `packages` and run `yarn init`. Prefix serverless services with the `sls-` prefix, such that their dependencies will not be hoisted (the serverless framework doesn't support hoisted packages at the moment). Ensure that the package has a local `tsconfig.json`. When your Typescript package depends on another typescript package within the mono repo, reference to it using the package's `tsconfig.json`.\n\n### Adding types for external packages\n\nIf your external packages does not have types available from the DefinitelyTypes project (e.g. `@types/my-package`), you can easily define custom typings in the special `packages/types` package.\n\n### Running tests\n\nTo run tests in all packages, run `yarn test` from the root folder.\n\nTo run tests in a specific package, run `yarn test` from the package's folder.\n\n### Building\n\nTo build all packages based on their dependency graph order, run `yarn build` from the root folder\n\nTo build a specific package including the packages it references to, run `yarn build` from the package folder.\n\n### Deploying\n\nTo deploy a serverless service, run `yarn deploy --stage=dev --aws-profile=profile-name` from the package folder. This will build the Typescript packages used by that serverless service.\n\nTo deploy all serverless services, run the same command from the root folder.\n\n## Open issues (PRs welcome)\n\n- Editor type safety: \"on the fly\" type safety without compilation does not yet work across the mono repo, see this [vscode issue](https://github.com/Microsoft/vscode/issues/57242). Note that it seems to [partially](https://github.com/tommedema/serverless-mono-example/issues/4#issuecomment-416328781) work in WebStorm.\n- Serverless artifacts contain a few [redundant dependencies](https://github.com/serverless/serverless/pull/3889#issuecomment-414547166), presumably due to a bug in Serverless Framework's [exclude dev dependencies logic](https://github.com/serverless/serverless/blob/643c4fdd7e9c7bfd7a81c4be81a23cffd4be3113/lib/plugins/package/lib/zipService.js#L145). There is an initiative to create the [artifact manually](https://github.com/tommedema/serverless-mono-example/commit/e0f97a081f35b181d55a2523cb583168e685698d) using `yarn install --production`, but this is a slow process and is therefore not yet integrated into the master branch.\n- Yarn workspace hoisting is currently disabled for [serverless services](https://forum.serverless.com/t/using-serverless-with-yarn-workspaces/4560)\n\n## References\n\n- https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/#project-references\n- https://github.com/Soul-Master/typescript3-composite-project\n- https://stackoverflow.com/questions/51939395/how-to-use-typescripts-references-and-build-mode-to-compile-a-mono-repo-to-a-se\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommedema%2Fserverless-mono-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommedema%2Fserverless-mono-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommedema%2Fserverless-mono-example/lists"}