Task and Purpose is a minimal task management application.
It consists of 3 modules: Api
, Web
, and Native
.
You will need to have ruby version 2.7.4 installed. I recommomend using rbenv or some other ruby version manager.
I've tested this application with node version v16.17.0. Other versions may work, but YMMV. I recommend using nvm or some other node version manager.
The api is a Rails application that exposes a GraphQL endpoint at http://localhost:3001/graphql
You can install the ruby dependencies via bundler with
cd api
bundle install
The database we're using is Sqlite. You can create and seed the database with
cd api
bundle exec rails db:setup
Task
is the only Active Record model in the project. It only has 2 notable fields name
and complete
. You can see the database schema at api/db/schema.rb
.
GraphQL is implemented with the graphql
gem. It is the only notable gem in the project, and you can find the documentation here.
Task
is the only type on the graph, and you can find the definition at api/app/graphql/types/task_type.rb
.
You can see the queries defined on the graph at api/app/graphql/types/query_type.rb
. The only query implemented is tasks
which just returns as list of all the tasks in the database.
There are three mutations implemented that you can find in api/app/graphql/mutations/
. These are create, update, and delete actions for the Task
model.
There is a Graphiql instance installed at http://localhost:3001/graphiql
.
Action Mailer is the Rails module that allows you to send emails from the backend. If you've used Rails before, you are likely familiar with Action Mailer. If you have not, fear not. You can get up to speed using this guide.
You will find an example of a mailer implementation at api/app/mailers/task_mailer.rb
and its corresponding view at api/app/view/task_mailer/example_email.html.erb
. Feel free to extend this mailer or create your own.
The development environment is configured to use Letter Opener and Letter Opener Web to simulate sending emails without connecting a real SMTP server. These libraries will allow you to see all the emails you've sent on a virtual inbox by visiting http://localhost:3001/letter_opener
.
If you'd like to test that out, open a Rails console with the following:
cd api
bundle exec rails c
Then fire off an email with:
TaskMailer.with(task_id: 1).example_email.deliver_now
You should be able to see your email at http://localhost:3001/letter_opener
.
You can start the application with
cd api
bundle exec rails server -p 3001
The web client is a standard React application created with Create React App.
There are a 2 notable libraries:
You can install the javascript dependencies via npm with
cd web
npm install
You can start the application with
cd web
npm start
The web client should be available at http://localhost:3000
The native client is a standard React Native application created with Create React Native App.
There are a 2 notable libraries:
You can install the javascript dependencies via npm with
cd web
npm install
You can start the application with
cd native
npm start
Follow the instructions on the screen to run the application in your prefered environment (iOS simulator, Android simulator, etc.).