A personal web project to practice React, GraphQL, Ruby on Rails, and good habits...
$ git clone https://github.com/ztratify/habits
(or similar) to clone the repo locally
$ cd habits
to open the project
$ bundle install
to download ruby gems
Errors? Make sure you install Ruby on Rails first...
ruby
'2.6.3'
rails
'6.0.3'
$ yarn install
to download node dependencies
$ rails db:create && rails db:migrate && rails db:seed
to build a local database and seed it with data
Errors? Make sure you install MySQL database first...
$ brew install [email protected]
and address any "Caveats" messages
$ brew services start [email protected]
to run mysql locally
$ rails s
to start the server and web app!
Finally visit http://localhost:3333 to start building habits!
Explore GraphQL Schema using graphiql interface: http://localhost:3333/graphiql
Habits & Steps with custom search, filtering and sort:
query habitsAndSteps {
habits (
order: CREATED
search: "WATER"
) {
id
title
goal
period
slug
steps (
order: DATE
startDate: "2021-11-11"
endDate: "2021-11-13"
) {
goal
progress
isComplete
}
}
}
Create Habit:
mutation createHabit {
createHabit(input:{
title: "💦 FILL WATER BOTTLE",
goal: 3,
period: "daily"
}) {
habit {
id
title
slug
createdAt
}
}
}
Update Habit:
mutation updateHabit {
updateHabit(input:{
id: 11,
title: "👨💻 15 MINUTES OF CODE",
goal: 3,
}) {
habit {
goal
title
period
slug
id
}
}
}
Delete Habit:
mutation deleteHabit {
deleteHabit(input:{
id: 11
}) {
habit {
id
slug
}
}
}
Create Habit Steps (progress):
mutation createSteps {
createSteps(input:{
habitId: 11,
date: "2021-11-11",
progress: 3,
}) {
step {
date
goal
progress
isComplete
habit {
title
goal
}
}
}
}
Update Habit Steps (record progress):
mutation updateSteps {
updateSteps(input:{
habitId: 11,
date: "2021-11-11",
progress: 1,
}) {
step {
date
goal
progress
isComplete
habit {
title
goal
}
}
}
}
This README would normally document whatever steps are necessary to get the application up and running.
Things you may want to cover:
-
Ruby version
-
System dependencies
-
Configuration
-
Database creation
-
Database initialization
-
How to run the test suite
-
Services (job queues, cache servers, search engines, etc.)
-
Deployment instructions
-
...