{"id":31761430,"url":"https://github.com/bryanpmx/caf","last_synced_at":"2025-10-09T21:51:28.242Z","repository":{"id":317289680,"uuid":"1015041729","full_name":"BryanPMX/CAF","owner":"BryanPMX","description":"Monorepo for the Centro de Apoyo para la Familia A.C. Platform","archived":false,"fork":false,"pushed_at":"2025-10-07T02:31:57.000Z","size":39010,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T02:39:59.230Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://caf-admin-portal.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BryanPMX.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-06T22:45:49.000Z","updated_at":"2025-10-07T02:32:00.000Z","dependencies_parsed_at":"2025-09-30T02:46:46.470Z","dependency_job_id":null,"html_url":"https://github.com/BryanPMX/CAF","commit_stats":null,"previous_names":["bryanpmx/caf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BryanPMX/CAF","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryanPMX%2FCAF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryanPMX%2FCAF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryanPMX%2FCAF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryanPMX%2FCAF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BryanPMX","download_url":"https://codeload.github.com/BryanPMX/CAF/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BryanPMX%2FCAF/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002049,"owners_count":26083286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-09T21:51:27.176Z","updated_at":"2025-10-09T21:51:28.236Z","avatar_url":"https://github.com/BryanPMX.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Centro de Apoyo para la Familia A.C.\r\n\r\nThis is the official monorepo for the CAF digital platform. The project is under active development.\r\n\r\n## 🚀 Quick Start - Testing the System\r\n\r\n### Prerequisites\r\n\r\n- **Docker \u0026 Docker Compose** (for backend services)\r\n- **Node.js 18+** (for admin portal)\r\n- **Flutter SDK** (optional, for mobile app)\r\n\r\n### 1. Start Backend Services\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone \u003crepository-url\u003e\r\ncd \"CAF SYSTEM\"\r\n\r\n# Start backend API, database, and supporting services\r\ndocker-compose up -d\r\n\r\n# Verify services are running\r\ndocker-compose ps\r\n```\r\n\r\n**Expected Services:**\r\n- `caf_api` (Go API) - http://localhost:8080\r\n- `caf_postgres` (Database) - localhost:5432\r\n- `caf_localstack` (AWS services simulation)\r\n\r\n### 2. Start Admin Portal (Frontend)\r\n\r\n```bash\r\n# Navigate to admin portal\r\ncd admin-portal\r\n\r\n# Install dependencies\r\nnpm install\r\n\r\n# Start development server\r\nnpm run dev\r\n```\r\n\r\n**Access at:** http://localhost:3000\r\n\r\n### 3. Test Login\r\n\r\n**Default Admin Credentials:**\r\n- **Email:** `admin@caf.org`\r\n- **Password:** `admin123` \r\n\r\n### 4. Verify System Components\r\n\r\nAfter logging in, you should see:\r\n\r\n✅ **Dashboard** - Main overview with statistics  \r\n✅ **Cases** - Case management system  \r\n✅ **Appointments** - Appointment scheduling  \r\n✅ **Users** - User management (admin only)  \r\n✅ **Reports** - Analytics and reporting (admin only)  \r\n\r\n## 🛠️ Development Setup\r\n\r\n### Backend API (Go)\r\n\r\n```bash\r\n# If you need to run the API outside Docker\r\ncd api\r\n\r\n# Install Go dependencies\r\ngo mod download\r\n\r\n# Run with environment variables\r\nexport DB_HOST=localhost\r\nexport DB_PORT=5432\r\nexport DB_NAME=caf_db\r\nexport DB_USER=caf_user\r\nexport DB_PASSWORD=caf_password\r\nexport JWT_SECRET=your_jwt_secret_here\r\n\r\n# Start the API\r\ngo run cmd/server/main.go\r\n```\r\n\r\n### Admin Portal (Next.js)\r\n\r\n```bash\r\ncd admin-portal\r\n\r\n# Development server\r\nnpm run dev\r\n\r\n# Build for production\r\nnpm run build\r\n\r\n# Start production server\r\nnpm run start\r\n\r\n# Run linting\r\nnpm run lint\r\n```\r\n\r\n### Environment Variables\r\n\r\nCreate `.env.local` in the admin-portal directory:\r\n\r\n```env\r\nNEXT_PUBLIC_API_URL=http://localhost:8080/api/v1\r\nNEXT_PUBLIC_ENV=development\r\n```\r\n\r\n## 🧪 Testing Guide\r\n\r\n### 1. Login Flow Test\r\n1. Navigate to http://localhost:3000\r\n2. Should redirect to `/login`\r\n3. Enter admin credentials\r\n4. Should redirect to dashboard\r\n\r\n### 2. Dashboard Features Test\r\n- **Statistics Cards** - Should display current system stats\r\n- **Recent Activity** - Should show latest system activity\r\n- **Navigation Menu** - Should show role-appropriate menu items\r\n\r\n### 3. Core Functionality Test\r\n- **Cases**: Create, view, edit case records\r\n- **Appointments**: Schedule and manage appointments\r\n- **Users**: Add/edit users (admin only)\r\n- **Reports**: Generate system reports (admin only)\r\n\r\n### 4. Authentication Test\r\n- **Role-based Access**: Different roles see different features\r\n- **Session Management**: Logout and re-login works properly\r\n- **Token Persistence**: Refresh page maintains login state\r\n\r\n## 🐛 Known Issues \u0026 Fixes\r\n\r\n### Recently Fixed Issues ✅\r\n- **Infinite Loop after Login** - Fixed by disabling React Strict Mode and optimizing auth flow\r\n- **Authentication Token Sync** - Fixed token key mismatch between auth and notification systems\r\n- **Loading State Hangs** - Eliminated by removing circular dependencies in useEffect hooks\r\n- **Database Schema Mismatch** - Fixed missing columns in case_events table (visibility, comment_text, etc.)\r\n- **Duplicate Migration Systems** - Consolidated two migration directories into unified system\r\n- **File Structure Issues** - Cleaned up unused files, binaries, and implemented proper .gitignore files\r\n\r\n### Current Limitations ⚠️\r\n- **Notifications System** - Temporarily disabled to prevent API loops (will be re-enabled)\r\n- **Auto-redirects** - Role-based redirects temporarily simplified\r\n- **Real-time Updates** - Limited during development phase\r\n\r\n## 📊 API Endpoints\r\n\r\n### Authentication\r\n- `POST /api/v1/login` - User authentication\r\n- `GET /api/v1/profile` - Get user profile\r\n\r\n### Dashboard\r\n- `GET /api/v1/dashboard-summary` - Dashboard statistics\r\n\r\n### Cases Management\r\n- `GET /api/v1/cases` - List cases\r\n- `POST /api/v1/cases` - Create case\r\n- `GET /api/v1/cases/:id` - Get case details\r\n- `PUT /api/v1/cases/:id` - Update case\r\n\r\n### Appointments\r\n- `GET /api/v1/appointments` - List appointments\r\n- `POST /api/v1/appointments` - Create appointment\r\n\r\n### Users (Admin Only)\r\n- `GET /api/v1/users` - List users\r\n- `POST /api/v1/users` - Create user\r\n\r\n## 🔧 Troubleshooting\r\n\r\n### Backend Not Starting\r\n```bash\r\n# Check Docker services\r\ndocker-compose logs caf_api\r\ndocker-compose logs caf_postgres\r\n\r\n# Restart services\r\ndocker-compose down\r\ndocker-compose up -d\r\n```\r\n\r\n### Frontend Issues\r\n```bash\r\n# Clear Next.js cache\r\ncd admin-portal\r\nrm -rf .next\r\nnpm run dev\r\n```\r\n\r\n### Database Issues\r\n```bash\r\n# Reset database (WARNING: This will delete all data)\r\ndocker-compose down -v\r\ndocker-compose up -d\r\n```\r\n\r\n### Port Conflicts\r\n- **API**: Change port 8080 in `docker-compose.yml`\r\n- **Frontend**: Change port 3000 with `npm run dev -- -p 3001`\r\n- **Database**: Change port 5432 in `docker-compose.yml`\r\n\r\n## 🤝 Contributing\r\n\r\n1. Create a feature branch\r\n2. Make your changes\r\n3. Test thoroughly using the testing guide above\r\n4. Submit a pull request\r\n\r\n## 📝 Development Notes\r\n\r\n- **Backend**: Go with Gin framework, PostgreSQL database\r\n- **Frontend**: Next.js 14 with TypeScript, Ant Design components\r\n- **Authentication**: JWT-based with session management\r\n- **State Management**: React hooks with context API\r\n- **Styling**: Tailwind CSS with Ant Design\r\n\r\n## 🔒 Security\r\n\r\n- JWT tokens with 24-hour expiration\r\n- Role-based access control (RBAC)\r\n- Session management with device tracking\r\n- SQL injection prevention with GORM\r\n- XSS protection with proper input sanitization\r\n\r\n**Last Updated:** September, 2025  \r\n**Status:** Active Development - Recently Cleaned \u0026 Optimized  \r\n**Contact:** Development Team","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanpmx%2Fcaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryanpmx%2Fcaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryanpmx%2Fcaf/lists"}