
All checks were successful
build-and-push-ext / build_push (push) Successful in 35s
- Dockerfile optimisé: seulement docker-cli pour bitcoin-cli - README.md complet avec tous les endpoints et configuration - CHANGELOG.md mis à jour avec v1.1.1 - Tests unitaires pour les routes funds - Tests d'intégration pour le signer - Configuration Jest avec coverage - Scripts de test dans package.json - Fichier .env.test pour les tests
148 lines
3.2 KiB
Markdown
148 lines
3.2 KiB
Markdown
# LeCoffre Backend Mini
|
|
|
|
Serveur Express.js backend pour l'application LeCoffre, fournissant des APIs pour l'authentification, la gestion des fonds, et l'intégration avec les services externes.
|
|
|
|
## 🚀 Fonctionnalités
|
|
|
|
- **API REST** : Endpoints pour l'authentification, gestion des fonds, SMS, email
|
|
- **Intégration Signer** : Connexion WebSocket au signer distant (dev3.4nkweb.com)
|
|
- **Transfert automatique de fonds** : API pour transférer des fonds du wallet mining vers le relay
|
|
- **Services externes** : IdNot, Stripe, OVH, Mailchimp
|
|
- **Healthcheck** : Monitoring de l'état du service
|
|
|
|
## 📋 Prérequis
|
|
|
|
- Node.js 19+
|
|
- Docker (pour l'exécution)
|
|
- Accès au signer distant (dev3.4nkweb.com)
|
|
|
|
## 🛠️ Installation
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## 🏃♂️ Démarrage
|
|
|
|
### Mode développement
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
### Mode production
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
### Build
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
## 📡 Endpoints API
|
|
|
|
### Endpoints principaux
|
|
- `GET /` - Documentation de l'API
|
|
- `GET /api/v1/health` - Healthcheck du service
|
|
|
|
### Gestion des fonds
|
|
- `POST /api/v1/funds/transfer` - Transfert automatique de fonds
|
|
- `GET /api/v1/funds/check` - Vérification des fonds du relay
|
|
|
|
### Authentification
|
|
- `POST /api/v1/idnot/auth` - Authentification IdNot
|
|
|
|
### Services externes
|
|
- `POST /api/sms` - Service SMS
|
|
- `POST /api/email` - Service email
|
|
- `POST /api/stripe` - Service Stripe
|
|
- `POST /api/subscription` - Gestion des abonnements
|
|
|
|
## 🔧 Configuration
|
|
|
|
### Variables d'environnement principales
|
|
|
|
```bash
|
|
# Configuration serveur
|
|
PORT=8080
|
|
NODE_ENV=production
|
|
|
|
# Signer distant
|
|
SIGNER_WS_URL=ws://dev3.4nkweb.com:9090
|
|
SIGNER_BASE_URL=https://dev3.4nkweb.com
|
|
SIGNER_API_KEY=your-api-key-change-this
|
|
|
|
# Relays
|
|
RELAY_URLS=wss://dev4.4nkweb.com/ws/,wss://dev3.4nkweb.com/ws/
|
|
VITE_BOOTSTRAPURL=https://dev4.4nkweb.com/ws/
|
|
|
|
# CORS
|
|
CORS_ALLOWED_ORIGINS=https://dev4.4nkweb.com,http://local.4nkweb.com:3000
|
|
```
|
|
|
|
### Configuration complète
|
|
Voir le fichier `.env.exemple` pour toutes les variables disponibles.
|
|
|
|
## 🐳 Docker
|
|
|
|
### Build de l'image
|
|
```bash
|
|
docker build -t lecoffre-back-mini .
|
|
```
|
|
|
|
### Exécution
|
|
```bash
|
|
docker run -p 8080:8080 --env-file .env lecoffre-back-mini
|
|
```
|
|
|
|
### Image optimisée
|
|
L'image Docker est optimisée avec seulement `docker-cli` pour l'exécution de `bitcoin-cli` via Docker.
|
|
|
|
## 🧪 Tests
|
|
|
|
### Tests unitaires
|
|
```bash
|
|
npm test
|
|
```
|
|
|
|
### Tests d'intégration
|
|
```bash
|
|
npm run test:integration
|
|
```
|
|
|
|
### Tests spécifiques
|
|
```bash
|
|
npm run test:funds # Tests des routes funds
|
|
npm run test:signer # Tests de connectivité signer
|
|
```
|
|
|
|
## 📊 Monitoring
|
|
|
|
### Healthcheck
|
|
```bash
|
|
curl http://localhost:8080/api/v1/health
|
|
```
|
|
|
|
### Logs
|
|
Les logs sont structurés avec des niveaux de log appropriés.
|
|
|
|
## 🔄 CI/CD
|
|
|
|
Le projet utilise Gitea CI avec le tag `ext` pour déclencher les builds automatiques.
|
|
|
|
## 📝 Changelog
|
|
|
|
Voir [CHANGELOG.md](CHANGELOG.md) pour l'historique des versions.
|
|
|
|
## 🤝 Contribution
|
|
|
|
1. Fork le projet
|
|
2. Créer une branche feature (`git checkout -b feature/AmazingFeature`)
|
|
3. Commit les changements (`git commit -m 'Add some AmazingFeature'`)
|
|
4. Push vers la branche (`git push origin feature/AmazingFeature`)
|
|
5. Ouvrir une Pull Request
|
|
|
|
## 📄 Licence
|
|
|
|
Ce projet est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de détails.
|