Declaring a Project in the Workspace
Although a project may exist in your repository, it’s not accessible from moon until it’s been mapped in theprojects setting found in .moon/workspace.yml.
Let’s say we have a frontend web application called “client” and a backend application called “server”:
.moon/workspace.yml
moon project client and moon project server to display information about each project:
If these projects were not mapped, or were pointing to an invalid source, the command would throw an error.
The
projects setting also supports a list of globs if you’d prefer to not manually curate the projects list! See the Setup Workspace guide for more details.Configuring a Project
A project can be configured in two ways:Global Task Configuration
Through
.moon/tasks/**/* config files, which define file groups and tasks that are inherited by matching projects within the workspace. Perfect for standardizing common tasks like linting, typechecking, and code formatting.Project-Specific Configuration
Through the
<project>/moon.yml config file, found at the root of each project, which defines file groups, tasks, dependencies, and more that are unique to that project.Project-Specific Tasks
Let’s configure both the client and server projects with their own build tasks:- Client Project
- Server Project
apps/client/moon.yml
Shared Task Configuration
Common tasks that apply to multiple projects can be defined in.moon/tasks/ and inherited by all matching projects:
.moon/tasks/node.yml
language: 'javascript' will inherit these tasks automatically!
Project Dependencies
If a project depends on another project (e.g., the client depends on a shared UI library), you can declare this relationship:apps/client/moon.yml
^:build target means “run the build task in all projects this project depends on”.
Adding Project Metadata
When utilizing moon in a large monorepo or organization, ownership becomes very important. moon supports theproject field within moon.yml to provide metadata:
apps/client/moon.yml
Available Metadata Fields
layer- The project layer (application,library,tool, etc.)language- The primary programming languageproject.name- Human-readable project nameproject.description- Brief description of the projectproject.channel- Communication channel (e.g., Slack channel)project.owner- Team or individual ownerproject.maintainers- List of maintainers
File Groups
File groups allow you to group similar file types for reuse across tasks:apps/client/moon.yml
@globs(sources) token expands to all files matching the sources file group.
Example: Complete Project Configuration
Here’s a complete example bringing it all together:apps/web/moon.yml
Next Steps
Create a Task
Learn how to configure and optimize tasks
Project Configuration Reference
View all available project configuration options