GithubHelp home page GithubHelp logo

coderkoala / crap-news Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9.19 MB

A rudimentary, hacky, opensource news app for Laravel. Autopulls news from popular RSS feeds. Will most certainly blow up whilst using at random. You have been warned.

PHP 84.33% Vue 0.03% HTML 10.15% CSS 5.48%

crap-news's Introduction

Crap News Boilerplate

CrapNewsApp

A Laravel powered News website based on Colorlib's MagNews Theme. The features it currently ships with are:

  • Automated API full/fetch of News from NewsAPI Org's Endpoint
  • Filter by Country/Source
  • Allow Login/Registration of Users
  • Users can rate existing news
  • Commands for easy fetching and updating existing sources
  • Export generates unique slugs based on news attributes (Author Name, Title among other things)
  • Purely templatized and scalable.
  • Smart Asset Management via npm/webpack

Demo Credentials

User: [email protected] (Super Admin) OR: [email protected] (Normal User) Password: secret

Official Documentation

Follow the official Laravel installation guide. Please follow the project specific documentation below. If you're confused at tackling it, please visit laravel boilerplate documentation site.

Setup Guide

Follow Laravel's official setup guides, after that, it's pretty easy to get started. You may either utilize the SQL dump I've created of the API pulls I did for a few days, or use the artisan commands I've integrated into the app for easy population/seeding.

Steps

Setup NewsAPI Org's API Secret key. Paste it onto the right param under your environment file.

php artisan fetch sources
php artisan fetch news

And you're done. You should get anywhere from 1k -2k news and should be able to begin playing around with the app.

Introduction

This is a hacky news portal website with I intend to reuse sometime later in my life. All of the assets I took were under Creative Common License. The theme is, Colorlib's MagNews Theme. The boilerplate I used for this project is Laravel Boilerplate.

Issues

It is riddled with issues. I'd not even dream of deploying it to a website, esp with no cron (oh gawd the nightmares. Fun fact: Did you know I managed bringing down my personal server when trying to test cron too rapidly? Yeah, don't do it.) If you have any queries or bugs to point out, feel free to lodge them in issues, and I'd be more than happy to fix it.

Where does it go from here?

This project is nowhere near what my vision has in store for it. So expect sporadical updates, and a lot of experimentatons. I was to ship the initial Release Candidate with CRON, but it caused issues, so expect the first few updates geared towards cron.

Development Roadmap:
  • Migration to Laravel 7.0
  • Themeing package (I'm working on it separately, private for now) on blade fires to switch themes with minimal template touching.
  • Database Query Optimizations, especially on front page (yikes).
  • Normalizing the DB tables, building relationships between related tables (2NF+).
  • Optimizing code. A lot of lazy programming is involved.
  • Refactoring Controller to organized classes.
  • Introducing API Controllers, introducing Passport.
  • Backend Dashboard for popular news, and recent likes ( someone help me :O )
  • Deprecation of Fetch News API Class in favor of an RSS feed crawling API. Generalizing the procedure so the code can be reused for any REST API calls.

More will be added as I discover the limitations of my current approach to a news portal architecture. But like I reiterate many times, expect infrequent, but large (possibly breaking) changes.

License

MIT

Copyright © 2020 Nobel Dahal

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

crap-news's People

Contributors

coderkoala avatar

Watchers

 avatar

crap-news's Issues

Performance : SQL optimization.

The optimization is horrendous right now for the front page.

First, it pick up categories from the sources tree, then via relationships, fetches an arbitrary number of queries per category. The number of transaction, as one might be aware, increases the number of categories goes up.

A quick napkin math suggests me 36+ queries just to get the front page news. As of right now, there are 80+ queries running in the front page. That is alone alarming, and this is deteriorate the bigger the articles table gets.

My approach: get rid of the relationship, and introduce the category column in the articles table as well. Migration script has to be written, but in the end, you could potentially, in the best case scenario, need a single query with maybe a union or two (to make sure to filter 15-20 latest news of the same category) in order to achieve this.

Roadmap

  • Rework relationship to only allow for mass assignment during cron/seeding.
  • Migration table for articles to introduce category FK.
  • Normalize the sources table, and introduce category as a FK instead of a string.
  • Relation now involves category as the independent key, with category_id in articles and sources as dependent tables.
  • Rewrite the artisan command and the SourceSeeder class to reflect the respective changes.

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.