- Overview
- Setup
- Installing SQLite3
- Installing Ruby
- Installing Rails
- Installing Bundler
- Installing Redis
- Installing node and npm* - Possible source of environment issues/confusion
- Installing yarn
- Starting the Application
This application is a proof of concept for a fictional company - Outdoor.sy. It enables users to:
- Upload customer data
- View a table of past customer data imports
- View a sortable table of customers.
Here's what a basic flow through the application looks like:
For this proof of concept, I focused on:
- Testing
- Code structure
- Delivering a full-stack solution
In the future, I'd like to add:
- JS unit testing
- JWT API authentication
- API pagination
- User authentication
Customers, like Ansel Adams, can have multiple vehicles:
Users receive feedback on how many customers were successfully and unsuccessfully imported:
In the database, the application stores this information on a row-by-row basis:
The application currently supports .txt or .csv files deliniated by commas or pipes and these fields:
- First name
- Last name
- Vehicle type
- Vehicle name
- Vehicle length
For examples, check out spec/fixtures
You will need an installation of the SQLite3 database. Many popular UNIX-like OSes ship with an acceptable version of SQLite3. Others can find installation instructions at the SQLite3 website.
Verify that it is correctly installed and in your load PATH:
$ sqlite3 --version
The program should report its version.
Open up a command line prompt. On macOS open Terminal.app; on Windows choose "Run" from your Start menu and type cmd.exe. Any commands prefaced with a dollar sign $ should be run in the command line. Verify that you have a current version of Ruby installed:
$ ruby --version
This application requires Ruby version 3.0.0 or later. It is preferred to use latest Ruby version. If the version number returned is less than that number (such as 2.3.7, or 1.8.7), you'll need to install a fresh copy of Ruby.
For installation methods for most Operating Systems take a look at ruby-lang.org
To install Rails, use the gem install command provided by RubyGems:
$ gem install rails
To verify that you have everything installed correctly, you should be able to run the following in a new terminal:
$ rails --version
If it says something like "Rails 7.0.0", you are ready to continue.
You will need to install bundler:
$ gem install bundler
And install all the dependencies:
$ bundle install
Follow the instructions here to ensure redis is installed
Follow the instructions here to install Node.js and npm.
I ran into issues using newer versions of Node with webpacker (see: stackoverflow question). For this application, ensure that you're using node v16.x.x.
$ node -v
v16.15.1
If you have nvm installed, you can leverage the .nvmrc
file and simply run:
$ nvm use
Follow the instructions here to ensure yarn is installed.
Next, install yarn dependencies:
$ yarn install
Run the migration with:
$ bin/rails db:migrate
Start the server with:
$ bin/rails server
Start redis with:
$ redis-server
Start sidekiq with:
$ bundle exec sidekiq
Lastly, to see the application in action, visit: http://127.0.0.1:3000/