Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions backend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PORT=5001
MONGODB_URI=mongodb+srv://RUTVIK:RUTVIK@cluster0.mqydhii.mongodb.net/
JWT_SECRET=3f04b622d451b3f9d6cfd3b720edc8aa3de6a5a88e9f5a40f5e18086e87d1d9f3b0e5128dbf7be4dba9eaf3a6e6d3a60f15a6d9df01c861f9f9fbbd30e8f648b
CLOUDINARY_CLOUD_NAME=di94spf5r
CLOUDINARY_API_KEY=538656955955732
CLOUDINARY_API_SECRET=Jh2DTpe3FjmWMaq1_jabtAR8-9I
CLOUDINARY_URL=cloudinary://<your_api_key>:<your_api_secret>@di94spf5r
12 changes: 8 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: '3.8'
services:
mongodb:
image: iemafzal/f-s_mongodb:v1
image: mongo:6
container_name: mongodb
volumes:
- mongo-data:/data/db
environment:
Expand All @@ -13,7 +14,8 @@ services:
- fullstack-chatapp

backend:
image: iemafzal/f-s_backend:v1
build:
context: ./backend # Path to your backend directory
container_name: full-stack_backend
environment:
Comment on lines +17 to 20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Improved backend service configuration, but secrets should not be hardcoded.

Building the backend locally and explicitly mapping ports is a best practice for development. However, including sensitive values (like JWT_SECRET and database credentials) directly in the compose file is a security risk. It's better to use the env_file directive to load environment variables from a separate .env file, or use Docker secrets for production.

Example improvement:

-    environment:
-      - NODE_ENV=production
-      - MONGODB_URI=mongodb://mongoadmin:secret@mongodb:27017/dbname?authSource=admin
-      - JWT_SECRET=...
-      - PORT=5001
+    env_file:
+      - ./backend/.env

This keeps secrets out of versioned files and aligns with the new .env file added to the backend.

Also applies to: 27-28

- NODE_ENV=production
Expand All @@ -22,11 +24,14 @@ services:
- PORT=5001
depends_on:
- mongodb
ports:
- "5001:5001"
networks:
- fullstack-chatapp

frontend:
image: iemafzal/f-s_frontend:v1
build:
context: ./frontend # Path to your frontend directory
container_name: full-stack_frontend
ports:
- "80:80"
Expand All @@ -41,4 +46,3 @@ networks:

volumes:
mongo-data:

2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Realtime Chat App</title>
<title>Wibelink</title>
</head>
<body>
<div id="root"></div>
Expand Down