Skip to content
/ fvst-monorepo Public template

An example of how to set up microservices architecture on GCP

Notifications You must be signed in to change notification settings

fvst-dev/fvst-monorepo

Repository files navigation

FVST Monorepo

Most startups start with a monolithical application and when their business picks up and they outgrow the monolith the migration to microservices starts. This migration is usually painful.

This repositories' goal is to simplify microservices architecture and enable companies to still start with a monolith, but have an easy path to add new services without having to change much.

We use GCP as the cloud provider - it provides an extensive free tier to get started - https://cloud.google.com/free/

Features

  • 100% customizable to your needs - just copy this repository template and make your own changes.
  • Community driven
    • Have an idea to make it better for everyone? Start a discussion or open a PR!
    • Not sure how to achieve something or confused on how something is built? Ask a question and we'll help you out!
  • Monorepo pattern to keep all your code in one place and have your team work on a single source of truth.
    • Easy to add new services without the headache of configuring a new repository
    • Easy to share code between services without having to manage separate NPM libraries
    • Easy to run locally, just start the docker compose file and run npm run dev to bring the entire stack up.
  • CLI baked into the repository to automate complex workflows.
    • Easy to add your own custom commands that your team can utilize.
  • Infrastructure as code, allowing you to easily and quickly set up your environments. We leverage the following in our infrastrucutre:
  • Github Action CI workflows
    • Continuous Delivery
      • Build new docker containers from code
      • Deploy docker containers to google cloud
    • Validate your entire codebase in each pull request
    • Get a terraform plan in each pull request
    • Focus on speed, workflows heavily utilize
      • caches (Utilizes turborepo remote cache and a custom cache server to speed up all CI jobs including docker container builds)
      • geolocation (GitHub Action workers are US based, so artifact registry and cloud storage buckets are US based to reduce latency)
      • docker files are configured for speed and small images
  • Share tooling configuration across services and packages
  • Example services implemented using popular technologies
  • DX
    • We format modified code on each commit, and it's easy to extend this behaviour to add your own pre-commit validation.

Documentation

Folder structure

The root of the Monorepo contains the turborepo configuration files, and the main package.json which defines the directories and scripts used in the Monorepo. The directories set up in the template are following this structural logic.

Directory What goes inside of it
apps All backend and frontend apps
packages Here we keep code that we want to re-use across apps
tooling Here we have all the configuration code for all the tooling we use inside the monorepository
infra Here we have all the infrastructure configuration code to deploy to GCP
docs Documentation

NPM Scripts

Command Description
npm run lint Runs prettier, eslint and tsc (checks types)
npm run format Runs prettier and eslint --fix
npm run dev Starts the dev environment for all apps
npm run build Builds all the apps and packages
npm run test Runs the test suite

About

An example of how to set up microservices architecture on GCP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published