Skip to content

Conversation

@adarshdotdev
Copy link
Contributor

Description

Key Changes

  1. Add .dockerignore

    • Prevents unnecessary files (e.g., node_modules, .env, dist, .git, logs) from being copied into Docker images, resulting in smaller, faster builds.
  2. Refactor Frontend for Configurable Backend URL

    • All frontend API calls now use the VITE_API_URL environment variable instead of hardcoding localhost.
    • Docker Compose and Dockerfiles are set up to inject this variable at build/runtime.
  3. Remove COPY .env from Dockerfiles

    • Dockerfiles no longer copy .env files into images.
    • All secrets and configuration are injected at runtime via environment variables, following best practices.
  4. Pass Backend Environment Variables via Docker Compose

    • Backend receives JWT_SECRET and BACKEND_PORT via Compose, not baked into the image.
    • Example .env files provided for both frontend and backend.
  5. Persist SQLite Database with Docker Volume

    • Docker Compose mounts a named volume (sqlite-data) to persist the SQLite database, ensuring data is not lost on container restarts.
  6. Update README.md with Production Deployment Instructions

    • Added a comprehensive section on Docker Compose usage, environment variable management, data persistence, and customization.
    • Clarifies that .env is used by Compose for variable substitution and is not copied into images.

Closes #2

ports:
- "3000:3000"
environment:
- JWT_SECRET=${JWT_SECRET}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, we will add more environment variables, so we will need to use the .env file.

ports:
- "5173:80"
environment:
- VITE_API_URL=${VITE_API_URL}
Copy link
Contributor

Choose a reason for hiding this comment

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

In the future, we will add more environment variables, so we will need to use the .env file to pass the values

@@ -0,0 +1 @@
JWT_SECRET="YOUR_SECRET" No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

We need only a single .env file in the root, both for the frontend and the backend.

@@ -0,0 +1 @@
VITE_API_URL="http://localhost:3000" No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

We need only a single .env file in the root, both for the frontend and the backend.

// Generate the magic link (modify sendMagicLink to return the link)
// const magicLink = await this.authService.sendMagicLink(email);
const mockMode = process.env.MOCK_EMAIL_ENABLED === 'true';
const magicLink = await this.authService.sendMagicLink(email, mockMode);
Copy link
Contributor

Choose a reason for hiding this comment

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

sendMagicLink(email, mockMode) only accepts email as an argument You did not implement the sendmagicLink funtion

@g3Bg2
Copy link
Contributor

g3Bg2 commented Jul 21, 2025

@adarshdotdev

Are you testing this before raising the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployable Docker Compose setup

2 participants