Code Monkey home page Code Monkey logo

dockerized-spring-react-mysql's Introduction

Dockerized Spring React MySQL App

Basic Full Stack App with Spring Boot, React, and MySQL, all running in Docker containers.

The goal of this project is to demonstrate how Docker can be used to run a full stack application, helping to avoid the "works on my computer" problem, and also to make it easier to test a full stack application without having to install all the dependencies or complex configurations.

Do you speak Español?: 👉 Léeme

Description

The app is a simple full stack application that saves a user's name and email address to a MySQL database.The backend is a Spring Boot application that exposes a REST API. The frontend is a React application that uses the backend API to save and retrieve data from the database.

Technologies Used

How to use for production or testing purposes

You need to have installed Docker, the most easy way to install it is using the Docker Desktop application.

  1. Clone this repository and enter the folder
git clone [email protected]:jhordyess/dockerized-spring-react-mysql.git
  1. Create a .env file in the root folder by copying the example from the .env.example file.

  2. Then, run the following command:

make

# If you don't have 'make' installed, use:
docker compose up -d
  1. After that, open the browser and visit http://localhost/.

  2. To remove the containers, use the following commands:

make clean

# If you don't have 'make' installed, use:
docker compose down

Take note that this production configuration is just for testing purposes, and maybe need some changes to be used in a real production environment.

How to use in development

You can use the VSCode dev containers to run the project in a containerized environment.

You need to have installed Docker and VSCode, and the Dev Containers extension.

  1. Clone this repository
git clone [email protected]:jhordyess/dockerized-spring-react-mysql.git
  1. Open the project in VSCode
code dockerized-spring-react-mysql
  1. Create a .env file in the root folder by copying the example from the .env.example file.

  2. Open the integrated terminal (Ctrl+Shift+`) and run the following command:

docker compose -f docker-compose.dev.yml up -d
  1. Open the command palette (Ctrl+Shift+P) and select the option Dev Containers: Open folder in Container.

  2. Select the folder backend and wait for the container to be built.

  3. Open the integrated terminal (Ctrl+Shift+`) and run the following command:

mvn spring-boot:run
  1. For the frontend, open the command palette (Ctrl+Shift+P) and select the option Dev Containers: Open folder in Container.

  2. Select the folder frontend and wait for the container to be built.

  3. Open the integrated terminal (Ctrl+Shift+`) and run the following command:

npm run dev
  1. Open the browser and visit http://localhost:5173/

  2. Also you can visit http://localhost:81/ to manage the database with phpMyAdmin.

To-Do

  • Add CSS styles to the frontend

Contribution

If you would like to contribute to the project, open an issue or make a pull request on the repository.

License

© 2023 Jhordyess. Under the MIT license. See the LICENSE file for more details.


Made with 💪 by Jhordyess

dockerized-spring-react-mysql's People

Contributors

jhordyess avatar

Stargazers

PhamTheHien avatar tim747 avatar Joshua Frías avatar

Watchers

 avatar

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.