Skip to content

hiiq/boilerplate-monorepo

 
 

Repository files navigation

@boilerplate-monorepo

CircleCI codecov

A monorepo setup for winning.

😎 Show Me Already

View the demo here

😴 We're big fans of siestas so we let our app take nap too. ⏳ Please be patient while it spins up.

🗳️ What's in the box?

  • Postgres (database)
  • GraphQL (service)
  • React (ui)

⚙️ System Requirements

  1. Docker v19.03+
  2. Node v14.2.0+
  3. Yarn v1.19.1+

🍔 Recommended Tooling

  • Insomnia v7.0.6+
    • Easily call GraphQL queries/mutations
    • Make REST calls too!
    • Take a tour of our schema with built-in Docs
    • Load up the config and go!

🏎 Getting Started

# 1. ⬇️ Clone this repo
git clone git@github.com:n8io/boilerplate-monorepo.git

# 2. 🛠️ Generate local environment variable files
(
  cd packages \
  cp -n service/.env.example service/.env \
  cp -n ui/.env ui/.env.local \
  ;
)

# 3. 🌱 Install dependencies
yarn

# 4. ↩️ Add hosts file entry (if needed)
yarn hosts

🤓 Development Experience

# Start all the things!
yarn start # 👏🤜🤛🍾🥳

# When you're done dev'ing, spin down the Docker containers
yarn down

🧪 Testing

🏘️ Unit Tests

# Run all the tests
yarn test

# Watch all the tests
yarn test:watch

🌲 End-to-End Tests

This project is setup to run functional tests using Cypress.

# Opens up Cypress test dashboard
yarn e2e:dev

🗂 Database Migrations

NOTE Database migrations are ran adhoc. You must manually run them before using the app.

Run existing migrations

yarn db:migrate

Rollback a single migration

yarn db:migrate:down

Generate a new migration

yarn db:migrate:gen create-table-foo # the name is up to you

Existing migration files can be found in packages/service/src/migrations.

🧰 Tooling

🎣 Hook Code Generator

There is a handy dandy generator for creating React hooks for our GraphQL queries/mutations. Give it a try!

cd packages/tool-hook-generator

# Refresh your schema file
# Make sure your GraphQL server is running before you run this command
yarn codegen # Rerun as needed

# Creates a `useUserRegister` mutation hook
yarn hook:mutation UserRegister

# Creates a `useUserSelf` query hook
yarn hook:query UserSelf

📘 Cutting a release

WARNING: Running the command below will:

  1. Bump versions in all package.json's using conventional commits
  2. Update READMEs using conventional commits
  3. Tag and push a new release to GitHub
  4. Assuming you have a CircleCI workflow setup...
    1. It will kick off a release build
    2. Don't worry, it won't deploy until you manually approve the deployment in CircleCI

While it is possible to unravel, please make sure you mean to release a new version of the repo when running it.

Pending you have permissions to push to master, run the following:

GH_TOKEN=<YOUR_GITHUB_PERSONAL_ACCESS_TOKEN> yarn release

# Follow the prompts

License

MIT

Packages

No packages published

Languages

  • JavaScript 99.1%
  • Other 0.9%