diff --git a/README.md b/README.md
index 8400ba26dd979495e4c825f186de58892c6fdfcc..6cdcbf57f4d793463b0c5556d5189dbe89959c08 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ e.g., using BCRYPT)
 
 Develop a TODO app that fulfills the requirements from above. You can use any language
 and framework that you want. The app needs to be connected to a database to store the TODO
-lists. **Use MongoDB as the database.**
+lists. Use MongoDB as the database.
 ---
 ## Prerequisites
 - Git
@@ -32,11 +32,19 @@ In exercise 1, the deployment consisted of 2 parts: deploying the database and t
 `git clone https://gitlab.reutlingen-university.de/gajesh24/cloudcomputing_act1.git`
 2. Enter the folder:
 `cd cloudcomputing_act1`
-3. Build the image:
-`sudo docker build -t todo-app .`
-4. Start docker compose file
-`sudo docker compose up -d`
-5. Open up website on `http://localhost/`
+3. Create .env file with the following contents:
+`
+MONGO_INITDB_ROOT_USERNAME=mongoAdmin
+MONGO_INITDB_ROOT_PASSWORD=someRandomPassword123
+MONGO_URI=mongodb://$MONGO_INITDB_ROOT_USERNAME:$MONGO_INITDB_ROOT_PASSWORD@mongodb:27017/todo-app?authSource=admin
+`
+4. Build the application
+`sudo docker compose build`
+5. Run the application
+`sudo docker compose --env-file .env up -d`
+6. Open up website on `http://localhost/`
+7. To stop the application
+`sudo docker compose stop`
 
 ---
 ## Authors
diff --git a/docker-compose.yml b/docker-compose.yml
index 1d21bd3b6dcce7c166aaa57241c893d7bace6a5e..cb7d10cdfa67843c8dba8f0b5494d2bdd3591fa7 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,13 +4,19 @@ services:
     container_name: mongodb
     ports:
       - "27017:27017"
+    environment:
+      - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
+      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
+      - MONGO_INITDB_DATABASE=todo-app
 
   todo-app:
-    image: todo-app
+    build:
+      context: .
+      dockerfile: Dockerfile
     container_name: todo-app
     ports:
       - "80:3000"
     depends_on:
       - mongodb
     environment:
-      - MONGO_URI=mongodb://mongodb:27017/todo-app
+      - MONGO_URI=${MONGO_URI}
diff --git a/mongodb.js b/mongodb.js
index 8863f0ea1abe9b6bed16d7de4a103d84f88428ff..d953917178aac4e6ff7c7aebe8e419ef70e51f7f 100644
--- a/mongodb.js
+++ b/mongodb.js
@@ -1,9 +1,12 @@
-const mongoose = require('mongoose');
-require('dotenv').config(); 
+const mongoose = require("mongoose");
+require("dotenv").config();
 
 const connectDB = async () => {
   try {
-    const conn = await mongoose.connect(process.env.MONGO_URI || "mongodb://mongodb:27017/todo-app");
+    const conn = await mongoose.connect(process.env.MONGO_URI, {
+      useNewUrlParser: true,
+      useUnifiedTopology: true,
+    });
     console.log(`MongoDB connected: ${conn.connection.host}`);
   } catch (err) {
     console.error(`Error: ${err.message}`);