A basic user management application built with Ember and Rails JSON API. This app was built as an employment test for a Fullstack Software Engineer role at a company that used Ember and Rails.
- What is Tenacity?
- Demo
- Additional Info for Pavel
- Dev Environment Setup
- Running the application locally
- Tests
Tenacity is a basic user management application built with Ember and Rails JSON API.
Tenacity uses the following libraries to provide secure authentication:
The Ember front-end app communicates with the Rails API via JWT tokens.
Rails API routes are formatted to adhere to the JSON:API spec.
Tenacity application users are split into two roles:
Ability | Standard User | Admin User |
---|---|---|
Edit own profile | x | x |
Change own password | x | x |
View list of all users | x | |
Edit any user's profile | x |
Tenacity is built with "production quality" in mind:
- Comprehensive test suite for both frontend and backend code
- Attention to user experience (e.g. animated loading states, client side error handling, list pagination, long text truncated on table cells)
- Optimised SQL payloads (e.g. SELECT statements limited to columns used in app, indexes on columns appearing in ORDER BY)
- Uses popular, strong, maintained security libraries (devise, cancancan, rolify) for authentication
- Code written using best practices & SOLID principles (e.g. Service Object pattern in backend code via Rectify gem)
- Comprehensive README.md to allow other developers to get setup & contribute fast
- Manual user acceptance testing conducted locally before release & after prod deployment
Here is a working live demo: https://infinite-garden-57955.herokuapp.com/
Please note that the demo is hosted on a free Heroku dyno so may not be booted the first time you access it (free Heroku web dyno's automatically sleep after 30 minutes if they have not received web traffic). Please allow up to 2 minutes after navigating to the demo for the app to boot.
The following two accounts can be used to test the app on Heroku:
Role | Email address | Password |
---|---|---|
Admin user | admin@user.com | testing123$ |
Standard user | standard@user.com | testing123$ |
Note: I have created some issues in the Issues section of this repo that I did not have the time to look at / would be nice to haves in the future.
In a terminal navigate to the root directory and run the following command:
bundle install
Create a blank /config/application.yml
file and add the following settings (replacing all setting values wrapped in <>
with the settings relevant to your machine):
DB_USER_DEV: <postgresql user name>
DB_PWD_DEV: <postgresql password>
DB_USER_TEST: <postgresql user name>
DB_PWD_TEST: <postgresql password>
EMBER_FRONTEND_PATH: /frontend
In a terminal, create a new secret key that will be used by the devise-jwt gem to encrypt tokens by running the following command:
rake secret
# this command will generate a long hash
Copy the hash into a new line at the bottom of the application.yml
file:
DEVISE_JWT_SECRET_KEY: <copy hash from rake secret here>
In a terminal navigate to the root directory and run the following command:
bundle exec rake db:create db:migrate
In a terminal navigate to the root directory and run the following command:
bundle exec rake db:seed
This will seed the database with 52 test users. The following two users can be used to test the two roles:
Role | Email address | Password |
---|---|---|
Admin user | admin@user.com | testing123$ |
Standard user | standard@user.com | testing123$ |
In a terminal navigate to the /frontend/
folder and run the following command:
npm install
Create a blank /frontend/.env
file and add the following settings:
TENACITY_API_FULL_URL=http://localhost:3000/api/v1
TENACITY_API_HOST=localhost
After following the steps above in Dev Environment Setup, open a terminal at the root directory and run the following command:
/bin/rails server
NB: You do not need to separately run ember s
in a separate terminal as the gem ember-cli-rails concatenates Rails & Ember into a single process.
In the root directory, run the following command:
rake tests
In the /frontend
directory, run the following command:
ember test
Here is a Google Sheet containing a list of Manual User Acceptance Test Cases