Giter Site home page Giter Site logo

hardevkhandhar / dockerized-fullstack-application Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 5 KB

A modern full-stack application template showcasing containerization with Docker, featuring Node.js, Express.js, and MongoDB for building and deploying scalable web applications.

Dockerfile 2.00% JavaScript 33.11% EJS 64.88%
container-orchestration containerization docker docker-compose expressjs full-stack-application javascript mongoose nodejs

dockerized-fullstack-application's Introduction

Dockerized Fullstack Application

Overview

This repository hosts a Dockerized Full-Stack Application built with Node.js, Express, and MongoDB. The project aims to provide a convenient development environment encapsulated within Docker containers. It simplifies the setup and running of a local version of your application.

Why Use Docker?

Benefits of Docker

  • Isolation: Docker containers encapsulate your application and its dependencies, ensuring consistency and preventing conflicts between development and production environments.

  • Portability: Docker containers can run on various platforms without modification, making it easy to move applications between different environments.

  • Efficiency: Docker containers are lightweight and start quickly, reducing resource overhead and speeding up development and deployment processes.

  • Scalability: Docker facilitates the scaling of applications by creating multiple containers from a single image, making it suitable for both small projects and large-scale applications.

  • Dependency Management: Docker enables you to define dependencies and configurations within a Dockerfile, ensuring that your application runs consistently across different environments.

Key Features

  • Full-Stack Application: This project demonstrates the development of a full-stack web application, including the backend (Node.js) and frontend (EJS templates).

  • Database Integration: MongoDB is used as the database to store application data, and it is containerized using Docker for easy setup.

  • Docker Compose: Docker Compose simplifies multi-container Docker application orchestration, making it effortless to manage both the application and database containers together.

Directory Structure

.
├── app
│   ├── Dockerfile
│   ├── index.js
│   ├── models
│   │   └── Item.js
│   ├── node_modules
│   ├── package.json
│   └── views
│       └── index.ejs
├── docker-compose.yml
└── README.md

Key Directories and Files

  • app/: Contains the Node.js application code.

    • Dockerfile: Defines the Docker image for the Node.js application.
    • index.js: Main application file.
    • models/: Houses application data models.
    • node_modules/: Holds Node.js dependencies.
    • package.json: Specifies Node.js application configuration.
    • views/: Stores application views.
  • docker-compose.yml: Specifies Docker services and their interactions.

  • README.md: The file you are currently reading.

Note: The node_modules directory is intentionally not included in the repository. It is generated locally when you install project dependencies using npm install. This omission keeps the repository size smaller and avoids adding a large number of third-party library files to version control. The package.json file specifies the project's dependencies, giving you a general idea of what the node_modules directory will contain and where to find it.

Docker Compose Configuration

The docker-compose.yml file defines two Docker services:

1. app

  • Dockerizes the Node.js application.
  • Exposes port 3000 for accessing the application.
  • Links to the mongo service for database connectivity.
  • Mounts the application code and node_modules for development.

2. mongo

  • Utilizes the official MongoDB Docker image.
  • Exposes port 27017 for MongoDB access.

Getting Started

To set up and run the Dockerized Full-Stack Application:

  1. Ensure Docker and Docker Compose are installed on your system.
  2. Clone this repository to your local machine.
  3. Navigate to the project directory.
    cd dockerized-fullstack-application
  4. Build and start the application using Docker Compose.
    docker-compose up --build
  5. Access the application in your web browser at http://localhost:3000.
  6. To shut down the application and clean up Docker resources when you're done:
  • Press Ctrl+C in the terminal where Docker Compose is running to stop the containers.
  • To remove the stopped containers, networks, and volumes associated with this project, run:
    docker-compose down
  • Additionally, you can remove any unused Docker resources (e.g., dangling images, containers, and networks) by running:
    docker system prune -a
  • These commands will help you gracefully shut down the application and free up any unused Docker resources.

Dependencies

The project relies on the following key dependencies:

  • Express: Web framework for Node.js.
  • Mongoose: MongoDB object modeling tool.
  • EJS: Embedded JavaScript templates.
  • Body Parser: Middleware for parsing HTTP request bodies.

Thank you!

dockerized-fullstack-application's People

Contributors

hardevkhandhar avatar

Watchers

 avatar

Forkers

anup-2023 k-vamc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.