The Track It project is a complete habit tracking application. With it, you can create and track your daily, weekly, and monthly habits. Track It lets you record your habits and monitor your progress quickly and easily. It offers an intuitive and easy-to-use interface that allows you to add and delete habits with just a few clicks. The app also offers a number of features like notifications and a rewards system to keep you motivated and on track. See below how to run the application and check the link to access it online.
Track It was created to help people track their habits and reach their goals. It was developed with the following features:
- Login Screen: allows the user to log in to the application and be redirected to the daily monitoring screen
- Registration screen: allows the user to create a new account in the application
- Habits Screen: allows the user to view their habits and create new habits
- Today Screen: Allows the user to track their daily habits and see their progress
Track It was developed with the aim of helping people achieve their goals and improve their lives. The motivation behind this project was to provide a simple and easy-to-use tool that would help people stick to their habits and reach their goals more efficiently.
React was chosen as the core technology because it offers a number of resources and libraries that facilitate the development of user interfaces. Axios was used to make the HTTP calls to the project's API and Styled Components was used to style the application's components.
To run the application, follow these steps:
- Clone the repository using the following command: git clone https://github.com/natividadesusana/trackit.git
- Navigate to the project folder: cd trackit
- Install project dependencies: npm install
- Run the application: npm start
- Access the application in your browser at: http://localhost:3000
-
Sign up
To register, make a
POST
request to the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/auth/sign-up
sending a body in the format
{ email: "...", name: "...", image: "...", password: "..." }
-
Login
To register, make a
POST
request to the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/auth/login
sending a body in the format
{ email: "...", password: "..." }
The server will respond with an object of the form
{ "id": 3, "name": "Joe", "image": "https://http.cat/411.jpg", "email": "joe@respondeai.com.br", "password": "123456", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaWF0IjoxNjIxMjg0NzExfQ.b8e3bYm7TnU5p6pfrCPPbzboax6gvh_gGNFR4T51FxY" }
-
Create habit
To create a habit, make a
POST
request to the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits
sending a body in the format
{ name: "Habit name", days: [1, 3, 5] // Monday, Wednesday and Friday }
and an
Authorization
header withBearer TOKEN
formatThe server will respond with an object of the form
{ id: 1, name: "Habit name", days: [1, 3, 5] }
-
list habits
To list user habits, make a
GET
request to the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits
with an
Authorization
header withBearer TOKEN
formatThe server will respond with an array of the form
[ { id: 1, name: "Habit name", days: [1, 3, 5] }, { id: 2, name: "Habit 2 name", days: [1, 3, 4, 6] } ]
-
Delete habit
To delete a user habit, make a
DELETE
request to the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits/ID_DO_HABITO
with an
Authorization
header withBearer TOKEN
format, replacingHABIT_ID
in the URL with the id of the habit to be deleted.Tip: research how to send a
DELETE
request with axios -
Search for today's habits
To list user habits, make a
GET
request for the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits/today
with an
Authorization
header withBearer TOKEN
formatThe server will respond with an array of the form
[ { "id": 3, "name": "Wake", "done": true, "currentSequence": 1, "highestSequence": 1 } ]
-
Mark habit as done
To list the user's habits, make a
POST
request, with an empty body, for the URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits/ID_DO_HABITO/check
with an
Authorization
header withBearer TOKEN
format, replacingHABIT_ID
in the URL with the id of the habit to be tagged.If:
- The habit is already checked
- The habit is not current day
- The habit is not of the logged in user
the server will respond with
Bad Request (400)
. -
Desmarcar hábito como feito
Para fazer listar os hábitos do usuário, faça uma requisição
POST
, com o body vazio, para a URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits/ID_DO_HABITO/uncheck
com um cabeçalho
Authorization
com formatoBearer TOKEN
, substituindoID_DO_HABITO
na URL pelo id do hábito a ser marcado.Se:
- O hábito não estiver marcado
- O hábito não for do dia atual
- O hábito não for do usuário logado
o servidor vai responder com
Bad Request (400)
. -
Histórico de hábitos diário
Para obter o histórico de hábitos diário do usuário, faça uma requisição
GET
para a URLhttps://mock-api.bootcamp.respondeai.com.br/api/v2/trackit/habits/history/daily
com um cabeçalho
Authorization
com formatoBearer TOKEN
O servidor responderá com um array no formato
[ { "day": "20/05/2021", "habits": [ { "id": 3, "name": "Acordar", "date": "2021-05-20T12:00:00.000Z", "weekDay": 4, "historyId": null, "done": false } ] }, { "day": "19/05/2021", "habits": [ { "id": 3, "name": "Acordar", "date": "2021-05-19T12:00:00.000Z", "weekDay": 3, "historyId": 626, "done": true }, { "id": 1, "name": "Ler 1 capítulo do livro", "date": "2021-05-19T12:00:00.000Z", "weekDay": 3, "historyId": 625, "done": true } ] }, { "day": "18/05/2021", "habits": [ { "id": 3, "name": "Acordar", "date": "2021-05-18T12:00:00.000Z", "weekDay": 2, "historyId": 7, "done": true } ] }, { "day": "17/05/2021", "habits": [ { "id": 1, "name": "Ler 1 capítulo do livro", "date": "2021-05-17T12:00:00.000Z", "weekDay": 1, "historyId": 1, "done": true } ] }, { "day": "16/05/2021", "habits": [ { "id": 1, "name": "Ler 1 capítulo do livro", "date": "2021-05-16T12:00:00.000Z", "weekDay": 0, "historyId": null, "done": false } ] }, { "day": "14/05/2021", "habits": [ { "id": 1, "name": "Ler 1 capítulo do livro", "date": "2021-05-14T12:00:00.000Z", "weekDay": 5, "historyId": null, "done": false } ] } ]