SMEDRECSMEDREC
Home
Get Started
AI Agents
Development Resources
Home
Get Started
AI Agents
Development Resources
  • Introduction

    • Get Started
  • AI Agents

    • FHIR Test Agent
    • Assistant Agent
    • Patient Report Agent
    • Scheduling Agent
  • Development

    • Development Resources
    • MCP FHIR Server Overview
    • Authentication and Authorization Flow (MCP Server)
    • FHIR Client (@repo/fhir)
    • MCP FHIR Tools
    • Security Considerations
    • Deployment and Configuration
  • Applications

    • API Application (apps/api)
    • Audit Worker (apps/audit)
  • Packages

    • Audit Package (@repo/audit)
    • @repo/auditdb
    • Mailer Package (@repo/mailer)
    • Cerbos Client (@repo/cerbos)
  • Databases

    • Transparent Field Encryption in PostgreSQL

Node.js Monorepo Template - Project Structure

This is a Node.js monorepo built with Turborepo, pnpm workspaces, and modern tooling, designed for building scalable server-side applications and shared libraries.

Repository Layout

Core Directories

  • apps/ - Individual Node.js applications or services (deployable units).

    • Each subdirectory is typically a separate application (e.g., an API server, a background job processor).
    • Example: apps/api-service/ - could be an Express.js or NestJS application.
    • Example: apps/data-processor/ - could be a standalone Node.js script or service.
  • packages/ - Shared libraries, utilities, and configurations used by applications in the apps/ directory or other packages.

    • packages/eslint-config/ - Shared ESLint configuration
    • packages/typescript-config/ - Shared TypeScript configuration
    • packages/hono-helpers/ - Hono framework utilities and middleware
    • packages/tools/ - CLI tools and development scripts
    • packages/workspace-dependencies/ - Shared dependencies management

Configuration Files

  • package.json - Root package with workspace scripts and dev dependencies
  • pnpm-workspace.yaml - Defines pnpm workspace structure
  • turbo.json - Turborepo configuration for builds, tasks, and caching
  • Justfile - Convenient command aliases for development
  • tsconfig.json - Root TypeScript configuration
  • .syncpackrc.cjs - Dependency version synchronization

Code Generation

  • turbo/generators/ - Turbo gen templates for scaffolding new applications and packages.
    • templates/node-service/ - Example: Template for a basic Node.js service (e.g., using Express or Fastify).
    • templates/library-package/ - Template for a shared library package.
    • templates/package/ - Generic shared package template (as before, likely still useful). (Update these paths and descriptions to match your actual Node.js application/service templates.)

Build & Development

  • .turbo/ - Turborepo cache and daemon files
  • node_modules/ - Workspace dependencies (managed by pnpm)
  • .github/workflows/ - CI/CD pipelines for testing and deployment

Key Concepts

  • Monorepo Benefits: Shared dependencies, atomic commits, consistent tooling, easier refactoring across multiple Node.js applications and libraries.
  • pnpm Workspaces: Efficient dependency management and linking for local development across packages.
  • Turborepo: Build orchestration, intelligent caching, and parallelization of tasks like building, testing, and linting.
  • Code Generation: Use just new-app (or your project's specific command) to scaffold new Node.js applications or services from predefined templates.
Last Updated: 7/10/25, 7:27 PM
Contributors: José Cordeiro, google-labs-jules[bot]