GithubHelp home page GithubHelp logo

yenhub / web-app-in-a-box Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 730 KB

A dockerized boilerplate for React with an Express backend using MySQL

License: GNU General Public License v3.0

JavaScript 75.37% CSS 3.87% Pug 1.29% HTML 3.42% Shell 16.04%

web-app-in-a-box's Introduction

web-app-in-a-box

Author React Version ExpressJS Version Beer Money

Last Commit Open Issues Progress Project Status Repo Size

What is it?

This is essentially a Web App in a box, front and back end, built with the magic of Docker 🐳

We have an ExpressJS Web API, using MySQL for it's data store.

demo

See a Live Demo of the Test API Here!

The front end is React based and there is also a pre-configured phpMyAdmin instance to compliment the setup, all running in an isolated environment in the root of the project!

What does it do?

Whatever you want it to do really, the idea is, it's a simple, easy and fast full stack javascript web app in a box, front end, back end and DB included!

No mucking around! πŸŽ‰

TOC

TLDR;

  1. git clone [email protected]:YenHub/web-app-in-a-box.git
  2. Create your .env config (how do)
  3. docker-compose up --build -d && chrome http://localhost/TestAPI

Quick Start Usage

Create a .env config

Create a file at ./api/.env and populate the contents like so, setting a password of your choosing:-

This file is .gitignored

DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=some_wi1d-pa$$word
DB_DATABASE=nodeDB
DB_HOST=react-express-mysql

Run the solution using Docker 🐳

Run this solution using Docker, WSL2 and your distro of preference.

# Start the solution (-d for detached mode)
docker-compose up

# Stop the solution (Ctrl+C)
docker-compose down

What now?

The api is hosted on port 9000, the front end on port 80

This can be customized via env variables, but those are the defaults.

Once you have the solution up and running, simply visit http://localhost/TestAPI to check it's working correctly, and begin developing the API and Front End.

Development Info

Running FE standalone

The React front end is happy to run standalone from it's root ./client.

# From the root of ./client
npm start

NOTE: The project will be available at http://localhost:3000/ when running standalone

Running API standalone

UPDATE: Following the latest updates, you can now work on the API standalone

# From the root of the project
docker-compose up node-sql

# From the root of ./api
npm run dev

You can now access the API on http://localhost:9000

Running the front or back end standalone:

# Start Front End Dev Server Only
cd client && npm start

# Start Back End Dev Server Only
cd api && npm run dev

Docker: Running the full solution

# Ensure you have docker installed & running
# It's recommended to use WSL2 with Ubuntu LTS

# Run the solution
docker-compose up

# Launch docker container (-d: detached)
docker-compose up -d

# Kill the solution
docker-compose down

# Build the containers
docker-compose build

# Recreate the solution & run
docker-compose up --build --force-recreate

# We can then also do (due to docker-componse `container_name: node-mysql`)
docker start react-express-mysql

# Exec commands in the container:
docker exec -it [container_name] mysql -uroot -p

Backing up your database

The database is defined in ./docker-compose.yml

The MySQL instance is volume bound to: ./docker-volumes and is also in .gitignore

Project To Dos & Dones

FAQs

Localhost keeps redirecting to https://

This can be annoying, simply visit chrome://net-internals#hsts and delete "localhost" by entering it into the delete field at the bottom

web-app-in-a-box's People

Contributors

dependabot[bot] avatar yenhub avatar

Stargazers

 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.