Postcode Checker is a simple web app to help people find out if their postcode is in a support service area.
Test a staging version of the app online
Or
Visit https://service-area-check.herokuapp.com/admin to manage service areas and postcodes.
- Ruby - You will need at least version: 2.7.2, we use RVM to manage different versions of Ruby.
- Postgres - We use Postgres for our database, install it locally on Mac OSX with Homebrew. Once installed you can run
brew services start postgresql
.
The project uses environment variables to manage configuration variables and secrets like API keys. Using the environment for configuration is a feature of 12 Factor Apps.
In development we use dotenv to manage environment variables on a per project basis.
- Create a file in the root of your project with the filename
.env
- There is a
.env.template
file in the root of the project that has all of the keys needed for the application to run locally. - Copy these keys into your
.env
file and set them on your machine.
As it is not an application secret
POSTCODE_VALIDATION_SERVICE_URI=postcodes.io
Note: Ordinarily I would store secrets like database credentials in the environment. However to make it easier to get started I have left these configuration values hard coded.
- Git clone the repo to your local machine
- Change into the directory with
cd postcode_checker
bundle install
to install ruby dependencies.yarn install
to install frontend depenencies.rails db:create db:migrate db:seed
builds the database, runs initial migrations and seeds the database- To run the app use a process manager like hivemind to run the app locally from the development Procfile
hivemind Procfile.dev
. This mirrors how the app will run in production on Heroku.
Note: If you don't have Hivemind installed you can alternatively run
rails s
to run the rails server.
This project uses brakeman to detect potential security vulnerabilities. Run brakeman
in the root of the project to do a security scan.
We use rspec for automated tests. Run the test suite with bundle exec rspec
from the project root.
Write and find the documentation in the docs
directory.
This project uses Architectural Decision Records to document technical decisions.
Read the technical decisions
The project uses rubocop to maintain code style and format consistency. It uses the following rubocop extensions:
Run
rubocop
from the project root to lint the code