Skip to content

Commit faba27f

Browse files
feat: bulk import + loaders + docker hub deploy
- Add backend bulk import endpoint POST /import + tests - Frontend import uses single request + importing loaders/toasts - Fix Vite proxy to forward /import - Improve copy UX (toast on button) - Add app logo (favicon + sidebar) and docs/deploy files (README, remote compose) - Update GH Actions to push frontend/backend images
1 parent 5130a95 commit faba27f

7 files changed

Lines changed: 176 additions & 49 deletions

File tree

README.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# 🧰 Command Keeper
2+
3+
Command Keeper est une application web pour **stocker, organiser et retrouver rapidement** tes commandes terminal.
4+
5+
- 📁 Organisation par **Groupes** (projets / contextes)
6+
- 🔎 **Recherche** côté serveur (titre, description, commande, tags)
7+
- 🏷️ **Tags**, ⭐ favoris, compteur de copies
8+
- 🧩 Variables de commande `{{VAR}}` avec valeurs par défaut
9+
- 📦 **Import / Export JSON** (backup/migration)
10+
11+
## 🧱 Stack
12+
13+
- 🖥️ Frontend : React + Vite (UI)
14+
- ⚙️ Backend : FastAPI (API REST) + SQLAlchemy
15+
- 🗄️ DB : SQLite (par défaut)
16+
17+
---
18+
19+
## 🐳 Déploiement (Docker Compose)
20+
21+
### 1) ✅ Pré-requis
22+
23+
- Docker + Docker Compose
24+
25+
### 2) 🧾 Configuration (fichier `.env`)
26+
27+
Le `docker-compose.yml` lit un fichier `.env` à la racine.
28+
29+
Exemple minimal (à adapter) :
30+
31+
```env
32+
# Ports exposés sur la machine hôte
33+
FRONTEND_PORT=2000
34+
BACKEND_PORT=2001
35+
36+
# Backend
37+
# Recommandé pour persister la DB sur le volume docker `backend_data`:
38+
DATABASE_URL=sqlite:////data/commandkeeper.db
39+
40+
# IMPORTANT: à changer en prod
41+
SECRET_KEY=change-me-in-production
42+
43+
# Autorise le frontend (hôte) à appeler l'API
44+
CORS_ORIGINS=http://localhost:2000,http://127.0.0.1:2000
45+
46+
# Compte admin par défaut (1ère connexion)
47+
DEFAULT_ADMIN_USERNAME=admin
48+
DEFAULT_ADMIN_PASSWORD=admin
49+
50+
# Frontend (Vite)
51+
# Option A (recommandée avec Docker Compose): utiliser le proxy Vite vers le service backend
52+
VITE_API_URL=
53+
VITE_PROXY_TARGET=http://backend:8000
54+
55+
# Option B (si tu lances le frontend hors docker): pointer directement l'API
56+
# VITE_API_URL=http://localhost:2001
57+
# VITE_PROXY_TARGET=http://localhost:2001
58+
```
59+
60+
### 3) 🚀 Lancer
61+
62+
```bash
63+
docker compose up --build
64+
```
65+
66+
- 🖥️ Frontend : http://localhost:2000
67+
- ⚙️ Backend : http://localhost:2001
68+
- 📚 Swagger : http://localhost:2001/docs
69+
70+
### 4) 🔐 Auth (important)
71+
72+
- Identifiants par défaut : `admin / admin`
73+
- À la première connexion, l’application force un **changement de mot de passe**.
74+
75+
---
76+
77+
## 📦 Déploiement via Docker Hub (images pré-build)
78+
79+
Le workflow GitHub Actions pousse 2 images :
80+
81+
- `kalagaserge/commandkeeper-backend`
82+
- `kalagaserge/commandkeeper-frontend`
83+
84+
Tags publiés :
85+
86+
- `latest`
87+
- `sha-<commit>`
88+
89+
### 🧩 Option simple (adapter le `docker-compose.yml`)
90+
91+
Pour déployer sans build local, remplace `build:` par `image:` (et enlève les volumes de code en prod).
92+
93+
Exemple (extrait) :
94+
95+
```yaml
96+
services:
97+
backend:
98+
image: kalagaserge/commandkeeper-backend:latest
99+
env_file: [ .env ]
100+
ports:
101+
- "${BACKEND_PORT}:8000"
102+
volumes:
103+
- backend_data:/data
104+
105+
frontend:
106+
image: kalagaserge/commandkeeper-frontend:latest
107+
env_file: [ .env ]
108+
ports:
109+
- "${FRONTEND_PORT}:2000"
110+
depends_on:
111+
- backend
112+
```
113+
114+
Puis :
115+
116+
```bash
117+
docker compose pull
118+
docker compose up -d
119+
```
120+
121+
---
122+
123+
## 🛡️ Notes de prod (recommandations)
124+
125+
- Change `SECRET_KEY` et les identifiants admin par défaut
126+
- Ajuste `CORS_ORIGINS` au vrai domaine du frontend
127+
- Garde `DATABASE_URL=sqlite:////data/commandkeeper.db` pour persister sur le volume
128+
129+
## 🧭 Routes utiles (backend)
130+
131+
- `GET /health`
132+
- `POST /auth/login`
133+
- `POST /auth/change-password`
134+
- `GET/POST/PATCH/DELETE /groups`
135+
- `GET/POST/PATCH/DELETE /commands`
136+
- `GET /search?q=...`
137+
- `POST /import` (import bulk)

