GithubHelp home page GithubHelp logo

聞庫

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';
  • 內文 - Article content
    • /<media_slug>/articles/<article_id>/
  • Home page
    • /
  • 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

🗺️ A note on sitemap

  • Sitemap index is generated at build time in prebuild script.
  • Site map logic are inside src/scripts/genSitemap.ts & src/pages/api/sitemap/[media]/[date].ts. next.config.js will do the mapping for dynamic sitemap generation.
  • Root sitemap index (/sitemap.xml) contain links to all sitemap group by date. e.g. /sitemap/appledaily/20210623.xml

📄 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. Best Pencil (Hong Kong) Ltd. maintain the copyright of all the content of Stand News. For enquiries, please contact us at [email protected].

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

Creative Commons License

聞庫's Projects

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.