Monorepo Architecture
Relevant source files
The following files were used as context for generating this wiki page:The Ever Teams platform is structured as a monorepo, a single repository containing multiple distinct projects with well-defined relationships. This architecture facilitates code sharing, streamlined dependency management, and consistent tooling across the entire platform. The monorepo is managed using a combination of Yarn Workspaces, Lerna, Nx, and Turborepo to optimize development workflows, build processes, and code organization.
The repository is divided into two main categories: apps, which are deployable applications (like the web frontend and mobile app), and packages, which are shared libraries consumed by the applications. This structure promotes reusability and maintains a clear separation of concerns between different parts of the system.
Monorepo Tooling
The project leverages a suite of tools to manage the complexities of the monorepo, each serving a specific purpose.
This diagram shows the hierarchy of tools used to manage the monorepo.
Sources: package.json:28-124, 153-164
| Tool | Purpose | Configuration File |
|---|---|---|
| Yarn Workspaces | Manages dependencies across the monorepo, allowing packages to reference each other directly. It's the foundation for linking local packages. | package.json |
| Lerna | Used for managing multi-package repositories. The bootstrap command is used to link dependencies together. | lerna.json |
| Nx | A smart build system that provides tools for dependency graph analysis, caching, and running tasks only on affected projects. | nx.json, apps/web/project.json |
| Turborepo | A high-performance build system that caches build outputs to speed up development and CI/CD pipelines. | turbo.json |
Yarn Workspaces
Yarn Workspaces is configured in the root package.json to define the locations of the different projects (apps and packages). This allows for hoisting dependencies to the root node_modules folder and linking local packages.
"workspaces": {
"packages": [
"apps/web",
"apps/server-web",
"apps/playground",
"packages/*",
"libs/*",
"tools"
],
"nohoist": []
}
Sources: package.json:166-177
Nx
Nx is used for intelligent task execution. It understands the dependency graph of the monorepo, enabling commands that only affect a subset of projects. Key scripts like dep-graph and affected:* rely on Nx. Project-specific configurations are defined in project.json files within each app/package.
Example of an Nx project configuration for the web app:
{
"name": "web",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/web",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/next:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"root": "apps/web",
"outputPath": "dist/apps/web"
}
}
}
}
Sources: apps/web/project.json:1-16, package.json:29-30, 70-80
Turborepo
Turborepo is used to accelerate build times by caching the output of tasks. The turbo command is used in many root-level scripts for building, developing, and starting applications. The turbo.json file defines the pipeline dependencies between tasks.
"scripts": {
"start:web": "turbo start --filter=@ever-teams/web",
"build": "turbo build",
"build:web": "turbo build --filter=@ever-teams/web",
"dev:web": "yarn build:services && yarn build:types && yarn build:constants && yarn build:ui && yarn build:hooks && yarn build:utils && turbo dev --filter=@ever-teams/web"
}
Sources: package.json:38, 49, 50, 43
Repository Structure
The monorepo is organized into apps and packages directories to separate deployable units from shared code.
This diagram illustrates the high-level structure of the monorepo, showing how applications consume shared packages.
Applications (apps/)
This directory contains the user-facing applications of the Ever Teams platform.
| Application | Description | Technology | Source |
|---|---|---|---|
web | The main Next.js-based web application. | Next.js, React | README.md:204 |
server-web | An Electron-based desktop application that serves the Next.js frontend. | Electron, React | README.md:210, apps/server-web/README.md |
mobile | A mobile application for iOS and Android. | Expo, React Native | README.md:205 |
extensions | Browser extensions. | Plasmo framework | README.md:207 |
playground | A Next.js environment for testing and developing UI components. | Next.js, React | apps/playground/package.json:2-4 |
server-api | A customized build of the Ever Gauzy API server. | Node.js | README.md:208 |
Shared Packages (packages/)
This directory contains libraries with shared logic, UI components, and types that are consumed by the applications.
| Package | Description | Source |
|---|---|---|
@ever-teams/ui | A library of "dumb", pure UI primitive components like buttons, inputs, and cards. | packages/ui/package.json:2, apps/web/core/components/README.md:92-93 |
@ever-teams/hooks | Likely contains shared React hooks used across applications. | package.json:40 |
@ever-teams/types | Contains shared TypeScript types and interfaces. | package.json:37 |
@ever-teams/utils | A package for shared utility functions. | package.json:41 |
@ever-teams/constants | A package for shared constant values. | package.json:38 |
@ever-teams/services | A package for shared service logic. | package.json:36 |
Internal Architecture of apps/web
The main web application (apps/web) has a well-defined internal architecture to promote scalability and maintainability.
This diagram shows the internal folder structure of the apps/web application's core logic.
UI Components (core/components)
The web app's components are organized by scope and domain:
common/: Contains shared, reusable "smart" components with internal logic, used across multiple features (e.g.,modal-wrapper.tsx).pages/: Holds components strictly scoped to a specific page or route.- Feature Folders (
auth/,projects/, etc.): Group components related to a specific product feature.
This structure is distinct from packages/ui, which contains generic, "dumb" UI primitives.
Sources: apps/web/core/components/README.md:13-19, 39-44, 54-58
State Management (core/stores)
Global state is managed with Jotai. State atoms are organized into folders by feature domain (e.g., auth/, projects/, tasks/) to ensure separation of concerns and scalability. A strict naming convention is enforced for different types of atoms (...Atom, ...Derived, ...FilterAtom).
Sources: apps/web/core/stores/README.md:4-7, 21-29
Schema Validation (core/types/schemas)
The application uses Zod to ensure type safety and data integrity for API responses. Schemas are defined for all major data structures (e.g., Roles, Tags) and are used to validate data at runtime. This system includes utility functions for parsing and custom error handling.
Sources: apps/web/core/types/schemas/README.md:3-9
Build and Deployment
The monorepo is configured for various deployment and execution environments, including Docker, Vercel, and local development.
Docker
The docker-compose.yml file defines services for running the application stack, including the webapp (the Next.js frontend) and the api (the Gauzy backend). It uses pre-built Docker images from ghcr.io and manages environment variables for different configurations.
services:
webapp:
container_name: webapp
image: ghcr.io/ever-co/ever-teams-webapp:latest
environment:
GAUZY_API_SERVER_URL: ${GAUZY_API_SERVER_URL:-https://api.ever.team}
NEXT_PUBLIC_GAUZY_API_SERVER_URL: ${NEXT_PUBLIC_GAUZY_API_SERVER_URL:-https://api.ever.team}
ports:
- "3030:${UI_PORT:-3030}"
Sources: docker-compose.yml:92-99, 180-181
Development Scripts
The root package.json contains a rich set of scripts for building, testing, and running applications.
yarn start:web:dev: Starts the web application in development mode using Turborepo.yarn build: Builds all applications and packages in the monorepo using Turborepo.yarn dep-graph: Visualizes the project dependency graph using Nx.yarn affected:build: Builds only the applications and libraries affected by recent changes.
Sources: package.json:38-80
Conclusion
The monorepo architecture of Ever Teams, powered by Yarn Workspaces, Lerna, Nx, and Turborepo, provides a robust and efficient foundation for development. It promotes code reuse through shared packages, ensures consistency with unified tooling, and accelerates build times with intelligent task running and caching. The clear separation of apps and packages, combined with a well-defined internal structure within the main web application, creates a scalable and maintainable codebase.