How yeti/yurt works
The Yurt project is a monorepo maintained with pnpm workspaces and Lerna. It’s designed as a CLI scaffolding tool that helps generate projects from template packages. These templates currently include:
• A standalone React/Vite App
• A combined React/Vite App with a Node Apollo GraphQL Server
Main Components
a. CLI Package:
• Located in packages/cli.
• This is the entry point for users interacting with the tool. It prompts the user and triggers the scaffolding process.
• Represents the user interface (command-line) for initiating the creation of new projects.
b. Template Packages:
• React/Vite App (packages/react)
• React/Vite App with Node Apollo GraphQL Server (packages/react-apollo and packages/backend)
• These packages serve as blueprints. The “react” package is a straightforward front-end template, whereas the “react-apollo” package integrates front-end React code with a backend GraphQL server.
c. Backend Service:
• Found under packages/backend.
• Implements a Node-based Apollo GraphQL server.
• Contains Prisma integration (database schema, migrations, and seed) for ORM functionality.
• Uses modular architecture with directories such as “src/schemaModules” (e.g., the “user” module) and separate configurations for testing and deployment.
Relationships and Interactions
a. The CLI component acts as the orchestrator:
• It interacts with the user (via terminal prompts) to select the desired template type.
• On user selection, it writes out the relevant scaffolded project structure using one of the template packages.
b. Template Package Composition:
• For a React/Vite App: It includes all necessary front-end resources, configuration (Vite, ESLint, Prettier, etc.), and setup instructions.
• For the React/Vite App + Node Apollo Server: It integrates both the backend and front-end codebases. The backend (GraphQL server) communicates with the front-end through GraphQL APIs.
c. Deployment and Development Tools:
• Docker files, ESLint configurations, and testing configurations (Jest, for instance) show that the project is prepared for both development and CI/CD.
• The monorepo structure ensures that dependencies and code across packages (CLI, backend, and frontends) are managed centrally by pnpm and Lerna.
Architectural Patterns and Technologies
a. Monorepo Architecture:
• Managed by pnpm workspaces and Lerna, allowing shared configurations, dependencies, and synchronous version management.
• This aids in consistency across multiple templates and the CLI tool itself.
b. Modular Structure:
• The backend is split into schema modules (for GraphQL) with separate concerns like plugins, services, and shared utilities.
• The front-end packages follow modern React paradigms with component-based design, routing, and global state management.
c. Separation of Concerns:
• The CLI handles scaffolding and configuration.
• Template packages provide well-defined boundaries between client (React/Vite) and server (Node/Apollo).
d. Use of Modern Technologies:
• React and Vite for the front end for fast development and hot module replacement.
• Node Apollo Server for GraphQL APIs.
• Prisma for database interactions.
• Docker for containerization of tests and deployments.