Skip to content

๐Ÿš€๐Ÿค– Lerna Monorepo, Apollo Graphql Microservice over NodeJS Example (TypeScript)

Notifications You must be signed in to change notification settings

otomer/monorepo-graphql-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Monorepo + GraphQL + TypeScript

Monorepo Repository

lerna


Technologies in use

Getting Started

  1. Clone this repository using SSH:

    git clone [email protected]:otomer/monorepo-graphql-typescript.git

  2. Install Lerna, Typescript and Yarn globally

    yarn global add lerna typescript yarn

  3. Bootstrap all packages in the monorepo (?)

    lerna bootstrap

That's it, you are all set!

Running 'My Service' Package

  1. Run: lerna bootstrap (Run this only if you pull some cruical package changes)
  2. Run: lerna run compile (Compiles all packages)
  3. Navigate to: /packages/services/myservice
  4. Start the application yarn start

GraphQL Server

5 Navigate to http://localhost:4000/graphql 6. Execute one of the examples given in /packages/services/myservice/examples.md

Graphql Example

Project Structure

Breaking down the basic structure and the configurations

packages/
  libs
    agify                 // Agify 3rd party lib integration, for example
      dist/
      src/
        index.ts
      package.json        // package-specific deps and scripts
      tsconfig.json       // config used to build for publishing
  services
    myservice/            // service package, just for example
      dist/
      src/
        server.ts
      package.json        // package-specific deps and scripts
      README.md           // shown in npmjs.com. included in npm artifact
      tsconfig.json       // config used to build for publishing

.babelrc                  // project-wide babel configuration
.editorconfig             // config for consistent coding styles between editors/IDEs
.eslintignore             // eslint (linter) ignored directories/files
.eslintrc                 // eslint (linter) configuration
.gitignore                // github's default node gitignore with customizations
.prettierignore           // prettier ignored directories/files
.prettierrc               // prettier configuration
jest.config.js            // jest configuration
lerna.json                // lerna configuration
package.json              // common dev deps and workspace-wide scripts
README.md                 // workspace-wide information. shown in github
tsconfig.json             // common typescript configuration
yarn.lock                 // the only lock file in the repo. all packages combined

Testing

Test runner is jest. To run all eligible tests across all packages in the monorepo:

yarn test

Linting, Formatters and Ethics

Tools being used:

  • Prettier - Opinionated Code Formatter.
  • ESlint - Static code analysis tool for identifying and reporting problematic patterns found in JavaScript code.

All tools are configured in project level and takes part during development, commit, open Pull Requests and in our CI/CD flow.

  1. Run Lint: yarn lint
  2. Run Prettier: yarn prettier

To integrate Prettier in your editor, download this plugin: for Visual Studio Code / for WebStorm

For WebStorm: To run prettier on auto-save - Go to .idea/watcherTasks.xml file and enable it.


ForTheBadge built-with-love

Tomer Ovadia @ github

About

๐Ÿš€๐Ÿค– Lerna Monorepo, Apollo Graphql Microservice over NodeJS Example (TypeScript)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published