# πŸ“ Project Structure ## Final Organized Structure ``` rxminder/ β”œβ”€β”€ πŸ“„ README.md # Main documentation β”œβ”€β”€ package.json # Dependencies and scripts β”œβ”€β”€ βš™οΈ vite.config.ts # Build configuration β”œβ”€β”€ πŸ“ tsconfig.json # TypeScript configuration β”œβ”€β”€ 🎨 index.html # Entry point β”œβ”€β”€ πŸ”’ .env.example # Environment template β”œβ”€β”€ πŸ“Š metadata.json # Project metadata β”œβ”€β”€ πŸ–ΌοΈ banner.jpeg # Project banner image β”‚ β”œβ”€β”€ οΏ½ docker/ # Container configuration β”‚ β”œβ”€β”€ 🐳 Dockerfile # Multi-stage Docker build β”‚ β”œβ”€β”€ οΏ½ docker-compose.yaml # Service orchestration β”‚ β”œβ”€β”€ 🌐 nginx.conf # Production web server config β”‚ └── 🚫 .dockerignore # Docker ignore patterns β”‚ β”œβ”€β”€ πŸ“ scripts/ # All deployment and utility scripts β”‚ β”œβ”€β”€ πŸš€ deploy.sh # Production deployment β”‚ β”œβ”€β”€ ⚑ deploy-k8s.sh # Kubernetes deployment β”‚ β”œβ”€β”€ πŸ”§ setup.sh # Development setup β”‚ β”œβ”€β”€ 🌱 seed-production.js # Database seeding β”‚ β”œβ”€β”€ βœ… validate-env.sh # Environment validation β”‚ └── πŸ§ͺ validate-deployment.sh # Deployment testing β”‚ β”œβ”€β”€ πŸ“ tests/ # Testing infrastructure β”‚ β”œβ”€β”€ πŸ“ README.md # Testing documentation β”‚ β”œβ”€β”€ βš™οΈ setup.ts # Jest configuration β”‚ β”œβ”€β”€ πŸ“ integration/ # Integration tests β”‚ β”‚ └── πŸ§ͺ production.test.js # Production validation β”‚ β”œβ”€β”€ πŸ“ manual/ # Manual testing scripts β”‚ β”‚ β”œβ”€β”€ πŸ”§ admin-login-debug.js # Admin debugging β”‚ β”‚ β”œβ”€β”€ πŸ”§ auth-db-debug.js # Auth debugging β”‚ β”‚ └── πŸ”§ debug-email-validation.js # Email debugging β”‚ └── πŸ“ e2e/ # End-to-end tests with Playwright β”‚ β”œβ”€β”€ πŸ“ README.md # E2E testing documentation β”‚ β”œβ”€β”€ πŸ§ͺ fixtures.ts # Custom test fixtures β”‚ β”œβ”€β”€ πŸ§ͺ helpers.ts # Test utilities and data β”‚ β”œβ”€β”€ πŸ§ͺ auth.spec.ts # Authentication flow tests β”‚ β”œβ”€β”€ πŸ§ͺ medication.spec.ts # Medication management tests β”‚ β”œβ”€β”€ πŸ§ͺ admin.spec.ts # Admin interface tests β”‚ β”œβ”€β”€ πŸ§ͺ ui-navigation.spec.ts # UI and navigation tests β”‚ └── πŸ§ͺ reminders.spec.ts # Reminder system tests β”‚ β”œβ”€β”€ πŸ“ components/ # React components (organized by feature) β”‚ β”œβ”€β”€ πŸ“ README.md # Component architecture docs β”‚ β”œβ”€β”€ πŸ“ medication/ # Medication-related components β”‚ β”‚ β”œβ”€β”€ πŸ’Š AddMedicationModal.tsx β”‚ β”‚ β”œβ”€β”€ ✏️ EditMedicationModal.tsx β”‚ β”‚ β”œβ”€β”€ πŸ“‹ ManageMedicationsModal.tsx β”‚ β”‚ β”œβ”€β”€ 🏷️ DoseCard.tsx β”‚ β”‚ └── πŸ“¦ index.ts # Feature exports β”‚ β”œβ”€β”€ πŸ“ auth/ # Authentication components β”‚ β”‚ β”œβ”€β”€ πŸ” AuthPage.tsx # Login/register interface β”‚ β”‚ β”œβ”€β”€ πŸ‘€ AvatarDropdown.tsx # User menu β”‚ β”‚ β”œβ”€β”€ πŸ”‘ ChangePasswordModal.tsx β”‚ β”‚ └── πŸ“¦ index.ts # Feature exports β”‚ β”œβ”€β”€ πŸ“ admin/ # Admin interface components β”‚ β”‚ β”œβ”€β”€ πŸ‘‘ AdminInterface.tsx # User management β”‚ β”‚ └── πŸ“¦ index.ts # Feature exports β”‚ β”œβ”€β”€ πŸ“ modals/ # Modal components β”‚ β”‚ β”œβ”€β”€ βš™οΈ AccountModal.tsx # User settings β”‚ β”‚ β”œβ”€β”€ βž• AddReminderModal.tsx # Add reminders β”‚ β”‚ β”œβ”€β”€ ✏️ EditReminderModal.tsx β”‚ β”‚ β”œβ”€β”€ πŸ“š HistoryModal.tsx # Medication history β”‚ β”‚ β”œβ”€β”€ πŸ“‹ ManageRemindersModal.tsx β”‚ β”‚ β”œβ”€β”€ 🎯 OnboardingModal.tsx # New user setup β”‚ β”‚ β”œβ”€β”€ πŸ“Š StatsModal.tsx # Analytics dashboard β”‚ β”‚ └── πŸ“¦ index.ts # Feature exports β”‚ β”œβ”€β”€ πŸ“ ui/ # Reusable UI components β”‚ β”‚ β”œβ”€β”€ πŸ“Š BarChart.tsx # Data visualization β”‚ β”‚ β”œβ”€β”€ πŸ”” ReminderCard.tsx # Reminder display β”‚ β”‚ β”œβ”€β”€ 🎨 ThemeSwitcher.tsx # Dark/light theme β”‚ β”‚ └── πŸ“¦ index.ts # Feature exports β”‚ └── πŸ“ icons/ # Icon components β”‚ └── 🎨 Icons.tsx # All icon definitions β”‚ β”œβ”€β”€ πŸ“ services/ # Business logic & APIs β”‚ β”œβ”€β”€ πŸ—„οΈ database/ # Unified database service β”‚ β”‚ β”œβ”€β”€ DatabaseService.ts # Main service with strategy pattern β”‚ β”‚ β”œβ”€β”€ MockDatabaseStrategy.ts # In-memory implementation β”‚ β”‚ β”œβ”€β”€ ProductionDatabaseStrategy.ts # CouchDB implementation β”‚ β”‚ └── types.ts # Database interfaces β”‚ β”œβ”€β”€ πŸ“§ email.ts # Email utilities β”‚ β”œβ”€β”€ πŸ“§ mailgun.service.ts # Email delivery β”‚ β”œβ”€β”€ πŸ“§ mailgun.config.ts # Email configuration β”‚ β”œβ”€β”€ 🌱 database.seeder.ts # Data seeding β”‚ β”œβ”€β”€ πŸ” oauth.ts # OAuth integration β”‚ └── πŸ“ auth/ # Authentication services β”‚ β”œβ”€β”€ πŸ” auth.service.ts # Core auth logic β”‚ β”œβ”€β”€ πŸ” auth.types.ts # Auth type definitions β”‚ β”œβ”€β”€ πŸ” auth.constants.ts # Auth constants β”‚ β”œβ”€β”€ πŸ” auth.error.ts # Error handling β”‚ β”œβ”€β”€ πŸ” auth.middleware.ts # Middleware β”‚ β”œβ”€β”€ βœ‰οΈ emailVerification.service.ts β”‚ β”œβ”€β”€ πŸ“ templates/ # Email templates β”‚ β”‚ └── βœ‰οΈ verification.email.ts β”‚ └── πŸ“ __tests__/ # Unit tests β”‚ β”œβ”€β”€ πŸ§ͺ auth.integration.test.ts β”‚ └── πŸ§ͺ emailVerification.test.ts β”‚ β”œβ”€β”€ πŸ“ contexts/ # React context providers β”‚ └── πŸ‘€ UserContext.tsx # User state management β”‚ β”œβ”€β”€ πŸ“ hooks/ # Custom React hooks β”‚ β”œβ”€β”€ πŸ’Ύ useLocalStorage.ts # Persistent storage β”‚ β”œβ”€β”€ βš™οΈ useSettings.ts # User preferences β”‚ β”œβ”€β”€ 🎨 useTheme.ts # Theme management β”‚ └── πŸ‘€ useUserData.ts # User data management β”‚ β”œβ”€β”€ πŸ“ utils/ # Utility functions β”‚ └── ⏰ schedule.ts # Reminder scheduling β”‚ β”œβ”€β”€ πŸ“ docs/ # Project documentation β”‚ β”œβ”€β”€ πŸ” SECURITY.md # Security guidelines β”‚ β”œβ”€β”€ πŸš€ DEPLOYMENT.md # Deployment instructions β”‚ └── πŸ“– API.md # API documentation β”‚ β”œβ”€β”€ πŸ“ k8s/ # Kubernetes manifests β”‚ β”œβ”€β”€ πŸ“ README.md # K8s deployment guide β”‚ β”œβ”€β”€ πŸ—ΊοΈ configmap.yaml # Configuration β”‚ β”œβ”€β”€ πŸ”’ *-secret.yaml # Secrets β”‚ β”œβ”€β”€ πŸš€ *-deployment.yaml # Deployments β”‚ β”œβ”€β”€ 🌐 *-service.yaml # Services β”‚ β”œβ”€β”€ πŸ“Š hpa.yaml # Auto-scaling β”‚ β”œβ”€β”€ 🌐 ingress.yaml # Load balancing β”‚ └── πŸ”’ network-policy.yaml # Network security β”‚ └── πŸ“ .github/ # GitHub configuration β”œβ”€β”€ πŸ“ pull_request_template.md └── πŸ“ ISSUE_TEMPLATE/ β”œβ”€β”€ πŸ› bug_report.md └── ✨ feature_request.md ``` ## Key Organizational Principles ### βœ… **Feature-Based Organization** - Components grouped by functionality (medication, auth, admin, etc.) - Clear separation of concerns - Easy to locate related files ### βœ… **Script Centralization** - All deployment and utility scripts in `/scripts/` - Consistent naming conventions - Easy access via npm/bun scripts ### βœ… **Testing Structure** - Unit tests alongside source code (`services/auth/__tests__/`) - Integration tests in `/tests/integration/` - E2E tests with Playwright in `/tests/e2e/` - Manual debugging tools in `/tests/manual/` - Comprehensive test documentation - TypeScript support with temporary type declarations ### βœ… **Documentation Organization** - Feature-specific READMEs in relevant folders - Centralized docs in `/docs/` folder - Clear architectural documentation ### βœ… **Configuration Management** - Environment files at root level - Build configurations easily accessible - Docker and K8s configs clearly separated ## Benefits 🎯 **Maintainability** - Clear structure makes code easy to maintain πŸ” **Discoverability** - Logical organization helps find files quickly πŸ§ͺ **Testability** - Well-organized test structure πŸ“¦ **Deployability** - Scripts and configs clearly separated πŸ‘₯ **Team Collaboration** - Consistent patterns across the project πŸ“ˆ **Scalability** - Structure supports growth and new features