Skip to content

williamli/collection-news

 
 

Repository files navigation

果靈·聞庫

This is the repository for collection.news


🚀 Development

Note: We do not plan to add external maintainer yet!

Setup your environment

npm install
cp .env.example .env.local
  • Request AWS access from team members
  • Fill up the ENV marked <required> in your .env.local

Start local development

npm run dev

🏗️ Project and page structure

  • 昔日新聞 - News for that date sort by time desc
    • /<media_slug>/<date_slug>
    • /<media_slug>/<date_slug>/<category_slug>
    • Pseudo SQL SELECT * FROM appledaily_table WHERE date = '20190721' AND category = 'local;
  • 當年今日 - News on today for past year
    • /<media_slug>/history/<year_slug>/
    • /<media_slug>/history/<year_slug>/<category_slug>
    • Pseudo SQL SELECT * FROM appledaily_table WHERE date = '20190721' AND category = 'local';
  • Home page
    • /
    • It will eventually be render the same as /appledaily/20210623, i.e. last day of appledaily
  • About us
    • /about-us
  • Search page
    • /search
    • Not fully functional yet due to Google indexing mechanism

🗺️ System architecture

🛠️ Technical choice

  • NextJS & React with ISR
  • AWS
  • Cloudflare
  • Vercel

⚡ A note on cache behavior

  • S3 object have cache-control: max-age=31536000,public,immutable
  • Cloudfront (asset)
    • min_ttl=2629743
    • default_ttl=31536000
    • max_ttl=31536000
  • For more details on Cloudfront cache behavior, please refer to official documentation
  • NextJS rendered HTML have cache-control: public, max-age=0, must-revalidate header but NextJS server side will cache SSR result depends on revalidate field. Currently it is indefinitely (until next deployment) for article page and 1 hour other listing page.
  • Article API have cache-control: public, max-age=604800, s-maxage=604800, immutable header, i.e. 7 days client side cache, too.
  • Cloudflare applied "Cache Everything" rule with
    • cdn.collection.news Edge Cache TTL: a month and,
    • collection.news Edge Cache TTL: 2 hours

📄 License

This software is released under the MIT License in GitHub. Logo the on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0). Next Digital Ltd. maintain the copyright of all the content of Apply Daily. For enquiries, please contact us at info@collection.news.

本軟件在 MIT 許可證下發佈在GitHub,而本網站上的徽標根據創用CC 姓名標示-非商業性-相同方式分享 4.0 國際 (CC BY-NC-SA 4.0)分享。「壹傳媒有限公司」保留《蘋果日報》所有內容的版權。如有查詢,請聯絡我們 info@collection.news

Creative Commons License

About

果靈 | 聞庫

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.0%
  • JavaScript 8.8%
  • Other 1.2%