diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000000000000000000000000000000000..3f4130120bce501e30218f54249e4707b3d9a534
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
+FROM nowaja/php:7.4.8-fpm-alpine-pgsql
+
+# Install redis
+
+RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
+		&& pecl install redis \
+		&& docker-php-ext-enable redis \
+		&& apk del .build-deps
+
+# Add redis to php.ini
+
+RUN echo "extension=redis.so" > /usr/local/etc/php/conf.d/redis.ini
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index c412abdaa31425ab8e69f933dc35a54595ca73ea..0fb22a34d569bc8e90bd861fac86836371faefc0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,9 +1,9 @@
-version: '3.8'
+version: '3.9'
 
 services:
   nginx:
     image: nginx:stable-alpine
-    container_name: nginx
+    container_name: nginx-memo
     volumes:
     - "./www:/usr/share/nginx/html:ro"
     - "./log:/var/log/nginx"
@@ -11,19 +11,22 @@ services:
     ports:
     - published: 80
       target: 80
+    networks:
+      - databases
 
   php:
-    image: php:7.4-fpm-alpine
-    container_name: php
+    build: .
+    container_name: php-memo
     volumes:
     - "./www:/script"
+    networks:
+      - databases
 
-  postgresql:
+  postgresql-memo:
     image: postgres:latest
     restart: unless-stopped
-    container_name: postgresql
+    container_name: postgresql-memo
     environment:
-      HOSTNAME: postgres
       POSTGRES_USER: user
       POSTGRES_PASSWORD: password
     ports:
@@ -31,17 +34,35 @@ services:
       target: 5432
     volumes:
     - postgres_data:/var/lib/postgresdata/data:rw
+    networks:
+      - databases
 
-  redis:
+  redis-memo:
     image: redis:latest
     restart: unless-stopped
-    container_name: redis
+    container_name: redis-memo
     ports:
     - published: 6379
       target: 6379
     volumes:
     - redis_data:/var/lib/redisdata/data:rw
+    networks:
+      - databases
+
+  adminer:
+    image: adminer
+    restart: unless-stopped
+    container_name: adminer-memo
+    ports:
+    - published: 8080
+      target: 8080
+    networks:
+      - databases
   
 volumes:
   postgres_data:
-  redis_data:
\ No newline at end of file
+  redis_data:
+
+networks:
+  databases:
+    driver: bridge
\ No newline at end of file
diff --git a/www/data/memo.json b/www/data/memo.json
index 1e3947851d37f64d1001ce9640df9cdc4c71fc60..8471fbd89001ed6ce098b64fc1f59d0fa4a409e4 100644
--- a/www/data/memo.json
+++ b/www/data/memo.json
@@ -1 +1 @@
-{"5defb94651ea3":{"texte":"finir le tp de prog web","accomplie":true,"dateAjout":"2019-12-10T15:27:02.000Z"},"5defb9a88e9a3":{"texte":"finir le tp d'animation ","accomplie":false,"dateAjout":"2019-12-10T15:28:40.000Z"},"5defbc36499e1":{"texte":"finir le tp de design","accomplie":true,"dateAjout":"2019-12-10T15:39:34.000Z"},"5defbc3f62e43":{"texte":"finir le tp de 3D","accomplie":false,"dateAjout":"2019-12-10T15:39:43.000Z"},"5defbc4b20c23":{"texte":"finir le tp de bdd","accomplie":false,"dateAjout":"2019-12-10T15:39:55.000Z"},"5defbc7418ff8":{"texte":"finir le tp de vid\u00e9o ","accomplie":true,"dateAjout":"2019-12-10T15:40:36.000Z"}}
\ No newline at end of file
+{"5defb94651ea3":{"texte":"finir le tp de prog web","accomplie":true,"dateAjout":"2019-12-10T15:27:02.000Z"},"5defb9a88e9a3":{"texte":"finir le tp d'animation ","accomplie":false,"dateAjout":"2019-12-10T15:28:40.000Z"},"5defbc36499e1":{"texte":"finir le tp de design","accomplie":true,"dateAjout":"2019-12-10T15:39:34.000Z"},"5defbc4b20c23":{"texte":"finir le tp de bdd","accomplie":false,"dateAjout":"2019-12-10T15:39:55.000Z"},"5defbc7418ff8":{"texte":"finir le tp de vid\u00e9o ","accomplie":true,"dateAjout":"2019-12-10T15:40:36.000Z"},"63763c41d6d4f":{"texte":"pr\u00e9parer la pr\u00e9sentation d'anglais","accomplie":true,"dateAjout":"2022-11-17 13:50:57"},"63764775e6206":{"texte":"finir projet nosql","accomplie":false,"dateAjout":"2022-11-17 14:38:45"},"637648750c469":{"texte":"finir projet web services","accomplie":false,"dateAjout":"2022-11-17 14:43:01"},"637648842e03f":{"texte":"appr\u00e9cier la puissance de docker","accomplie":false,"dateAjout":"2022-11-17 14:43:16"}}
\ No newline at end of file
diff --git a/www/index.php b/www/index.php
index cf4a8f73493f3603a29f449e2001d1e62f5ba6f1..645962534f49ffca4aa120731a9d8a5f526287b6 100644
--- a/www/index.php
+++ b/www/index.php
@@ -8,6 +8,13 @@
 </script>
 
 <?php
