Skip to content

Conversation

@amanvatss
Copy link

@amanvatss amanvatss commented Oct 2, 2025

Hi @JoeCelaster, this PR adds full Docker support for the MERN template, allowing developers to get the entire application running with a single command.


Before This PR

To run the project, a developer had to:

  1. Manually install Node.js on their machine.
  2. Manually install and run a MongoDB database.
  3. Open a terminal to install dependencies and run the backend server.
  4. Open a second terminal to install dependencies and run the frontend client.

After This PR (Proof of Work)

With these changes, a developer only needs to have Docker installed and run one command: docker-compose up.

This automatically builds, installs, and runs the frontend, backend, and database in a containerized environment.

Here is a screenshot of the final result, showing the application running successfully in the browser:

image

Files Added

  • templates/mern/javascript/server/Dockerfile: A recipe to containerize the backend server.
  • templates/mern/javascript/client/Dockerfile: A recipe to containerize the frontend client.
  • templates/mern/javascript/docker-compose.yml: An orchestration file to manage and connect the client, server, and database containers.
  • templates/mern/javascript/client/package.json: Updated the dev script to vite --host to allow external connections.

This feature significantly improves the developer experience and aligns with the project's goal of faster setups.

Closes #103

@Abdulk077
Copy link

Abdulk077 commented Oct 3, 2025

i think we need a little improvement here you mention both server and client in same image i think best practice should be creating image for server and client separate is better

@amanvatss
Copy link
Author

Hi @Abdulk077, thanks for the feedback! You are absolutely right that separate images for the server and client is the best practice.

That is the approach I have taken in this pull request. If you look at the files, you'll see:

  • templates/mern/javascript/server/Dockerfile builds the image for the backend.
  • templates/mern/javascript/client/Dockerfile builds the image for the frontend.
  • templates/mern/javascript/docker-compose.yml then starts these two separate services (client and server) along with the database.

I believe this follows the best practice you mentioned. Please let me know if you see anything I could improve in the implementation. Thanks!

@Abdulk077
Copy link

one thing you should add the a non-root user for better security for an frontend app , one thing in production uses separate compose file for scaling purpose that's what all I said .

@Abdulk077
Copy link

Abdulk077 commented Oct 3, 2025

Give me an opportunity for dockerise
Another mern app of this template for dev , then for production level later.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add Docker support for generated projects

3 participants