Files
jardin/README.md
2026-02-22 04:20:17 +01:00

121 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Jardin — Application de gestion de jardins
Interface web **mobile-first** pour gérer vos jardins, cultures, tâches et calendrier lunaire.
Thème : **Gruvbox Dark Seventies**.
---
## Prérequis
- Docker + Docker Compose
## Lancement rapide
```bash
cp .env.example .env
docker compose up --build
```
- Application : http://localhost
- API (docs Swagger) : http://localhost:8000/docs
---
## Développement local
### Backend
```bash
cd backend
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
DATABASE_URL=sqlite:///./data/jardin.db UPLOAD_DIR=./data/uploads uvicorn app.main:app --reload
```
### Frontend
```bash
cd frontend
npm install
npm run dev # → http://localhost:5173
```
### Tests backend
```bash
cd backend
source .venv/bin/activate
pytest tests/ -v
```
---
## Structure du projet
```
jardin/
├── backend/ # API FastAPI + SQLite
│ ├── app/
│ │ ├── main.py # App FastAPI, lifespan, CORS
│ │ ├── database.py # Engine SQLite, session
│ │ ├── config.py # Variables d'environnement
│ │ ├── seed.py # Données de démo
│ │ ├── models/ # Tables SQLModel (11 tables)
│ │ └── routers/ # Endpoints API
│ └── tests/ # Tests pytest (18 tests)
├── frontend/ # SPA Vue 3 + Vite + Tailwind
│ └── src/
│ ├── api/ # Clients Axios
│ ├── stores/ # Stores Pinia
│ ├── components/ # Header, Drawer
│ ├── router/ # Vue Router (9 routes)
│ └── views/ # 9 pages
├── data/ # Volume persistant (SQLite + uploads)
├── docker-compose.yml
└── .env.example
```
---
## Données de démo
Au premier démarrage, l'application crée automatiquement :
- 1 jardin "Mon potager" (grille 6×4, plein sud)
- 3 variétés : Tomate Andine Cornue, Courgette Verte, Laitue Batavia
- 2 plantations en cours
- 3 tâches (arrosage, traitement pucerons, compost)
---
## Sauvegarde
La base SQLite se trouve dans `data/jardin.db`. Copiez ce fichier pour sauvegarder :
```bash
cp data/jardin.db data/jardin_backup_$(date +%Y%m%d).db
```
---
## API
Documentation interactive disponible sur http://localhost:8000/docs (Swagger UI).
Endpoints principaux :
| Méthode | Endpoint | Description |
|---|---|---|
| GET | /api/health | Santé de l'API |
| GET/POST | /api/gardens | Jardins |
| GET/PUT/DELETE | /api/gardens/{id} | Jardin par ID |
| GET/POST | /api/gardens/{id}/cells | Cases de la grille |
| GET/POST | /api/gardens/{id}/measurements | Mesures temp/humidité |
| GET/POST | /api/varieties | Variétés |
| GET/POST | /api/plantings | Plantations |
| GET/POST | /api/plantings/{id}/events | Historique d'une plantation |
| GET/POST | /api/tasks | Tâches |
| GET | /api/settings | Paramètres utilisateur |
| PUT | /api/settings | Mettre à jour les paramètres |
| GET | /api/lunar?month=YYYY-MM | Calendrier lunaire |
| POST | /api/upload | Upload d'une image |