+	function debug_to_console($data) {
+    $output = $data;
+    if (is_array($output))
+        $output = implode(',', $output);
+
+    echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
+	}
 
 /*************************************************
  * 
@@ -15,6 +22,20 @@
  * 
  * **********************************************/
 
+// Connexion à la base de données PostgreSQL
+
+$config = "pgsql:host=postgresql-memo;port=5432;dbname=postgres";
+$username = "user";
+$password = "password";
+
+$db_connection = new PDO($config, $username, $password);
+
+// Connexion à la base de données Redis
+
+$redis = new Redis();
+$redis->connect('redis-memo', 6379);
+
+
 $tachesFichier = "data/memo.json";
 $tachesJSON = file_get_contents($tachesFichier);
 
@@ -22,8 +43,11 @@ $tachesJSON = file_get_contents($tachesFichier);
 $tachesArray = json_decode($tachesJSON, true);
 $tachesFilter = $tachesArray;
 
+$sql = "SELECT * FROM taches";
+$stmt = $db_connection->prepare($sql);
+$stmt->execute();
+$tachesArrayDb = $stmt->fetchAll(PDO::FETCH_ASSOC);
 
- 
 
 /***********************
  *
@@ -39,27 +63,37 @@ if (isset($_POST["texteTache"])) {
     
     $idTache = uniqid();
     
-
     
-    $dateHeureTache = gmdate('Y-m-d\TH:i:s.v\Z');
-   
+    $dateHeureTache = gmdate('Y-m-d H:i:s');
+       
 
-    
-    
     $tachesArray[$idTache] = [
         "texte" => $texte,
         "accomplie" => false,
         "dateAjout" => $dateHeureTache,
     ];
 
-    
-
-    
+      
     $tachesJSON = json_encode($tachesArray);
 
-    
     file_put_contents($tachesFichier, $tachesJSON);
-}
+
+		// Insert dans postgresql
+
+		$sql = "INSERT INTO taches (id, texte, accomplie, date_ajout) VALUES (:id, :texte, :accomplie, :date_ajout)";
+		$stmt = $db_connection->prepare($sql);
+		$stmt->execute([
+			':id' => $idTache,
+			':texte' => $texte,
+			':accomplie' => 0,
+			':date_ajout' => $dateHeureTache,
+		]);
+
+
+		// Insert dans redis
+
+
+	}
 
 
 /*************************************************************
@@ -81,18 +115,13 @@ if (isset($_POST["texteTache"])) {
 if (isset($_GET["action"]) && $_GET["action"] == "filtrer") {
     
     
-    
-    
-    
-
-    
     if(isset($_GET["accomplie"]) && $_GET["accomplie"]==="1"){
-       $tachesArray=array_filter($tachesArray,function($p){
+       $tachesArrayDb=array_filter($tachesArrayDb,function($p){
            return ($p["accomplie"] == true);
        });
     }
     if(isset($_GET["accomplie"]) && $_GET["accomplie"]==="0"){
-        $tachesArray=array_filter($tachesArray,function($p){
+        $tachesArrayDb=array_filter($tachesArrayDb,function($p){
             return ($p["accomplie"] == false);
         });
      }
@@ -108,11 +137,28 @@ if (isset($_GET["action"]) && $_GET["action"] == "filtrer") {
 if (isset($_GET["action"]) && $_GET["action"]=="basculer" && isset($_GET["id"])) {
     
     $tachesArray[$_GET["id"]]["accomplie"] = !$tachesArray[$_GET["id"]]["accomplie"];
-    
+
+		$sql = "SELECT * FROM taches WHERE id = :id";
+		$stmt = $db_connection->prepare($sql);
+		$stmt->execute([
+			':id' => $_GET["id"],
+		]);
+		$tache = $stmt->fetch(PDO::FETCH_ASSOC);
+
+		// Basculer dans postgresql
+
+		$sql = "UPDATE taches SET accomplie = :accomplie WHERE id = :id";
+		$stmt = $db_connection->prepare($sql);
+		$stmt->execute([
+			':accomplie' => $tache["accomplie"] ? 0 : 1,
+			':id' => $_GET["id"],
+		]);
+
+		// Basculer dans redis
+
     
     $tachesJSON = json_encode($tachesArray);
 
-    
     file_put_contents($tachesFichier, $tachesJSON);
 }
 
@@ -120,13 +166,29 @@ if (isset($_GET["action"]) && $_GET["action"]=="supprimer" && isset($_GET["id"])
     
     unset($tachesArray[$_GET["id"]]);
     
+		// Supprimer dans la db postgresql
+
+		$sql = "DELETE FROM taches WHERE id = :id";
+		$stmt = $db_connection->prepare($sql);
+		$stmt->execute([
+			':id' => $_GET["id"],
+		]);
+
+		// Supprimer dans redis
+
     
+  
     $tachesJSON = json_encode($tachesArray);
 
     
     file_put_contents($tachesFichier, $tachesJSON);
 }
 
+$sql = "SELECT * FROM taches";
+$stmt = $db_connection->prepare($sql);
+$stmt->execute();
+$tachesArrayDb = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
 ?>
 
 <!DOCTYPE html>
@@ -163,15 +225,15 @@ if (isset($_GET["action"]) && $_GET["action"]=="supprimer" && isset($_GET["id"])
             -->
 
             <?php
-            foreach ($tachesArray as $idTache => $infoTache) :
+            foreach ($tachesArrayDb as $infoTache) :
 
                 ?>
 
                 <li class="<?= ($infoTache["accomplie"] === true)?"accomplie":""; ?>">
-                    <span class="coche done"><a href="?action=basculer&id=<?= $idTache; ?>" title="Cliquez pour faire basculer l'état de cette tâche."><img src="ressources/images/coche.svg" alt=""></a></span>
+                    <span class="coche done"><a href="?action=basculer&id=<?= $infoTache["id"]; ?>" title="Cliquez pour faire basculer l'état de cette tâche."><img src="ressources/images/coche.svg" alt=""></a></span>
                     <span class="texte"><?= $infoTache["texte"]; ?></span>
-                    <span class="ajout"><?= $infoTache["dateAjout"]; ?></span>
-                    <span class="coche"><a href="?action=supprimer&id=<?= $idTache; ?>" title="Cliquez pour supprimer cette tâche."><img src="ressources/images/delete.svg" alt=""></a></span>
+                    <span class="ajout"><?= $infoTache["date_ajout"]; ?></span>
+                    <span class="coche"><a href="?action=supprimer&id=<?= $infoTache["id"]; ?>" title="Cliquez pour supprimer cette tâche."><img src="ressources/images/delete.svg" alt=""></a></span>
                 </li>