How 0x00vb/newstok works
Project type and purpose
• Newstok is a full‑stack, single‑page news application modeled after TikTok’s swipeable UI.
• The README confirms this: a React/Tailwind frontend for swipeable cards, backed by a Node.js/Express API that fetches news from an external Wikinews endpoint.
File structure
• Top level:
• backend/ – contains Express code (index.js, controller/, router/, vercel.json).
• src/ – React sources (components/, services/api.js, assets).
• public/ & index.html – static assets and host page.
• config files – vite.config.js, tailwind.config.js, eslint.config.js, postcss.config.js.
• Patterns:
• Clear separation of frontend vs. backend.
• Frontend built with Vite (fast dev server + bundler).
• Backend organized in MVC‑style (controller + router).
README for additional insights
• Confirms the tech stack: React, Tailwind CSS, Node.js/Express.
• Describes infinite scrolling, swipe gestures, external API calls.
• No internal database – data is streamed from an external news API.
Main components and interactions
a. Components:
• Client (Browser/mobile) running the React SPA.
• Vite dev server / built static host (public files).
• Backend API server (Express on Node.js, deployed via Vercel functions).
• External News Service (Wikinews API).
• (Optional) CDN or Static‑asset host (if used in production).
b. Interactions & Data Flow:
1. User opens the SPA → index.html served.
2. React app initializes (main.jsx → App.jsx).
3. User swipes → component (NewsCard.jsx) triggers a fetch via services/api.js.
4. API client calls backend router (e.g., GET /api/news).
5. Express router/news.router.js invokes news.controller.js.
6. Controller fetches data from external Wikinews API.
7. Controller returns JSON to frontend.
8. Frontend renders new cards; infinite scroll loops back to step 3.
c. Architectural patterns & principles:
• SPA + REST API separation.
• Controller/Router pattern in backend.
• Stateless services – no persistent storage.
• Serverless deployment (if using Vercel functions).
• Mobile‑first, responsive UI via Tailwind.
d. Key technologies:
• Frontend: React, Vite, Tailwind CSS.
• Backend: Node.js, Express, serverless (vercel.json).
• External API: Wikinews.
• Dev tooling: ESLint, PostCSS.