Skip to content

OjasManchanda/LinkStream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LinkStream β€” Smart Link Hub with Rules & Analytics πŸš€

LinkStream is a fast, modern β€œlink-in-bio” platform with built‑in intelligence. It gives creators and small teams a single public hub of links plus rule-based visibility and integrated analytics so you can control what visitors see and when, and then actually measure how it performs.

Live Deployed Link : https://linkstreamm.vercel.app/


Quick status / TL;DR

  • Create a public link hub: https://yourdomain.com/{username}
  • Add links, reorder them, attach rules (time/device)
  • Customize your public page (title, bio, theme, layout, background & profile picture)
  • See analytics for visits & clicks β€” find top performing links
  • Built for fast iteration: React (Vite) frontend + Node/Express + MongoDB backend
  • Deploy: Frontend β†’ Vercel, Backend β†’ Render

Why LinkStream? β€” The elevator pitch

Most β€œlink-in-bio” apps show static lists. LinkStream adds conditions and analytics:

  • Show different links at different times of day (schedule promotions automatically)
  • Show mobile-optimized links only to mobile visitors β€” no manual duplication
  • Track visits & clicks to focus effort on top content

Perfect for creators, teachers, bootcamps, small businesses, or hackathon demos that need a data‑backed link hub β€” fast.


🌟 Key Features

πŸ”— Link Hub Creation

  • Add / edit / delete / reorder links
  • Unique public URL per user: https://yourdomain.com/{username}
  • Page customization: title, bio, theme (dark / light / gradient), layout (centered / cards / minimal)

βš™οΈ Rule-Based Link Display

  • Time-based rules: show a link only between specified hours
  • Device-based rules: show optimized link for mobile visitors
  • UI-configurable β€” no code changes required
  • Extensible: location-based and performance-driven rules planned

πŸ“Š Analytics & Monitoring

  • Count page visits and link clicks
  • Top & bottom performing links
  • Lightweight analytics stored in the DB and surfaced in the dashboard

πŸ” Security & Scalability

  • JWT authentication
  • Rate limiting middleware (prevent abuse)
  • MongoDB for persistence
  • Modular Express backend for easy feature additions

πŸ›  Tech Stack

Frontend

  • React (Vite)
  • React Router
  • Hosted on Vercel

Backend

  • Node.js + Express
  • MongoDB (Atlas or self-hosted)
  • JWT Auth
  • Hosted on Render (or equivalent)

Project structure (short)

LinkStream/
β”œβ”€β”€ .vercel/
β”‚   β”œβ”€β”€ README.txt
β”‚   └── project.json
β”‚
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ design/
β”‚   └── LINKSTREAM_UI_DNA.md
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ .env.example
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ package-lock.json
β”‚   β”œβ”€β”€ server.js
β”‚   β”œβ”€β”€ test-db.js
β”‚   β”‚
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js
β”‚   β”‚
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ analyticsController.js
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ customizationController.js
β”‚   β”‚   β”œβ”€β”€ linkController.js
β”‚   β”‚   β”œβ”€β”€ publicController.js
β”‚   β”‚   └── ruleController.js
β”‚   β”‚
β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”œβ”€β”€ authMiddleware.js
β”‚   β”‚   β”œβ”€β”€ errorMiddleware.js
β”‚   β”‚   β”œβ”€β”€ rateLimiter.js
β”‚   β”‚   └── validateRequest.js
β”‚   β”‚
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ Click.js
β”‚   β”‚   β”œβ”€β”€ Link.js
β”‚   β”‚   β”œβ”€β”€ Users.js
β”‚   β”‚   └── Visit.js
β”‚   β”‚
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ analyticsRoutes.js
β”‚   β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”‚   β”œβ”€β”€ customizationRoutes.js
β”‚   β”‚   β”œβ”€β”€ linkRoutes.js
β”‚   β”‚   β”œβ”€β”€ publicRoutes.js
β”‚   β”‚   └── ruleRoutes.js
β”‚   β”‚
β”‚   └── utils/
β”‚       β”œβ”€β”€ device.js
β”‚       β”œβ”€β”€ hash.js
β”‚       β”œβ”€β”€ jwt.js
β”‚       └── ruleEngine.js
β”‚
└── frontend/
    β”œβ”€β”€ .env
    β”œβ”€β”€ .gitignore
    β”œβ”€β”€ README.md
    β”œβ”€β”€ eslint.config.js
    β”œβ”€β”€ index.html
    β”œβ”€β”€ package.json
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ vite.config.js
    β”œβ”€β”€ vercel.json
    β”‚
    β”œβ”€β”€ public/
    β”‚   β”œβ”€β”€ vite.svg
    β”‚   β”œβ”€β”€ image1.webp
    β”‚   β”œβ”€β”€ image2.webp
    β”‚   β”œβ”€β”€ image3.webp
    β”‚   β”œβ”€β”€ image4.webp
    β”‚   β”œβ”€β”€ image5.webp
    β”‚   β”œβ”€β”€ image6.webp
    β”‚   β”œβ”€β”€ image7.webp
    β”‚   β”œβ”€β”€ image8.webp
    β”‚   β”œβ”€β”€ image9.webp
    β”‚   β”œβ”€β”€ image10.webp
    β”‚   β”œβ”€β”€ image11.webp
    β”‚   β”œβ”€β”€ image12.webp
    β”‚   β”œβ”€β”€ image13.webp
    β”‚   β”œβ”€β”€ image14.webp
    β”‚   └── image15.webp
    β”‚
    └── src/
        β”œβ”€β”€ main.jsx
        β”œβ”€β”€ App.jsx
        β”œβ”€β”€ index.css
        β”‚
        β”œβ”€β”€ assets/
        β”‚   └── react.svg
        β”‚
        β”œβ”€β”€ hooks/
        β”‚   └── useRevealOnScroll.js
        β”‚
        └── pages/
            β”œβ”€β”€ Dashboard.jsx
            β”œβ”€β”€ PublicLink.jsx
            β”œβ”€β”€ PublicPage.jsx
            β”œβ”€β”€ PublicPage.css
            β”œβ”€β”€ Signup.jsx
            └── login.jsx


Environment Variables

Backend (.env)

MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
PORT=5000

Frontend (Vercel / build-time)

VITE_API_BASE=https://your-backend-url.onrender.com

Important: Vite inlines import.meta.env values at build time. Add VITE_API_BASE in your Vercel project settings before building, and redeploy (clear cache) to pick up changes.


▢️ Running Locally (fastest way)

Backend

# from project root or backend folder
npm install
npm run dev   # nodemon or equivalent
# backend runs: http://localhost:5000

Frontend

cd frontend
npm install
npm run dev
# frontend runs: http://localhost:5173

πŸ” Deployment (quick checklist)

Backend β†’ Render

  1. Connect the GitHub repo
  2. Set environment variables on Render dashboard (MONGO_URI, JWT_SECRET, etc.)
  3. Deploy

Frontend β†’ Vercel

  1. Root directory: frontend
  2. Set VITE_API_BASE in Vercel environment variables (production value)
  3. Deploy (select β€œClear Build Cache” if you changed env vars)

πŸ§ͺ API Overview (useful endpoints)

Auth

POST /api/auth/signup
POST /api/auth/login
GET  /api/auth/me

Links

GET    /api/links
POST   /api/links
PUT    /api/links/:id
DELETE /api/links/:id
PUT    /api/links/reorder

Analytics

POST /api/analytics/visit
POST /api/analytics/click
GET  /api/analytics/summary/:userId

Customization

POST /api/user/customization
GET  /api/user/customization

Public Page

GET /api/public/:username

πŸ”§ Quick examples

Save customization (cURL)

curl -X POST "http://localhost:5000/api/user/customization"   -H "Authorization: Bearer <TOKEN>"   -H "Content-Type: application/json"   -d '{"title":"My Page","bio":"Hello world","theme":"dark","layout":"centered","profileImage":"https://i.pravatar.cc/150?u=test"}'

Fetch public page JSON

curl "http://localhost:5000/api/public/johndoe"

⚠️ Notes & Practical Tips

  • Vercel builds inline env vars β€” set VITE_API_BASE in Vercel dashboard and redeploy with cache cleared to update the deployed app.
  • Production best-practice: use a file-hosting service (Cloudinary / S3) and store URLs in DB instead of base64 blobs.

🎯 Usage Flow (user journey)

  1. Sign up / LOGIN
  2. Open Dashboard
  3. Add & reorder links
  4. Add rules per link (time/device)
  5. Customize public page (title, theme, background, profile)
  6. Share public URL
  7. Analytics update in real time

πŸ“ˆ Future Enhancements (roadmap)

  • Location-based rules (geo-targeting)
  • Auto-promote highest performing links
  • QR code generation for link hubs
  • Exportable analytics CSV / PDF
  • Offline static public pages (pre-rendered)
  • Advanced theme marketplace / templates

Contributing

Contributions, issues, and feature ideas are welcome. If you want to help:

  1. Fork
  2. Create a feature branch
  3. Open a PR with a short description

Troubleshooting (common dev pain points)

  • If login or API calls hang: check VITE_API_BASE and make sure the frontend is hitting the correct backend (local vs production).
  • If saving customization yields 413: you likely sent large base64 images β€” either use URL or increase express.json limit in server.js.
  • If deployed frontend doesn’t reflect changes: ensure Vercel has right env vars and redeploy with cache cleared.

Licensing & Credits

Built with ❀️ by the LinkStream team β€” feel free to fork and prototype for hackathons & demos.
(If you reuse code for production, please add proper attribution and secure your secrets.)


Contact / Demo request

Open an issue or ping the repo owner for a demo, walkthrough, or to request a feature. Thank you for checking out LinkStream!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors