Skip to content

The Zero One Group approach to Monorepo uses a standardized boilerplate for building new projects, ensuring consistency and scalability.

Notifications You must be signed in to change notification settings

zero-one-group/monorepo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zero One Group Monorepo

Table of Contents

Overview

This repository contains framework projects utilizing moonrepo and the technology stack commonly used within Zero One Group, with TypeScript and Go as the main languages.

To get started, several templates for backend and frontend applications are available. The frontend stack includes React with the Vite bundler, as well as Next.js. A shared UI Library, shadcn/ui, is also provided.

Additionally, the following tools and libraries are included:

  • Tailwind CSS for utility-first CSS framework.
  • Radix UI for accessible, unstyled UI components.
  • Vitest for fast unit testing.
  • Playwright for end-to-end testing.
  • Biome for code formatting and linting.

Quick Start

To begin, we suggest installing moon globally, read the documentation here. Then, follow these steps (don't forget to replace moon-project with your project name):

  1. Clone this repository: pnpm dlx tiged zero-one-group/monorepo moon-project
  2. Install the necessary dependencies: cd moon-project && pnpm install
  3. Create .env file or duplicate the .env.example file, then configure required variables.

Find and replace the myorg namespace and example.com string with your own organization or project-specific namespace. This is necessary to ensure that all configurations, dependencies, and references are correctly aligned with your project's unique identifier. This includes updating any configuration files, package names, and other references throughout the codebase where myorg is used.

Golang application

Currently, Go is not supported as an official moonrepo toolchain. You need to manually install and configure it for your project. Please read the Go installation docs.

For a list of supported toolchains, visit moonrepo documentation.

Local development server

This repository includes a local development server for testing and development purposes. Currently, it supports PostgreSQL, Valkey (drop-in replacement for Redis), mailpit (SMTP server), and pgweb (PostgreSQL web interface).

These commands are used for managing the local development server:

pnpm compose:up       # Start local development server
pnpm compose:down     # Stop local development server
pnpm compose:cleanup  # Remove all local development server data

Creating application from template

To get started, you can use the following command to generate a new application from a template.

moon generate TEMPLATE_NAME

Example, creating React application:

moon generate template-react-app

View all available templates by looking at folders with template- prefix in this repository.

Current available templates are:

Template Name Description
template-golang Basic Go application for backend
template-react-app SPA React Router application with Tailwind CSS
template-react-ssr SSR React Router application with Tailwind CSS
template-shared-ui Collections of UI components based on shadcn/ui
template-nextjs Next.js application with Tailwind CSS
template-strapi Strapi headless CMS with PostgreSQL and Nodemailer
template-astro Astro website with Tailwind CSS

Moon commands

After setting up your project, use the following commands for common tasks:

Command Description
moon :dev Start developing the project
moon :build Build all projects
moon :test Run tests in all projects
moon :lint Lint code in all projects
moon :format Format code in all projects
moon <project_id>:env Print system env and individual project
moon <project_id>:<task> Run specific task by project
moon check <project_id> Run check for individual project
moon check --all Run check for all tasks
moon run '#tag:task' Run a task in all projects with a tag
moon project-graph Display an interactive graph of projects

Type moon help for more information. Refer to the moon tasks documentation for more details.

Monorepo CLI

The monorepo CLI is a command-line interface for managing and interacting with the monorepo. It provides a set of commands for common tasks such as creating application secrets, database migrations, seeders, etc.

To getting started, you can use the following command:

pnpm -s cmd --help

You can also register your own commands. To do this, you need to create a file in the internal/cmd directory then register the sub-commands in the cli.ts file.

E2E Testing

This monorepo includes E2E tests for testing the application, powered by Playwright. To run E2E tests, you need to install Playwright dependencies. You can do this by running the following command:

Install Playwright dependencies for all projects

moon <project_id>:e2e-install

Install Playwright dependencies for a specific project

moon <project_id>:e2e-install

Run E2E tests for specific project in headless mode:

moon <project_id>:e2e

If you want to use Playwright UI mode, you can use the following command:

moon <project_id>:e2e-ui

To run E2E test for specific browser, you can use the following command:

moon <project_id>:e2e-chrome   # Run E2E test for Chrome browser
moon <project_id>:e2e-firefox  # Run E2E test for Firefox browser
moon <project_id>:e2e-mobile   # Run E2E test for Chrome Mobile browser
moon <project_id>:e2e-safari   # Run E2E test for Safari browser

Managing Dependencies

To add a new dependency to a project, you can use the following command:

pnpm --filter <project_id> add <dependency>

Or, if you want to add development dependencies, you can use the following command:

pnpm --filter <project_id> add -D <dependency>

Example:

pnpm --filter react-app add -D vitest

Updating dependencies

To update all projects dependencies, you can use the following command:

pnpm run update-deps

Cleanup projects

Sometimes it is necessary to clean up dependencies and build artifacts from the project. To do this, you can use the following command:

pnpm run cleanup

After all, you can reinstall the dependencies and build the project.

Tasks to Complete

After creating a new project from this template repository, ensure you update the documentation, including:

  1. Project Overview: Briefly describe the project's purpose and features.
  2. Installation Instructions: Update steps to reflect any project-specific changes.
  3. Usage Guide: Provide instructions on how to use the project, including commands and configurations.
  4. API Documentation: If applicable, update API endpoints, request/response formats, and examples.
  5. Contributing Guidelines: Reflect any new processes or requirements for contributions.
  6. License Information: Ensure the license is accurate for the new project.

Keeping documentation current helps others understand, use, and contribute to the project.

Contributions

Contributions are welcome! Please open a pull requests for your changes and tickets in case you would like to discuss something or have a question.

Read CONTRIBUTING.md for detailed documentation.