AgentCare Project Structure Guide
Overview
This document outlines the complete organizational structure of the AgentCare multi-agent healthcare scheduling platform.
π Root Directory Structure
agentcare/
βββ π± frontend/ # React + TypeScript + Vite frontend
βββ π§ backend/ # Node.js + Express + TypeScript API
βββ ποΈ database/ # PostgreSQL schemas and migrations
βββ ποΈ infrastructure/ # Docker, Kubernetes, CI/CD configurations
βββ π docs/ # Complete project documentation
βββ π§ͺ tests/ # Integration and E2E tests
βββ π scripts/ # Automation and utility scripts
βββ π ssl/ # SSL certificates and security configs
βββ π coverage/ # Test coverage reports
βββ π logs/ # Application logs
βββ βοΈ Configuration Files # Package.json, Docker, CI/CD configs
π― Frontend Structure (frontend/)
frontend/
βββ src/
β βββ components/ # React components
β β βββ UI/ # Reusable UI components
β β βββ Layout/ # Layout components
β β βββ Features/ # Feature-specific components
β βββ pages/ # Page components
β βββ hooks/ # Custom React hooks
β βββ store/ # State management (Zustand)
β βββ theme/ # Material-UI themes
β βββ utils/ # Utility functions
β βββ types/ # TypeScript type definitions
βββ public/ # Static assets
β βββ assets/ # Images, icons, etc.
β βββ 404.html # GitHub Pages SPA routing
β βββ CNAME # Custom domain config
βββ tests/ # Frontend unit tests
βββ dist/ # Build output
βββ Dockerfile # Standalone frontend container
βββ nginx.conf # Nginx configuration
βββ package.json # Frontend dependencies
π§ Backend Structure (backend/)
backend/
βββ src/
β βββ agents/ # AI agents (Supervisor, Booking, FAQ, etc.)
β βββ controllers/ # Express route controllers
β βββ middleware/ # Express middleware
β βββ models/ # Data models and schemas
β βββ routes/ # API route definitions
β βββ services/ # Business logic services
β βββ tools/ # Agent tools and utilities
β βββ patterns/ # Enterprise patterns (Circuit Breaker, etc.)
β βββ process/ # Process management (12-Factor)
β βββ config/ # Configuration management
β βββ logging/ # Logging utilities
β βββ utils/ # Utility functions
β βββ types/ # TypeScript type definitions
βββ tests/ # Backend unit tests
βββ dist/ # Compiled TypeScript output
βββ logs/ # Backend-specific logs
βββ Dockerfile # Standalone backend container
βββ package.json # Backend dependencies
ποΈ Database Structure (database/)
database/
βββ schemas/ # SQL schema definitions
βββ migrations/ # Database migration scripts
βββ seeds/ # Sample data and demo data
βββ backups/ # Database backup scripts
βββ README.md # Database setup instructions
ποΈ Infrastructure Structure (infrastructure/)
infrastructure/
βββ docker/ # Docker configurations
β βββ Dockerfile # Multi-stage monorepo build
β βββ Dockerfile.backend # Backend-specific container
β βββ Dockerfile.frontend # Frontend-specific container
β βββ docker-compose.yml # Development stack
β βββ docker-compose.prod.yml # Production stack
β βββ nginx.conf # Nginx configuration
βββ kubernetes/ # K8s deployment manifests
βββ helm/ # Helm charts
βββ ci-cd/ # CI/CD pipeline configurations
βββ 12factor/ # 12-Factor app compliance
βββ observability/ # Monitoring and logging
βββ process-management/ # PM2 and process configs
βββ README.md # Infrastructure guide
π Documentation Structure (docs/)
docs/
βββ architecture/ # Architecture guides and diagrams
β βββ ARCHITECTURE_GUIDE.md
β βββ MULTI_TENANCY_GUIDE.md
β βββ TWELVE_FACTOR_GUIDE.md
β βββ diagrams/ # Architecture diagrams
βββ setup/ # Setup and installation guides
β βββ DOCKER_SETUP.md
β βββ DOCKER_MIGRATION_SUMMARY.md
β βββ QUICK_START.md
βββ guides/ # User and developer guides
βββ api/ # API documentation
βββ testing/ # Testing documentation
βββ operations/ # Operations and deployment
βββ assets/ # Documentation images and files
βββ _config.yml # GitHub Pages configuration
βββ index.md # Documentation homepage
π§ͺ Testing Structure (tests/)
tests/
βββ unit/ # Unit tests
βββ integration/ # Integration tests
βββ contract/ # Contract tests
βββ e2e/ # End-to-end tests
βββ performance/ # Performance tests
βββ fixtures/ # Test data and fixtures
βββ utils/ # Testing utilities
βοΈ Configuration Files
| File | Purpose |
|---|---|
package.json |
Root workspace configuration |
tsconfig.json |
Global TypeScript configuration |
jest.config.js |
Jest testing configuration |
playwright.config.ts |
Playwright E2E test configuration |
sonar-project.properties |
SonarCloud configuration |
.github/workflows/ |
GitHub Actions CI/CD |
docker-compose.yml |
Development environment |
env.example |
Environment variable template |
.gitignore |
Git ignore patterns |
.eslintrc.js |
ESLint configuration |
.cursorrules |
Cursor AI IDE rules |
π Build and Deployment Flow
graph TD
A[Source Code] --> B[Build Process]
B --> C[Testing Pipeline]
C --> D[Docker Images]
D --> E[Container Registry]
E --> F[Deployment]
B --> B1[Frontend Build]
B --> B2[Backend Build]
C --> C1[Unit Tests]
C --> C2[Integration Tests]
C --> C3[E2E Tests]
F --> F1[Development]
F --> F2[Staging]
F --> F3[Production]
π± Frontend Architecture
graph TB
A[React App] --> B[Router]
B --> C[Pages]
C --> D[Components]
D --> E[Hooks]
E --> F[Store]
F --> G[API Layer]
G --> H[Backend API]
π§ Backend Architecture
graph TB
A[Express Server] --> B[Routes]
B --> C[Controllers]
C --> D[Services]
D --> E[Agents]
E --> F[Tools]
F --> G[Database]
D --> H[External APIs]
π Key Features by Directory
Frontend Features
- React 18 with TypeScript
- Material-UI design system
- Zustand state management
- React Query for API calls
- Vite build system
- GitHub Pages deployment
Backend Features
- Multi-Agent AI system
- Express.js REST API
- JWT Authentication
- PostgreSQL database
- Redis caching
- Ollama LLM integration
- HIPAA compliance
Infrastructure Features
- Docker containerization
- Kubernetes orchestration
- GitHub Actions CI/CD
- SonarCloud code quality
- Monitoring and logging
- 12-Factor app compliance
π Development Guidelines
File Naming Conventions
- Components: PascalCase (
UserProfile.tsx) - Hooks: camelCase with βuseβ prefix (
useAuth.ts) - Utilities: camelCase (
formatDate.ts) - Constants: UPPER_SNAKE_CASE (
API_ENDPOINTS.ts) - Types: PascalCase (
UserInterface.ts)
Directory Organization Rules
- Group related files together
- Keep components close to where theyβre used
- Separate concerns (UI, business logic, data)
- Use index files for clean imports
- Maintain flat hierarchy when possible
Documentation Standards
- README.md in each major directory
- Inline code comments for complex logic
- JSDoc for public APIs
- Architecture diagrams for complex flows
- Change logs for major updates
π Migration and Updates
When adding new features or refactoring:
- Follow the established directory structure
- Update relevant documentation
- Add appropriate tests
- Update CI/CD pipelines if needed
- Consider impact on deployment
This structure supports scalability, maintainability, and clear separation of concerns while enabling efficient development workflows.