Setup & Local Development
Relevant source files
The following files were used as context for generating this wiki page:
- replit.md
- attached_assets/Pasted-Build-a-production-ready-native-iPhone-mobile-app-using_1773627288076.txt
- attached_assets/Pasted-Make-a-focused-repo-cleanup-and-dependency-hygiene-pass_1774842983742.txt
- artifacts/api-server/src/routes/anthropic/index.ts
- attached_assets/Pasted-Build-the-next-major-intelligence-architecture-for-Hosp_1774852812580.txt
Introduction
Hospice Roadmap is developed as a pnpm workspace monorepo utilizing TypeScript 5.9 and Node.js 24. The architecture is designed for a production-ready ecosystem, comprising an Express 5 API server (artifacts/api-server) and an Expo React Native mobile application (artifacts/mobile). The project leverages a robust intelligence engine to provide clinical guidance and personalized support for caregivers and patients throughout the hospice journey.
The local development environment is optimized for iterative development, specifically supporting Replit for cloud-based coding and Expo Go for mobile testing. The monorepo structure ensures type safety across the stack, integrating a PostgreSQL database with Drizzle ORM and providing structured access to external AI and healthcare data services.
Sources: replit.md, attached_assets/Pasted-Build-a-production-ready-native-iPhone-mobile-app-using_1773627288076.txt
Monorepo Architecture
The project is structured to separate core application logic from supporting libraries and tooling. This modular approach allows for scalable development and clean dependency management across the API and mobile clients.
The diagram shows the hierarchical relationship and internal dependency flow between workspace packages.
Core Packages and Responsibilities
| Package Path | Name | Responsibility |
|---|---|---|
artifacts/api-server | @workspace/api-server | Express API handling AI routes, CMS proxying, and intelligence planning. |
artifacts/mobile | @workspace/mobile | Expo React Native app providing the primary user interface and offline guidance. |
lib/db | @workspace/db | PostgreSQL schema definitions and Drizzle ORM client management. |
lib/api-spec | @workspace/api-spec | OpenAPI 3.1 specifications used for automated code generation. |
lib/api-client-react | @workspace/api-client-react | Generated React Query hooks and fetch client for the mobile app. |
Sources: replit.md, attached_assets/Pasted-Make-a-focused-repo-cleanup-and-dependency-hygiene-pass_1774842983742.txt
Development Workflow & Scripts
Local development relies on a set of workspace-level scripts to manage builds, typechecking, and database migrations. The project enforces the use of pnpm as the package manager.
Workspace Management Scripts
A set of helper scripts facilitates the health and maintenance of the repository:
repo:mobile:typecheck: Runs TypeScript validation for the Expo mobile app.repo:api:typecheck: Runs TypeScript validation for the Express API server.repo:db:push: Pushes schema changes to the PostgreSQL database using Drizzle.repo:clean:artifacts: Utility to prune temporary directories like.expo,.cache, anddist.repo:health: A combined script that runs comprehensive typechecks across the workspace.
Mobile Testing with Expo Go
The mobile application is designed to be tested using the Expo Go app. This allows developers to run the artifacts/mobile package locally and scan a QR code to view the live app on an iPhone or Android device without a full native build process.
API Server & Intelligence Integration
The API server acts as the bridge between the mobile client and external intelligence services (Anthropic Claude). A critical component of local development is the intelligence engine located in artifacts/api-server/src/intelligence/hospice/.
Intelligence Data Flow
When a user sends a message through the mobile client, the API server executes a retrieval and planning phase before communicating with the LLM.
The sequence illustrates how user messages are enriched with hospice-specific knowledge blocks before being processed by the AI.
Key Intelligence Components
- Knowledge Catalog: A structured repository of over 35 knowledge blocks across 13 domains (e.g., dying process, symptom management).
- Response Planner: A module (
planner.ts) that analyzes message text and patient context to derive urgency, role, and relevant knowledge blocks. - System Prompt: A specialized prompt (
systemPrompt.ts) that defines the AI's persona (Ragna) and clinical constraints.
Sources: replit.md, artifacts/api-server/src/routes/anthropic/index.ts:133-144, attached_assets/Pasted-Build-the-next-major-intelligence-architecture-for-Hosp_1774852812580.txt
Database & Persistence
The project uses PostgreSQL for the primary backend database and AsyncStorage for local mobile persistence. Local development requires a running PostgreSQL instance accessible to the @workspace/db package.
Backend Persistence (PostgreSQL)
The backend manages session-based data and intelligence logs:
- Conversations: Stores chat session metadata and associated
clientId. - Messages: Stores the full history of user and assistant messages for Ragna.
- Support Requests: Captures in-app support submissions with status tracking (
received,processed, etc.).
Local Persistence (Mobile)
The mobile app uses AsyncStorage to persist data for offline use and personalization:
- Symptom Entries: Daily clinical check-ins.
- Patient Profile: Custom details used to personalize AI responses.
- Ragna Learning Observations: Tracks app events to synthesize a living profile.
Sources: replit.md, artifacts/api-server/src/routes/anthropic/index.ts:31-41
Conclusion
Setting up the Hospice Roadmap repository requires a pnpm environment capable of running Node.js 24 and connecting to a PostgreSQL database. The combination of an OpenAPI-driven type system and a structured intelligence architecture allows developers to iterate on both clinical content and mobile features safely. By utilizing the workspace scripts and Expo Go, the transition from local development to production-ready testing is streamlined.