Skip to content

nerdymuslim/daily

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Daily Logo

Daily

Curated dev news delivered to your new tab πŸ‘©πŸ½β€πŸ’»
Made by developers for developers ❀️

Chrome Web Store users Chrome Web Store rating StackShare Storybook

Hi there πŸ‘‹! So you probably here because you want to understand deeper what's going on behind the scenes of Daily... This is exactly the place for you so calm down and keep on reading πŸ“–!

Don't know Daily!?

Daily is a dev news curator delivering relevant updates to your new tab. It gathers and ranks articles from tens of different sources to help you optimize your time and boost your knowledge.

Check us out:

Projects

Daily might look pretty simple on the surface but actually it is powered by several services, some might be big and legacy and other micro and easy to maintain. We would like to guide you through the different repositories so you can get by the codebase.

Community & Docs

  • daily - This is the repository you are currently at and it is actually the repository with overall documentation, community ideas, suggestions and whatnot.

Frontend

  • daily-apps - Monorepo with all the frontend related projects since Daily 2.0, our Vue components library, API encapsulation library, obviously Daily extension and others.
  • daily-go - Our Daily Go webapp, with a story like interface (called toilet mode) and user's bookmarks.

Backend

  • daily-api - Started as a monolith API service and slowly has been split apart to different services. Currently the target domain is to manage content related data such as posts, feeds, tags, etc.
  • daily-redirector - Service for redirecting visitors from Daily custom links to the original link.
  • daily-gateway - API gateway which receives all traffic and forward it to the relevant services after authenticating and authorizing the request.
  • daily-monetization - Serving ads from different providers including CodeFund, BuySellAds and self-hosted campaigns.
  • daily-functions - Monorepo with Cloud Functions which mostly take care of ingesting new content but also web push and others.

Want to help?

Looking to contribute to Daily? Awesome! We are glad to hear it, check out our guidelines.

Architecture

Daily architecture

Tech Stack

We use Vue for web application development and Netlify for hosting them. Backend wise most of the services and cloud functions are written in Node and some minor services are written in Go (wanted to learn Go, perfect chance 😜). Everything is Docker-based and deployed to the almighty Kubernetes cluster with Helm charts. MySQL is the database which powers everything and Google Pub/Sub is used for inter-service communitcation. Lastly, we use CircleCI for running the CI/CD pipelines.

Setting up local environment

Before proceeding to setting up your own Daily environment, make sure to go over the projects description and the architecture to make sure you understand the system and its components.

Daily services are fully dockerized and publicy available on a gcr.io repository. This means that all you need is docker on your system and we are good to go. If you don't have docker already you can check out this guide.

Follow the instructions to install everything:

  1. Create a network so the services can communicate with each other.
    docker network create daily
  2. Start a MySQL instance (contains the relevant databases already), it exposes port 3306 so you can use any MySQL client to connect and inspect the data. The root user is root and password is 12345.
    docker run -d --name daily-mysql -p 3306:3306 --network daily gcr.io/daily-ops/mysql
  3. Run Daily Gateway service, it exposes port 4000. Obviously, the OAuth credentials are for our staging environment and don't provide any real Daily user information.
    docker run -d --name daily-gateway -p 4000:4000 --network daily -e MYSQL_USER=root -e MYSQL_PASSWORD=12345 -e MYSQL_DATABASE=gateway -e MYSQL_HOST=daily-mysql -e COOKIES_DOMAIN=localhost -e COOKIES_KEY=topsecret -e GITHUB_CLIENT_ID=7b514cee17923d0acedc -e GITHUB_CLIENT_SECRET=064d875c7b370d271be839242538c87ab8bb6f92 -e GOOGLE_CLIENT_ID=750405661228-fmeg35uuaopbcnc4c6m6g51755s355bm.apps.googleusercontent.com -e GOOGLE_CLIENT_SECRET=MMv_wZAS6Etoleg-sn__BlDC -e URL_PREFIX=http://localhost:4000 -e JWT_SECRET='|r+.2!!!.Qf_-|63*%.D' -e JWT_AUDIENCE='Daily Staging' -e JWT_ISSUER='Daily API Staging' -e CORS_ORIGIN='http://,chrome-extension://,moz-extension://' -e PORT=4000 -e API_URL=http://daily-api:5000 -e API_SECRET=topsecret gcr.io/daily-ops/daily-gateway
  4. Run Daily API service, it exposes port 5000.
    docker run -d --name daily-api -p 5000:5000 --network daily -e DEFAULT_IMAGE_URL=https://storage.cloud.google.com/devkit-assets/placeholder.jpg -e DEFAULT_IMAGE_PLACEHOLDER='data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QCYRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARg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tZXRhPgo8P3hwYWNrZXQgZW5kPSdyJz8+Cv/bAEMAAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/bAEMBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/CABEIAAYACgMBEQACEQEDEQH/xAAVAAEBAAAAAAAAAAAAAAAAAAAEBv/EABYBAQEBAAAAAAAAAAAAAAAAAAgDBP/aAAwDAQACEAMQAAABuW6Vha4f/8QAFxAAAwEAAAAAAAAAAAAAAAAAAAIDAf/aAAgBAQABBQJHjkz/xAAcEQEBAQACAwEAAAAAAAAAAAACAwEREgAEEyH/2gAIAQMBAT8BFIGNA/W+llu9LbahyZ08fkhxiZeFFNaOm0Ckkp0j5//EABwRAAMBAAIDAAAAAAAAAAAAAAECAwQAExESIf/aAAgBAgEBPwGsdL6JUnsMc6Admdc8nNnD+ft6ezJJplldJoKdgjRLoqWjp5//xAAdEAACAQQDAAAAAAAAAAAAAAABAgMREiEjABMi/9oACAEBAAY/AirQXybKSdrrQNHanhcExSbAThqlHUi0rz//xAAXEAEBAQEAAAAAAAAAAAAAAAABERAx/9oACAEBAAE/IRRs0xVxiFhHGC//2gAMAwEAAgADAAAAEGP/xAAWEQEBAQAAAAAAAAAAAAAAAAABEBH/2gAIAQMBAT8QNAUSVjBHQudd/8QAFhEBAQEAAAAAAAAAAAAAAAAAARAh/9oACAECAQE/EEkCGWNRJa8Ww//EABcQAQADAAAAAAAAAAAAAAAAAAEQESH/2gAIAQEAAT8QpeTsA40GpPBD/9k=' -e DEFAULT_IMAGE_RATIO=1.7 -e MYSQL_USER=root -e MYSQL_PASSWORD=12345 -e MYSQL_DATABASE=devkit -e MYSQL_HOST=daily-mysql -e URL_PREFIX=http://localhost:4000 -e PORT=5000 -e GATEWAY_URL=http://daily-gateway:4000 -e GATEWAY_SECRET=topsecret gcr.io/daily-ops/daily-api
  5. Populate database with seed data.
    docker exec daily-api npx knex seed:run

That's it! πŸ‘ Now you have a running environment waiting for you to try it out. Each project explains what services are needed and how to dive into the actual code and contribute.

* Please note that currently not all services are ready (or needed) for local environment so Daily Redirector and Daily Monetization services are not available for you. Don't worry it just means that if you click on an article you will get error 404 and that you will not see ads on your local environment.

About

Curated dev news delivered to your new tab πŸ‘©πŸ½β€πŸ’»

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published