Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mahammad-mostafa/topics-blog

This is the second project in the fifth module of the Microverse program. It is a web blog built using Ruby on Rails framework with PostgreSQL database.
https://github.com/mahammad-mostafa/topics-blog

cancancan devise gitflow-workflow html-css microverse microverse-projects microverse-ruby microverse-students mvc-architecture oop-principles postgresql rails relational-database responsive-layout rspec-rails rubocop ruby ruby-on-rails stylelint unit-tests

Last synced: about 1 month ago
JSON representation

This is the second project in the fifth module of the Microverse program. It is a web blog built using Ruby on Rails framework with PostgreSQL database.

Awesome Lists containing this project

README

        

# 🏷️ Topics Blog

This is the second project of the fifth module in the **Microverse** program.


Check the below contents for further details about this project.

# 📗 Contents

- [Description](#description)
- [Instructions](#instructions)
- [Authors](#authors)
- [Future](#future)
- [Contributions](#contributions)
- [Support](#support)
- [Acknowledgements](#acknowledgements)
- [License](#license)

# 📖 Description

This repository is about a user blog with posts & likes.
User authentication is required first.
Every post contains comments & likes.
Each user displays (`name` / `photo` / `bio`) & number of his `posts`.
Each post displays (`title` / `text`) & number of its `comments` & `likes`.
Pagination through posts using `kaminari` gem.
It is built using `Rails` framework with `Ruby`.
The project is configured to use `PostgreSQL` database.
Unit tests are carried on models & controller requests using `RSpec`.

📌 **Tech Stack:**
- Programming language is `Ruby`
- Database used is `PostgreSQL`
- Framework used is `Rails`
- Tests done with `RSpec`

📌 **Key Features:**
- Responsive layout to all screen sizes
- Four database tables (`users` / `posts` / `comments` / `likes`)
- One to many relation between `users` & `posts` tables
- Both `comments` & `likes` are bridge tables for many to many relation between `users` & `posts` tables
- Four model files (`User` / `Post` / `Comment` / `Like`)
- Method `recent_posts` allows fetching the last three post for any user
- Method `recent_comments` allows fetching the last five comments for any post
- Private method `counter` auto increments the number of (`posts` / `comments` / `likes`) for the relevant owner table
- Several attribute validation rules for `User` & `Post` models
- Attributes (`name` / `title` / `posts_counter` / `comments_counter` / `likes_counter`) are required
- Attribute `title` length must be smaller than or equal 250 characters
- Attributes (`posts_counter` / `comments_counter` / `likes_counter`) must be an integer and greate than or equal zero
- Unit tests for attribute validation rules and model methods
- Implemented request tests on (`index` / `show`) methods for controllers (`UsersController` / `PostsController`)
- Used `Capybara` gem to carry system tests on (`index` / `show`) action methods for controllers (`UsersController` / `PostsController`)
- Built authentication with `Devise` gem before accessing any controller

back to top

# 🛠️ Instructions

You can easily download or fork this repository and work on it immadiately!

📌 **Prerequisites:**
- You need `Ruby` language & `PostgreSQL` database installed

📌 **Installation:**
- To get all required gem dependencies run
```
bundle install
```
- Create all required databases & table schemas with
```
rails db:setup
```

📌 **Development:**
- Run live server using
```
rails server
```
- Manipulate & process models data through
```
rails console
```

📌 **Tests:**
- Run all unit test with
```
bundle exec rspec -f d
```

back to top

# 👥 Authors

📌 **Mahammad:**
- [GitHub](https://github.com/mahammad-mostafa)
- [Twitter](https://twitter.com/mahammad_mostfa)
- [LinkedIn](https://linkedin.com/in/mahammad-mostafa)

📌 **Zabihullah:**
- [GitHub](https://github.com/ZabihullahNooriWardak)

back to top

# 🔭 Future

Some additional features I may implement in the project:
- [ ] Integrate `React` framework in frontend
- [ ] Implement (dark / light) theme switch

back to top

# 🤝🏻 Contributions

Wish to contribute to this project?


Contributions, issues, and feature requests are more than welcome!


Feel free to check the [issues](../../issues) page too.

back to top

# ⭐️ Support

Like this project? Show your support by starring!

back to top

# 🙏🏻 Acknowledgements

I thank everyone at **Microverse** for guiding me through this project.

back to top

# 📝 License

This project is [MIT](LICENSE.md) licensed.

back to top