This is React project starter. Its goal is to offer a simple way to start a new front-end application. It offers:
- Components
- Pages
- Models
- GraphQL
- Environment specific configurations
- Docker development environment
- Tests
We recommend running this project using Docker and Docker Compose.
But if you want to run it by yourself you'll need to have Node.js installed.
- Clone the project.
- Copy the
.env.example
file into an.env
file with your ENV variables. - Run the docker container with
sh bin/docker/start.sh
. - Go to your browser and access
http://localhost:3000
.
Inside the bin
folder you'll find a set of helpful scripts that you can use to speedup the development setup.
bin/docker/dev.sh
: Runs the Docker Compose container and creates a bash session.bin/docker/start.sh
: Runs the Docker Compose container and after starts the app.
You can run any shell script with:
sh <script>
The project comes with multiple package.json
scripts created to run useful commands.
start
: Runs the app in the development mode.build
: Builds the app for production to thebuild
folder (More info).docker:build
: Builds the Docker Container.docker:dev
: Starts the Docker Container and creates a bash session.docker:start
: Starts the Docker Container and runs the app.docker:stop
: Stops the Docker container.lint
: Runs the eslint toollint:fix
: Runs the eslint tool and fix possible offenses.prettier:format
: Properly formats all our code.test
: Runs all teststest:watch
: Launches the test runner in the interactive watch mode.
You can run any NPM script with:
npm <script>
For continuous integration we have opted to use Azure Pipelines, the reason for it is that we are going to use all azure services and the integration is very smooth.
Azure Pipelines is a integration provided directly into Github that creates a CI/CD environment for Builds/Releases in each case. It provides a easy and friendly UI to crete builds, track their progress, issues and understand what is being released. After installing Azure Pipelines on the repository we are going to be redirected to a Azure DevOps portal, this will be where we are going to manage everything for that user.
Even though configurations can be done using the UI provided by Azure DevOps, we opt to use yml files like test-pipeline.yml
or build-pipeline.yml
.
The reasoning is to track the configuration and easily migrate to any other repository or project.
Also we can provide different configurations for different providers and the base project will be capable of be deployed to any of the available providers.
When creating a new build, we can import settings from a yml file, use the test-pipeline.yml
as the config file and will import use those tasks to provide the build steps.
For the test steps we have provided a basic node js testing flow. The app project will be build using nodejs (currently docker test are not supported) and validate that the build is working as expected. Then will validate tests and lint. In the case of environment variables, for security reasons, it should be stored on the Azure DevOps portal to avoid having those variables in plain text on the repository.