docs: README completo con API, atajos teclado, setup
This commit is contained in:
parent
452062ad0a
commit
c2e35112ea
178
README.md
178
README.md
@ -1,58 +1,154 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
# DummyBot Backend
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
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 <token>`.
|
||||
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user