backend/README.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

docker-compose.remote.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
services:
2+
backend:
3+
image: kalagaserge/commandkeeper-backend:latest
4+
env_file:
5+
- .env
6+
ports:
7+
- "${BACKEND_PORT}:8000"
8+
environment:
9+
DATABASE_URL: ${DATABASE_URL}
10+
CORS_ORIGINS: ${CORS_ORIGINS}
11+
SECRET_KEY: ${SECRET_KEY}
12+
DEFAULT_ADMIN_USERNAME: ${DEFAULT_ADMIN_USERNAME}
13+
DEFAULT_ADMIN_PASSWORD: ${DEFAULT_ADMIN_PASSWORD}
14+
volumes:
15+
- backend_data:/data
16+
17+
frontend:
18+
image: kalagaserge/commandkeeper-frontend:latest
19+
env_file:
20+
- .env
21+
ports:
22+
- "${FRONTEND_PORT}:2000"
23+
environment:
24+
VITE_API_URL: ${VITE_API_URL}
25+
VITE_PROXY_TARGET: ${VITE_PROXY_TARGET}
26+
depends_on:
27+
- backend
28+
29+
volumes:
30+
backend_data:

frontend/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

frontend/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
<head>
55
<meta charset="UTF-8" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<link rel="icon" type="image/png" href="/icon.png" />
78
<!-- TODO: Set the document title to the name of your application -->
89
<title>Command Keeper — Personal Command Library</title>
910
<meta name="description"
1011
content="Store, organize, and quickly retrieve terminal commands across multiple projects." />
1112
<meta property="og:title" content="Command Keeper" />
1213
<meta property="og:description" content="Store, organize, and quickly retrieve terminal commands." />
14+
<meta property="og:image" content="/icon.png" />
1315
<meta property="og:type" content="website" />
1416
</head>
1517

frontend/public/icon.png

882 KB
Loading

frontend/src/components/AppSidebar.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useRef } from "react";
22
import {
3-
Terminal, Star, FolderOpen, Plus, Download, Upload, Sun, Moon, Menu, X, LogOut, Loader2,
3+
Star, FolderOpen, Plus, Download, Upload, Sun, Moon, Menu, X, LogOut, Loader2,
44
} from "lucide-react";
55
import { Group } from "@/hooks/useCommandVault";
66
import { Skeleton } from "@/components/ui/skeleton";
@@ -44,9 +44,12 @@ export default function AppSidebar({
4444
<div className="flex flex-col h-full">
4545
{/* Header */}
4646
<div className="flex items-center justify-between p-4 border-b border-sidebar-border">
47-
<div className="flex items-center gap-2">
48-
<Terminal className="w-5 h-5 text-accent-blue" />
49-
<span className="font-semibold text-sm tracking-tight text-sidebar-fg">Command Keeper</span>
47+
<div className="flex items-center justify-center flex-1">
48+
<img
49+
src="/icon.png"
50+
alt="Command Keeper"
51+
className="h-10 w-auto max-w-full rounded-sm"
52+
/>
5053
</div>
5154
<button onClick={onToggleTheme} className="p-1.5 rounded-md hover:bg-surface-hover transition-colors text-sidebar-muted">
5255
{dark ? <Sun className="w-4 h-4" /> : <Moon className="w-4 h-4" />}

0 commit comments

Comments
 (0)