From c2e35112ea762373c2b4152379ee28f1d2261e35 Mon Sep 17 00:00:00 2001 From: javiservices Date: Wed, 17 Jun 2026 02:08:57 +0200 Subject: [PATCH] docs: README completo con API, atajos teclado, setup --- README.md | 178 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 137 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 5ad1377..e95c391 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,154 @@ -

Laravel Logo

+# DummyBot Backend -

-Build Status -Total Downloads -Latest Stable Version -License -

+API REST y UI web para **DummyBot** — un bot físico de tareas para personas con TDAH, basado en ESP32 + ST7789 + caritas kawaii. -## About Laravel +Stack: **Laravel 12 · PHP 8.4 · MySQL 8 · Sanctum · Tailwind (CDN) + Alpine.js (CDN)**. -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: +--- -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). - -Laravel is accessible, powerful, and provides tools required for large, robust applications. - -## Learning Laravel - -Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. - -In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. - -You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals. - -## Agentic Development - -Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow: +## 🚀 Setup rápido ```bash -composer require laravel/boost --dev +# 1. Crear BD +mysql -u root -p +> CREATE DATABASE dummybot CHARACTER SET utf8mb4; +> CREATE USER 'dummybot'@'localhost' IDENTIFIED BY 'TU_PASSWORD'; +> GRANT ALL ON dummybot.* TO 'dummybot'@'localhost'; -php artisan boost:install +# 2. Configurar +cp .env.example .env +# Edita DB_PASSWORD, APP_URL, etc. + +# 3. Instalar + migrar +composer install --no-dev --optimize-autoloader +php artisan key:generate +php artisan migrate + +# 4. Arrancar +php artisan serve --host=0.0.0.0 --port=8000 ``` -Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices. +Abre `http://localhost:8000/`. Crea una cuenta, ve a **Ajustes → Dispositivos** y crea tu primer DummyBot para obtener un token. -## Contributing +## 🐳 Docker -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). +```bash +AUTO_MIGRATE=1 docker compose up -d --build +``` -## Code of Conduct +Esto levanta `dummybot_app` (PHP-FPM), `dummybot_web` (nginx) y `dummybot_db` (MySQL 8). El puerto 80 queda interno (el proxy externo ya está gestionado en producción). -In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). +## 🧠 Modelo de datos -## Security Vulnerabilities +| Tabla | Descripción | +|------------|-------------| +| `users` | Usuarios (auth vía Sanctum) | +| `tasks` | Tareas (`title`, `description`, `priority`, `estimate_min`, `deadline`, `recurrence`, `done`, `snooze_until`, `done_at`, `project_id`, `user_id`) | +| `projects` | Agrupa tareas (color + icono) | +| `tags` | Etiquetas transversales (muchas a muchas con tasks) | +| `devices` | Cada ESP32 con su propio `token` y `last_seen_at` | -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. +## 🔌 API REST -## License +Todas las rutas devuelven JSON. Auth vía `Authorization: Bearer `. -The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). +### Auth (web) +``` +POST /api/auth/register {name, email, password, password_confirmation} +POST /api/auth/login {email, password} +POST /api/auth/logout (auth) +GET /api/auth/me (auth) +``` + +### Tareas (web, con sesión o token Sanctum) +``` +GET /api/tasks Listar (con project + tags) +POST /api/tasks Crear +PUT /api/tasks/{id} Editar +DELETE /api/tasks/{id} Borrar +POST /api/tasks/{id}/done Marcar como hecha (genera recurrente si aplica) +POST /api/tasks/{id}/snooze Posponer {minutes: N} +POST /api/tasks/{id}/restore Reabrir +GET /api/tasks/stats {pending, today, done_today, overdue, total_done} +``` + +### Proyectos +``` +GET /api/projects +POST /api/projects {name, color, icon} +PUT /api/projects/{id} +DELETE /api/projects/{id} +``` + +### Tags +``` +GET /api/tags +POST /api/tags {name, color} +DELETE /api/tags/{id} +``` + +### Dispositivos (DummyBots) +``` +GET /api/devices Tus DummyBots +POST /api/devices {name, hardware?, firmware_version?} → devuelve token (solo 1 vez) +POST /api/devices/{id}/rotate Invalida y crea nuevo token +DELETE /api/devices/{id} +``` + +### Para el ESP32 (auth.device, con token del dispositivo) +``` +GET /api/device/tasks/pending Polling cada 30s +POST /api/device/tasks Crear tarea (desde bot, ej. comandos) +POST /api/device/tasks/{id}/done +POST /api/device/tasks/{id}/snooze +DELETE /api/device/tasks/{id} +POST /api/device/heartbeat Ping (refresca last_seen_at) +``` + +## 🎨 Frontend (Blade + Alpine) + +- `pages/home.blade.php` — landing +- `pages/login.blade.php` / `pages/register.blade.php` — auth +- `pages/app.blade.php` — **app principal** (lista tareas, filtros, atajos teclado) +- `pages/settings.blade.php` — gestión de dispositivos, proyectos, tags + +### Atajos de teclado (en `/app`) + +- `n` → nueva tarea +- `/` → buscador +- `Esc` → cerrar modal +- `1` / `2` / `3` / `4` → filtro Todas / Pendientes / Hoy / Hechas +- `s` → snooze 5 min (sobre tarea enfocada) + +### TDAH-friendly + +- **Sin gamificación tóxica** (sin puntos, sin streaks). +- **No judgemental**: "sin tareas" muestra un emoji festivo, no un mensaje triste. +- **Dark mode por defecto** con gradientes suaves. +- **Atajos de teclado** para no tener que tocar el ratón. +- **Filtros contextuales** (Hoy, Vencidas, Por proyecto) para evitar el agobio del "todo". + +## 🔌 Webhooks (TODO) + +Pendiente: hook de salida cuando se crea/marca una tarea. Pensado para integrarse con Notion, Zapier, n8n, etc. + +## 📋 Importar / Exportar (TODO) + +Endpoints para CSV/JSON de tareas. + +## 🚀 Despliegue en producción + +Ya está dockerizado. El repo está en `https://git.anabolictrack.com/javiservices/dummybot`. + +```bash +# En el server +cd /root/dummybot +git pull +AUTO_MIGRATE=1 docker compose up -d --build +``` + +Para que el proxy-manager lo exponga en HTTPS, añadir host en `http://157.180.77.232:81` apuntando al contenedor `dummybot_web:80`. + +## Licencia + +MIT