{"id":15681025,"url":"https://github.com/dustinsgoodman/serverless-microservices-graphql-template","last_synced_at":"2025-05-07T11:41:47.234Z","repository":{"id":37095067,"uuid":"464004883","full_name":"dustinsgoodman/serverless-microservices-graphql-template","owner":"dustinsgoodman","description":"A Serverless Framework getting started template for building microservice architectures with a public GraphQL API using nx for monorepo support.","archived":false,"fork":false,"pushed_at":"2023-04-21T11:07:19.000Z","size":2995,"stargazers_count":11,"open_issues_count":22,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-06T16:10:20.294Z","etag":null,"topics":["apollo-server","graphql","graphql-server","hacktoberfest","microservices-architecture","nodejs","nx","serverless","serverless-framework"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dustinsgoodman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-27T01:01:33.000Z","updated_at":"2023-07-27T12:08:01.000Z","dependencies_parsed_at":"2022-06-24T13:32:48.386Z","dependency_job_id":null,"html_url":"https://github.com/dustinsgoodman/serverless-microservices-graphql-template","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":"sudokar/nx-serverless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinsgoodman%2Fserverless-microservices-graphql-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinsgoodman%2Fserverless-microservices-graphql-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinsgoodman%2Fserverless-microservices-graphql-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dustinsgoodman%2Fserverless-microservices-graphql-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dustinsgoodman","download_url":"https://codeload.github.com/dustinsgoodman/serverless-microservices-graphql-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873229,"owners_count":21817704,"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":["apollo-server","graphql","graphql-server","hacktoberfest","microservices-architecture","nodejs","nx","serverless","serverless-framework"],"created_at":"2024-10-03T16:48:19.322Z","updated_at":"2025-05-07T11:41:47.211Z","avatar_url":"https://github.com/dustinsgoodman.png","language":"TypeScript","readme":"# Serverless Micoservices w/ GraphQL Template\n\n[![serverless](http://public.serverless.com/badges/v3.svg)](http://www.serverless.com)\n[![Nx monorepo](https://img.shields.io/badge/monorepo-Nx-blue)](https://nx.dev/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/dustinsgoodman/serverless-microservices-graphql-template/blob/main/LICENSE.md)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/dustinsgodman/serverless-template)\n[![codecov](https://codecov.io/gh/dustinsgoodman/serverless-microservices-graphql-template/branch/main/graph/badge.svg?token=HZCVZ0DPWD)](https://codecov.io/gh/dustinsgoodman/serverless-microservices-graphql-template)\n\nA template for a Serverless Framework microservices architecture based on the [nx-serverless-template by sudokar](https://github.com/sudokar/nx-serverless).\n\n## Table of contents\n\n- [Whats Included](#whats-included)\n- [Template Layout](#template-layout)\n- [Prerequisites](#prerequisites)\n- [Usage](#usage)\n- [Further help](#further-help)\n- [Contribution](#contribution)\n- [Support](#support)\n- [Maintainer](#maintainer)\n- [License](#license)\n\n## Whats Included\n\n- A template project layout using latest version of Nx and Servrless Framework\n- An easy to use workspace generator to generate a template/service with Serverless Framework files and related Nx configuration\n- Configured with a basic AWS provider that can be easily adopted to any cloud provider\n- Serverless Offline microservices architecture support\n\n### How does this differ from the original template?\n\nThe original template is phenomenal, but I was aiming for some additional customizations and different core libraries. Specifically:\n\n- This version uses esbuild instead of webpack\n- This version provides some common utility functions for a microservices architecture\n- Upstream used Nx Cloud and some other 3rd party tools where this version uses just GitHub Actions\n- This version provides opinionated public-api and background-jobs services for consumption.\n\n## Template Layout\n\n```shell\n.\n├── services/    # each serverless configuration/template and its associated files\n├── libs/      # shared libraries\n├── tools/\n├── README.md\n├── jest.config.ts\n├── jest.preset.ts\n├── nx.json\n├── package.json\n├── serverless.common.yml  # shared serverless configuration\n├── tsconfig.base.json\n├── workspace.json\n├── .editorconfig\n├── .eslintrc.json\n├── .gitignore\n├── .husky              # git hooks\n├── .nvmrc\n├── .prettierignore\n├── .prettierrc\n├── docker-compose.yml\n```\n\n## Prerequisites\n\n- [Node.js 16](https://nodejs.org/) - [nvm](https://github.com/nvm-sh/nvm) recommended\n- [Yarn](https://yarnpkg.com)\n- [Serverless Framework v3](https://serverless.com/)\n- 💅 Code format plugins\n  - [Eslint](https://eslint.org/)\n  - [Prettier](https://prettier.io/)\n  - [EditorConfig](https://editorconfig.org/)\n- [Jest](https://jestjs.io/) for testing\n\n## Usage\n\n**Install project dependencies**\n\n```shell\nyarn\n```\n\n**Setup and run infrastructure**\n\nAll needed services, such as databases, are managed via Docker. When working in this project, it is\nrecommended that you start all the infrastructure. When you're not working on the project, you should\nstop all the infrastructure.\n\n```shell\n# Creates the docker container and starts it.\nyarn infrastructure:setup\n\n# Stops the docker container and deletes it.\nyarn infrastructure:teardown\n\n# Starts the docker container. Requires the container to exist.\nyarn infrastructure:start\n\n# Stops the docker container. Requires the container to exist.\nyarn infrastructure:stop\n```\n\n**Generate a new service**\n\n```shell\nyarn workspace-generator service \u003cSERVICE_NAME\u003e\n```\n\n**Generate a new library**\n\n```shell\nyarn workspace-generator lib \u003cLIBRARY_NAME\u003e\n```\n\n**Packaging services**\n\n```shell\n# Package a single service\nyarn build \u003cSERVICE_NAME\u003e\n\n\n# Package all services afffected by a change\nyarn affected:build\n\n\n# Package all services\nyarn all:build\n```\n\nPass the `--stage=\u003cSTAGE_NAME\u003e` flag if you're creating a build for a specific environment.\n\n**Deploying services**\n\n```shell\n# Deploy a single service to a stage\nyarn deploy \u003cSERVICE_NAME\u003e --stage=\u003cSTAGE_NAME\u003e\n\n# Deploy all services to a stage\nyarn deploy:all --stage=\u003cSTAGE_NAME\u003e\n```\n\n**Removing deployed service**\n\n```shell\n# Remove a single service from a stage\nyarn remove \u003cSERVICE_NAME\u003e --stage=\u003cSTAGE_NAME\u003e\n\n# Remove all services for a stage\nyarn remove:all --stage=\u003cSTAGE_NAME\u003e\n```\n\n**Run tests**\n\n```shell\n# Run tests for a single service or library\nyarn test \u003cSERVICE_OR_LIB_NAME\u003e\n\n# Run tests for all services or libraries affected by a change\nyarn test:affected\n\n# Run all tests\nyarn test:all\n```\n\n**Analyze function bundles**\n\nWhen building serverless applications, it's important to understand your memory footprint due to Lambda's memory settings as you can experience unexpected errors. As such, the following script can be used to understand the memory footprint of your individual functions:\n\n```shell\nyarn analyze \u003cSERVICE_NAME\u003e --function=\u003cFUNCTION_NAME\u003e\n```\n\nThis will open the results in a new tab in your browser with the results using [esbuild visualizer](https://www.npmjs.com/package/esbuild-visualizer).\n\n**Run offline / locally**\n\n- To run a single service\n\n```shell\nyarn serve \u003cSERVICE_NAME\u003e\n```\n\n**Understand your workspace**\n\n```\nyarn dep-graph\n```\n\n## Further help\n\n- Visit [Serverless Documentation](https://www.serverless.com/framework/docs/) to learn more about Serverless framework\n- Visit [Nx Documentation](https://nx.dev) to learn more about Nx dev toolkit\n\n## Contribution\n\nFound an issue? Feel free to raise an issue with information to reproduce. Pull requests are welcome to improve.\n\n## Support\n\nIf you like this template, please go support [sudokar](https://github.com/sudokar) as this template would not have been possible without their original work. However, you can always leave this version a star ⭐. 😄\n\n## Maintainer\n\nThis version of the template is authored and maintained by [dustinsgoodman](https://github.com/dustinsgoodman)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinsgoodman%2Fserverless-microservices-graphql-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdustinsgoodman%2Fserverless-microservices-graphql-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdustinsgoodman%2Fserverless-microservices-graphql-template/lists"}