Capital Press is a modern news web app built with vanilla HTML, CSS, and JavaScript. It brings together live headlines from NewsAPI.org and presents them in a clean newspaper style experience with category browsing, search, bookmarks, and article detail pages.
Live website: https://capital-press.vercel.app
- Homepage with a featured carousel, latest stories, and topic based sections
- Topic pages for politics, business, technology, sports, world, health, science, and entertainment
- Search page with paginated results using API cursors
- Article detail page with source metadata, keyword tags, and read original link
- Bookmark drawer powered by localStorage
- Theme switcher with saved user preference
- About, Contact, Privacy Policy, and Terms pages
- HTML for page structure
- CSS for styling, layout, animations, and responsive behavior
- Vanilla JavaScript modules for API calls, UI components, and page logic
- Vercel serverless function in
api/news.jsas a secure API proxy - NewsAPI.org as the upstream news provider
index.htmlmain landing pagecategory.htmltopic feed pagesearch.htmlkeyword search pagearticle.htmlarticle detail pageabout-us.html,contact.html,privacy-policy.html,terms-of-service.htmlinformational pagesjs/config.jsapp configuration and defaultsjs/api.jsclient API wrapper with retry and caching logicjs/components.jsreusable cards, carousel, and skeleton loadersjs/home.js,js/category.js,js/search.js,js/article.jspage specific controllersjs/bookmarks.jsbookmark state and drawer renderingjs/theme.jslight and dark mode persistencejs/utils.jsshared helpers for formatting, escaping, and URL statecss/style.csscomplete design system and responsive stylesapi/news.jsserver proxy that injects the API key and forwards requests
- Clone the repository
- Create an environment variable named
NEWS_API_KEYwith your NewsAPI.org key - Run the project with Vercel so the
/api/newsendpoint is available - Open the local URL in your browser
Example commands:
npm i -g vercel
vercel dev- Browser code calls
/api/newsinstead of calling NewsAPI.org directly - The serverless function adds the secret key from environment variables
- Article cards are cached in
sessionStoragefor fast navigation to the detail page - Bookmarks and theme preference are stored in
localStorage
Capital Press keeps the stack simple and readable while still handling real world concerns like API key protection, retry logic for rate limits, graceful loading states, and a responsive UI that works well on mobile and desktop.
No license file is currently included in this repository.
