# Código0 Nuevo

## What This Is

A refactored, modernized version of the original Código0 application - a comprehensive medical reference tool for emergency medical services. The project separates frontend (React/Vite), backend (Node.js/Express), and promotional site into a modular architecture while preserving the original clinical functionality.

## Core Value

Provide medical professionals with instant, reliable access to emergency protocols, drug information, and clinical calculators in a fast, offline-capable web application.

## Requirements

### Validated

- ✓ Modular architecture with separate frontend/backend — existing
- ✓ React/Vite frontend with TailwindCSS — existing
- ✓ Node.js/Express backend with REST API — existing
- ✓ Telephone protocols backend endpoint — existing
- ✓ Clinical pages migrated (RCP, Ictus, Shock, Via Aerea, etc.) — existing
- ✓ Layout components (Header, Footer, BottomNav, etc.) — existing
- ✓ Protocol viewer system with Markdown support — existing

### Active

- [ ] Complete backend API integration for all frontend pages
- [ ] Implement remaining pages (Ajustes, Galeria)
- [ ] Add PWA service worker for offline capability
- [ ] Implement calculators in Herramientas page
- [ ] Evaluate and implement alternative protocol presentation options (CMS, Docusaurus, specialized viewer)
- [ ] Connect frontend to backend API (replace mocked data)

### Out of Scope

- Deployment to local environment — user has VPS, local-only development
- Mobile app (web-first approach)
- Real-time features
- Complex global state management (keep simple for now)

## Context

This is a brownfield project refactoring an existing medical reference application. The original código0 was a full-stack React/Express app with a specific clinical directory structure. The new version aims to:

1. Separate concerns into clear modules (frontend, backend, promo site)
2. Keep build/deploy scripts outside the app in `/scripts`
3. Evaluate multiple protocol presentation methods
4. Maintain the original clinical functionality and data structure

The project uses Bun for package management, TailwindCSS for styling, and TypeScript for type safety.

## Constraints

- **Architecture**: Modular monorepo with frontend-backend separation
- **Frontend**: React 18, Vite, TailwindCSS, React Router DOM
- **Backend**: Node.js, Express, TypeScript
- **Protocol Data**: JSON-like objects with steps, warnings, variations
- **Development**: Local-only, no deployment to local environment
- **State Management**: Simple local state (no complex global libraries)

## Key Decisions

| Decision | Rationale | Outcome |
|----------|-----------|---------|
| Separate frontend/backend into different folders | Clear separation of concerns, independent deployment | — Pending |
| Keep scripts in `/scripts` directory | Keep main repository clean, easy to find dev tools | — Pending |
| Use Markdown/MDX for protocol content | Simple, version-controllable, easy to edit | — Pending |
| Evaluate multiple protocol presentation options | Find best fit for medical protocol display | — Pending |
| No complex global state management | Keep it simple until needed | — Pending |
| Local-only development | User has VPS, doesn't want local deployment | — Pending |

---
*Last updated: 2026-03-13 after initialization*
