Skip to content

Simple web app for creating reminders that show you the weather forecast. Built with Ruby on Rails API, PostgreSQL, React create-react-app, Redux RTK and JWT for authentication. Deployed with Docker

License

Notifications You must be signed in to change notification settings

StarSheriff2/Weather-App-Calendar---backend

Repository files navigation

Weather App Calendar API


This RESTFUL API works as the backend for a React web app. I host the API on Render.com through a dockerized Ruby on Rails app. Authentication is handled with a JWT Token stored in the localStorage of the frontend.


app screenshot mobile app screenshot mobile app screenshot mobile app screenshot mobile

Table of Contents

About

Weather App Calendar API is the API handling the core requests of the Weather Calendar App. The frontend is a fully responsive react web app deployed here. The repo for the front-end is here. I built request tests for all endpoints, achieving a 97% test coverage. I also created tests for all models. I use JWT token to handle user authentication and authorization.

File Structure

app screenshot mobile
app screenshot mobile

Features

  • authenticate user
  • create new user
  • create new session
  • all CRUD operations for the Reminder resource

Front-end React app

  • The front-end associated with this app is here.

  • The Github repo of the front-end is here.

Live Demo

Render

Deployed to Render.com

Built With

  • Ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
  • Rails 6.1.4.4
  • PostgreSQL 14
  • Rspec (testing)
  • Faker gem
  • Factory bot
  • JWT
  • Docker 20.10.22
  • Docker compose v2.15.1

Setup and installation

To get a local copy up and running, follow these simple example steps.

Get files

  1. Open your terminal or command prompt.
  2. If you do not have git installed in your system, skip this step and go to step 3; otherwise, go to the directory where you want to copy the project files and clone it by copying this text into your command prompt/terminal:
  https://github.com/StarSheriff2/Weather-App-Calendar---backend.git

Now go to either the "Docker Deploy" or the "Local Deployt" section, depending on how you wish to deploy the API in your system.


  1. Download the program files by clicking on the green button that says β€œCode” on the upper right side of the project frame.
  2. You will see a dropdown menu. Click on β€œDownload ZIP.”
  3. Go to the directory where you downloaded the ZIP file and open it. Extract its contents to any directory you want in your system.

Docker Deploy

Prerequisites

  • Docker 20.10.22 or latest
  • Docker Compose v2.15.1

Run

  docker compose up -d

Local deploy

Prerequisites

  • Ruby 3.0.2p107
  • Rails 6.1.4.4
  • PostgreSQL 14

Install Dependencies

  1. If you are not in your system terminal/command prompt already, please open it and go to the directory where you cloned the remote repository or extracted the project files.
  2. While in the project root directory, type
    bundle install
    

This command will install all the necessary gems in your system.

Database Setup

  • Create an .env file copy and paste this into it:

    DATABASE_HOSTNAME=postgres
  • Run

    bin/rails db:setup

    This will create your local databases, load the schema, and initialize with the seed data.

    Note: If you get an error after running this command, it might be because you don't have a database called "postgres". This happens because when you create a new Rails application, Rails uses this "postgres" database to create and manage the databases for your application. You can easily create one by running this command:

    createdb postgres

    If Rails still complains about not finding the "postgres" role, you can create one with super-user priviledges:

    createuser -s postgres

    Now try running the db:setup command again!

You are all set now!

Usage

  1. In your terminal, run

    bin/rails server

    while inside the root directory of the repository files

    Note: This command will not stop on its own. To exit, hit "ctrl + c"

  2. The app allows API calls using curl or your favorite API client, such as Postman, HTTPPie or VS Code's Thunder Client. Here's a link to HTTPIE.

  3. Check status of the api by calling this endpoint /healthcheck

Development

Testing

  • Unit / Model tests
  • API request tests

To run all tests, type this into command line:

bundle exec rspec

Coverage report

test Coverage

Linters

To run Rubocop, go to the root directory of your repository and copy/paste the following command into your terminal:

rubocop .

Authors

πŸ‘€ Arturo Alvarez

🀝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

🀝 Acknowledgements

JWT Implementation:

Show your support

Give a ⭐️ if you like this project!

πŸ“ License

This project is MIT licensed.

About

Simple web app for creating reminders that show you the weather forecast. Built with Ruby on Rails API, PostgreSQL, React create-react-app, Redux RTK and JWT for authentication. Deployed with Docker

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages