Skip to content

hasanpeal/FeedRecap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

196 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FeedRecap

FeedRecap Logo

FeedRecap is an AI-powered newsletter platform that curates top tweets from Twitter and delivers them to your inbox. You can follow trending categories like politics, tech, finance, or entertainment, or build a custom feed from specific Twitter profiles.


Live Demo


Features

Category Mode

  • Choose from predefined categories: Politics, Geopolitics, Finance, AI, Tech, Crypto, Meme, Sports, Entertainment
  • Set preferred newsletter delivery times (Morning, Afternoon, Night)
  • Receive AI-curated newsletters with the top tweets from your selected categories

Custom Profile Mode

  • Add Twitter profiles via an auto-suggestion search
  • Follow any number of Twitter profiles
  • Get newsletters based on your custom profile feed

Dashboard

  • Newsfeed: View top tweets based on your selected categories or custom profiles
  • Newsletter: Access the most recent newsletter sent to you
  • Settings: Update categories, custom profiles, timezone, and delivery time

Newsletter

  • AI-generated newsletter content delivered to your inbox
  • Curated top tweets of the day
  • Web link for easy sharing
  • Share on X directly from the dashboard

Audit Logging

All major user actions are logged automatically:

  • Page visits
  • Account creation, login, and logout
  • Password changes and account updates
  • Twitter account linking/unlinking
  • Category and profile updates
  • Feed type changes
  • Newsletter views and link clicks

Each log entry stores the user ID, email, activity type, page/route, IP address, user agent, timestamp, and relevant metadata. Logs are stored in MongoDB with indexed fields.

Admin Dashboard

Accessible only to users with isAdmin: true in the database, at the /admin route.

  • Page views analytics with time period filters (1d, 3d, 7d, 30d, 6m, 1y)
  • Link click tracking with user info and timestamps
  • Activity distribution statistics
  • User metrics: total users, feed type breakdown, Twitter linking stats
  • Live audit log feed, filterable by user or activity type

Tech Stack

Frontend

  • Framework: Next.js, React
  • Language: TypeScript
  • State Management: React Context API
  • HTTP Client: Axios with JWT interceptors
  • Analytics: Google Analytics, Vercel Analytics
  • Deployed on: Vercel

Backend

  • Framework: Express.js
  • Authentication: JWT, Google OAuth, email-based login with OTP verification
  • Database: MongoDB with Mongoose
  • Email: SendGrid
  • AI: OpenAI-compatible API (configurable model)
  • Language: TypeScript
  • Automation: node-cron for newsletter scheduling

Project Structure

FeedRecap/
β”œβ”€β”€ client/                    # Frontend (Next.js)
β”‚   β”œβ”€β”€ app/                   # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ api/               # API routes (DeepSeek, Twitter, video-proxy)
β”‚   β”‚   β”œβ”€β”€ dashboard/         # User dashboard page
β”‚   β”‚   β”œβ”€β”€ admin/             # Admin dashboard page
β”‚   β”‚   β”œβ”€β”€ signin/            # Sign-in page
β”‚   β”‚   β”œβ”€β”€ signup/            # Sign-up page
β”‚   β”‚   └── ...                # Other pages
β”‚   β”œβ”€β”€ components/            # React components
β”‚   β”‚   β”œβ”€β”€ dashboard/         # Dashboard-specific components
β”‚   β”‚   └── PageVisitLogger.tsx
β”‚   β”œβ”€β”€ context/               # React Context (UserContext)
β”‚   β”œβ”€β”€ utils/                 # Utility functions (axios, notifications)
β”‚   └── public/                # Static assets
β”œβ”€β”€ server/                    # Backend (Express.js)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ server.ts          # Main server file with JWT auth
β”‚   β”‚   β”œβ”€β”€ userModel.ts       # User MongoDB model
β”‚   β”‚   β”œβ”€β”€ newsletterModel.ts # Newsletter MongoDB model
β”‚   β”‚   β”œβ”€β”€ tweetModel.ts      # Tweet MongoDB model
β”‚   β”‚   β”œβ”€β”€ auditLogModel.ts   # Audit log MongoDB model
β”‚   β”‚   β”œβ”€β”€ auditLogger.ts     # Audit logging utilities
β”‚   β”‚   β”œβ”€β”€ digest.ts          # Newsletter generation logic
β”‚   β”‚   └── db.ts              # Database connection
β”‚   └── dist/                  # Compiled JavaScript
β”œβ”€β”€ start.sh                   # Startup script
└── README.md

Getting Started

Prerequisites

  • Node.js v18 or higher
  • npm or yarn
  • MongoDB (local or Atlas)
  • Environment variables configured (see below)

Environment Variables

Server (server/.env)

MONGO_USERNAME=your_mongodb_username
MONGO_PASSWORD=your_mongodb_password

JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=7d

SENDGRID_API_KEY=your_sendgrid_api_key
FROM_EMAIL=your_sender_email@example.com

CLIENT=your_google_oauth_client_id
SECRET=your_google_oauth_client_secret

SERVER=http://localhost:3001
ORIGIN=http://localhost:3000
CLIENT_URL=http://localhost:3000

Client (client/.env.local)

NEXT_PUBLIC_SERVER=http://localhost:3001

Quick Start

chmod +x start.sh
./start.sh

This will install dependencies for both client and server, build the TypeScript server, and start both services.

Manual Setup

Frontend

cd client
npm install
npm run dev

Backend

cd server
npm install
npm run build
npm run start

Setting Up Admin Access

Update the isAdmin field for a user in MongoDB:

db.users.updateOne(
  { email: "admin@example.com" },
  { $set: { isAdmin: true } }
)

Once set, the user can access /admin to view analytics, audit logs, and user metrics.


Authentication

FeedRecap uses JWT for stateless authentication.

Methods

Email-based: Sign up with email and password. OTP verification required. Password hashed with bcrypt.

Google OAuth: Sign up or sign in via Google. Handled with Passport.js. JWT issued after successful authentication.

JWT Details

  • Payload: userId, email
  • Default expiration: 7 days
  • All authenticated routes use the authenticateJWT middleware
  • Frontend stores the token in localStorage and attaches it as Authorization: Bearer <token> on every request
  • On 401 responses, the token is removed and the user is redirected to sign-in

API Routes

Frontend Routes

Route Description Auth Required
/ Homepage No
/signin Sign-in page No
/signup Sign-up page No
/aboutus About page No
/samplenewsletter Sample newsletter preview No
/dashboard User dashboard Yes (JWT)
/readnewsletter Read newsletter by ID No
/unsubscribe Unsubscribe from newsletters No
/admin Admin dashboard Yes (Admin)

Backend API Routes

Route Method Description Auth
/login POST Email/password login No
/register POST User registration No
/logout POST User logout JWT
/check-session GET Validate JWT token JWT
/data GET Get user dashboard data JWT
/updateProfiles POST Update custom Twitter profiles JWT
/updateFeedType POST Change feed type JWT
/updateCategories POST Update selected categories JWT
/updateTimes POST Update newsletter delivery times JWT
/updateAccount POST Update account details JWT
/getUserDetails GET Get account information JWT
/getIsNewUser GET Check if user is new JWT
/newsletter/:id GET Get newsletter by ID No
/sentOTP POST Send OTP for email verification No
/resetPassword POST Reset password No
/validateEmail GET Check if email exists No
/saveX POST Link Twitter account No
/unlinkX POST Unlink Twitter account JWT
/auth/google/signup GET Google OAuth sign-up No
/auth/google/signin GET Google OAuth sign-in No
/auth/google/callback GET Google OAuth callback No
/logPageVisit POST Log page visit JWT
/logLinkClick POST Log link click JWT
/logFeedback POST Log feedback JWT
/admin/analytics/pageviews GET Page views analytics Admin
/admin/analytics/linkclicks GET Link clicks analytics Admin
/admin/analytics/activities GET Activity statistics Admin
/admin/audit-logs GET Audit log feed Admin
/admin/users GET All users and metrics Admin

License

MIT License. See LICENSE for details.


Contributing

  1. Fork the repository
  2. Create a branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a pull request

Contact

About

FeedRecap: AI-powered platform for personalized newsletters πŸ“© featuring top tweets 🐦 on trending topics like Politics, Tech, Sports, and Finance πŸ’Ό. Follow categories or custom Twitter profiles for curated content πŸ“°. Built with Next.js, Node.js, Express.js, MongoDB, TypeScript

Topics

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages