Giter Club home page Giter Club logo

water-schedule's Introduction


Logo

Hydration

A watering schedule for your plants.
Keeps track of when you need to water your plants based on provided schedules.
Uses a monthly calendar to easily keep tabs on when your babies need some hydration.

View Demo · Report Bug · Request Feature

About The Project

Desktop Mobile
Desktop screenshot Mobile screenshot

Built With

Typescript Static Badge
React Static Badge
Tailwind Css Static Badge
Express Static Badge
PostGreSQL Static Badge

How It's Made

I needed a simple way to track when to water my native plants since I kept forgetting, so I made this.

For the backend, I stuck with the trustworthy Express.
For my database, I went with PostGreSQL instead of MongoDB, since I thought a relational database would fit my needs better, and I wanted to learn SQL. Because of that, I just went with using raw SQL queries instead of abstracting it away via Object Relational Mapping I also implemented testing for the backend with a test database to ensure my queries and REST calls were doing the right thing.

For the frontend, I went with React againt to hone my skills.
As the need for global state management eventually came, I opted for Zustand instead of Redux w/ RTK. Much simpler to use. For data fetching and caching, I opted for Tanstack Query instead of RTK Query. They both seem to be similar in performance. While RTK seems a bit more flexible, Tanstack Query was much simpler to use and got the job done the same, so I will most likely use this for future projects. I also wanted to use navigable pages, so I added React Router for routing purposes. I used Firebase just for authorization purposes. I had already worked with auth in the past, and I would rather trust a competent library than waste time introducing security risks.

Due to the larger scope of the project, I drew inspiration from Bulletproof React for restructuring my frontend file structure. In essence, I broke down specific portions of the project into different features, where one could find all the relevant components, libs, utils, etc.

I also wanted to focus on creating a more streamlined deployment process, so I created a CI/CD pipeline using Github Actions. My pipeline tests, lints, and deploys either the client or the server based on detected changes. Tags are automatically created for easier bug tracking.

In essence, the client and server are two projects that can be run independently and are lumped together for ease of development.

Optimizations

Initially, I had formulated the API so that one POST request would mark one plant as watered. But when I added a feature to water all the plants on one day at the same time, I initially just made a loop working on each plant. So I was making many singular POST requests in succession... So I refactored the backend to accept an array of dates to add to the database, only now needing one request.

I refactored the code to remove extraneous usage of global state management. The usage of routing allowed me to move away from this reliance I had done in an earlier project. I narrowed it down to just communicating the calendar date to all other components and a toast notification whenever a query is completed.

The use of Tanstack Query, which includes caching, helps with saving data when the same data has been seen before.

In the future, I will move the static assets to a CDN for smaller bundle sizes.

Learning Outcomes

The Good The Bad The Ugly
Used a more organized file structure for easier navigation and scalability I should have designed the website from the beginning, designing while developing wastes time and leads to less coherent designs
Utilized routing for easier UX and DX Took a while to figure out user authorization and protected routes
Learnt to deploy the frontend and backend separately and to different providers
Created a CI/CD pipeline for easier deployment and lowering the possibility of bugs being pushed into prod
Tried out new technologies that lead to a better DX, making future projects more efficient and more enjoyable to work with
SQL is great, I will probably stick with relational databases from now on
It is very satisfying creating a project that I will use in my daily life

Getting Started

Prerequisites

  • pnpm

    npm install -g pnpm
    

Installation

  1. Clone the repo

    git clone https://github.com/CastillejaCode/water-schedule.git
    
  2. Install NPM packages

    pnpm --filter client --filter server install 
    
  3. Run local development server

    pnpm --filter client --filter server dev
    

    It's probably better to just open a terminal for each folder and pnpm dev to better compartmentalize the frontend and backend.

  4. Switch out my info for yours

    You'll want to add your own secrets for info such as the port, database urls, authorization urls connecting to Firebase.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Julian Krzysiak - [email protected]

Acknowledgments

(back to top)

water-schedule's People

Contributors

castillejacode avatar

Watchers

 avatar

water-schedule's Issues

Add demo

Demo account so users don't gotta login to check it out.

Standardize dates

I would prefer to have the dates be more standardized to easier work with them and for my testing. I will just create utility functions to work with dates and make the code more legible.

Add plant lists

It's a bit unwieldy if one has too many plants.
Categorizing them into expandable lists would help with locating the plants.

Change UX for plant dates

Instead of searching through the list of plants, it would be better to just simply click on a plant to mark it as watered.

Add editing

This would really just allow the user to edit the names

Create filter

If one has too many plants, it might be a bit too populated.
If one can use a filter to see only one or multiple plants, it should add to the user experience.

Create information card

Card will pop up when clicking on certain calendar date, showing info of the selected plants

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.