Giter VIP home page Giter VIP logo

market-access-frontend's Introduction

Market Access Frontend

The frontend component of the Market Access project. This is a Node.js project with Express using Nunjucks templates.

It uses as many GOVUK Frontend components as possible (also Nunjucks).

The CSS is produced with SASS to enable re-use of the GOVUK Frontend styles for many of the layout and colours etc.

This project relies on the Market Access API project to function, so you will need to either have Python installed and run it locally or use Docker to run the images.

Once you have the API running you are ready to start the app.

Getting started

First you need to install the dependencies:

npm install

This project has a dependency of Redis which you can download to run locally or run via docker:

docker run --name redis -d -p 6379:6379 redis

The app is controlled with environment variables so you will also need some set. There is a .env.template file which can be used to create a .env file. You can use something like direnv to read the .env file and automatically apply the env vars when you change into the directory. Alternativly you can make the .env file and then apply the changes locally:

source .env

The user authentication is handled by the DIT SSO where a token is stored and used for authorization of user end points. There are some machine to machine APIs that are called on the backend and we use Hawk to secure those calls. In dev mode you can turn off Hawk and bypass the SSO using the .env settings

You can also run a mock-sso client to run the app near a produciton mode without the hastle of logging in. Again configure your .env file accordingly.

Now you are ready to start the app...

Starting up...

There are two ways to start the app: dev mode or prod mode.

Dev mode

In dev mode the files will be watched for changes and either Node.js will be restarted when .js files are changed or SASS will be re-compiled to CSS when .scss are changed.

To run dev mode:

npm run watch

Prod mode

In prod mode all the app files are copied to the /dist folder and the client JS, CSS and images are revved. When running the templates are cached and an expires header is set to 2 years for the static assets. The JS and CSS are bundled and minified before being revved. The npm dependencies are also installed using the -- production flag.

To start the app in prod mode:

npm run dist

This will run the prod build tasks and then start the app.

Making a release

  1. Checkout the develop branch. git checkout develop
  2. Run npm version to see the current version and decide what the new verison number should be - a major, minor or patch bump
  3. Create a new branch with the new release number, for example, git checkout -b release-v3.2.1
  4. Depending on what you decide the next version numer will be, run one of these: Make sure you have a local instance of REDIS or the tests will fail
  • npm version major
  • npm version minor
  • npm version patch
  1. Now the package.json version should match the branch name, the commit will have been made to git, a tag created and it will have attempted to push to github If you see an error in the console do not run the npm version command again. The error is simply because the remote branch does not exist, just copy the command from the error which will do the push to github and setup the remote
  2. Create a PR in github with the new branch and wait for the checks to pass
  3. Once the checks have all passed then you can either merge to master or release to an environment to test and then merge to master
  4. Once it has been merged to master you can start deploying to staging and then production
  5. Whilst the deployments are happening, run git checkout master and then git pull to get the latest
  6. Run npm run tag-master which will create a tag of latest commit to master and push the tag to the remote
  7. Merge master to develop and push to the remote (will require you to have permissions to do this) git checkout develop git merge master git push

The relese is now done.

market-access-frontend's People

Contributors

cwaszczuk-dit avatar ejayesh avatar markhigham avatar munhitsu avatar web-bert 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.