Skip to content

Bhavyabhardwaj/linkweaver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔗 LinkWeaver!

Typing SVG

A powerful, feature-rich full-stack URL shortener with advanced analytics, custom slugs, and seamless user management

GitHub repo size GitHub stars GitHub forks GitHub issues License

TypeScript Node.js Express.js React PostgreSQL Prisma Docker

FeaturesStructureQuick StartAPI DocsDockerContributingLicense

🌟 Features

🚀 Performance

⚡ Lightning-fast URL shortening
🔄 Real-time analytics
📱 Mobile-responsive design
⚡ Optimized database queries

🔐 Security

🛡️ Rate limiting protection
🔒 JWT authentication
🔑 OAuth integration (Google, GitHub)
🛡️ Input validation & sanitization

📊 Analytics

📈 Detailed click tracking
🌍 Geographic analytics
📱 Device & browser detection
📅 Time-based insights

Core Features

  • 🔗 URL Shortening: Create short, memorable links with custom slugs
  • 📊 Advanced Analytics: Track clicks, geographic data, device information, and more
  • 🎨 QR Code Generation: Generate QR codes for your shortened links
  • 👤 User Authentication: Secure login with Google and GitHub OAuth
  • 🔐 Password Reset: Secure password recovery system
  • ⚡ Rate Limiting: Protection against abuse and spam
  • 🌐 Public Links: Share links without authentication
  • 📱 Responsive Design: Works seamlessly on all devices
  • 🐳 Docker Support: Easy deployment with Docker containers

📁 Project Structure

This is a monorepo containing both the frontend and backend applications:

📦 Link Manager (Monorepo)
├── 🎨 client/                    # React + TypeScript Frontend
│   ├── 📦 package.json          # Frontend dependencies
│   ├── ⚙️ vite.config.ts        # Vite configuration
│   ├── 🎯 tsconfig.json         # TypeScript config
│   ├── 🎨 src/                  # Source code
│   │   ├── 📱 components/       # React components
│   │   ├── 📄 pages/            # Page components
│   │   ├── 🔧 hooks/            # Custom hooks
│   │   ├── 🎨 styles/           # CSS/styling
│   │   └── 🔌 utils/            # Utility functions
│   └── 📦 public/               # Static assets
├── ⚙️ server/                    # Node.js + Express Backend
│   ├── 📦 package.json          # Backend dependencies
│   ├── 🐳 Dockerfile            # Docker configuration
│   ├── 🗄️ prisma/              # Database schema & migrations
│   ├── 📡 src/                  # Source code
│   │   ├── 🛣️ routes/           # API routes
│   │   ├── 🎮 controllers/      # Request handlers
│   │   ├── 🔧 services/         # Business logic
│   │   ├── 🗄️ models/          # Database models
│   │   ├── 🛡️ middlewares/     # Express middlewares
│   │   ├── 🔧 utils/            # Utility functions
│   │   └── ✅ validation/       # Input validation
│   └── 📚 docs/                 # API documentation
├── 🏗️ package.json             # Workspace configuration
├── 🔒 package-lock.json         # Dependency locks
├── 📝 README.md                 # This file
└── 🙈 .gitignore               # Git ignore rules

🛠️ Tech Stack

🎨 Frontend (client/)

  • Framework: React 19 with TypeScript
  • Build Tool: Vite for fast development
  • Routing: React Router DOM
  • HTTP Client: Axios for API communication
  • Styling: CSS Modules & Modern CSS
  • Development: Hot reload, fast refresh

⚙️ Backend (server/)

  • Runtime: Node.js with TypeScript
  • Framework: Express.js with middleware
  • Database: PostgreSQL with Prisma ORM
  • Authentication: Passport.js (Google & GitHub OAuth)
  • Documentation: Swagger/OpenAPI
  • Security: JWT, bcrypt, rate limiting
  • Containerization: Docker & Docker Compose

🚀 Quick Start

📋 Prerequisites

One-Command Setup

# Clone the repository
git clone https://github.com/Bhavyabhardwaj/linkweaver-server.git
cd linkweaver-server

# Install all dependencies (client + server)
npm run install:all

# Set up environment variables
cd server && cp .env.example .env
# Edit .env with your configuration

# Run database migrations
npx prisma migrate dev

# Start both frontend and backend
npm run dev

🎉 That's it! Your application will be running at:

🔧 Detailed Setup

Click to expand detailed setup instructions

Backend Setup

  1. Navigate to server directory:

    cd server
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    cp .env.example .env

    Edit .env with your configuration:

    # Database
    DATABASE_URL="postgresql://username:password@localhost:5432/linkweaver"
    
    # JWT
    JWT_SECRET="your-super-secret-jwt-key"
    
    # OAuth (optional)
    GOOGLE_CLIENT_ID="your-google-client-id"
    GOOGLE_CLIENT_SECRET="your-google-client-secret"
    GITHUB_CLIENT_ID="your-github-client-id"
    GITHUB_CLIENT_SECRET="your-github-client-secret"
  4. Run database migrations:

    npx prisma migrate dev
  5. Start the development server:

    npm run dev

Frontend Setup

  1. Navigate to client directory:

    cd client
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm run dev

🐳 Docker Deployment

Quick Docker Setup

# Navigate to server directory
cd server

# Build and start all services
docker-compose up -d

# View logs
docker-compose logs -f

Available Scripts

Command Description
npm run dev 🚀 Start both client and server in development mode
npm run dev:client 🎨 Start only the React frontend
npm run dev:server ⚙️ Start only the Node.js backend
npm run build 🏗️ Build both client and server for production
npm run build:client 🎨 Build only the frontend
npm run build:server ⚙️ Build only the backend
npm run install:all 📦 Install dependencies for both client and server
npm run test 🧪 Run tests for both client and server
npm start 🚀 Start the production server

📖 API Documentation

The comprehensive API documentation is available at /api-docs when the server is running.

Key Endpoints:

  • 🔗 Links: POST /api/links - Create shortened links
  • 📊 Analytics: GET /api/analytics - Get link analytics
  • 👤 Auth: POST /api/auth/login - User authentication
  • 📱 Public: GET /:slug - Redirect to original URL
Swagger API Docs

🤝 Contributing

We love your contributions! Here's how to get started:

📝 Contributing Guidelines

Development Workflow

  1. Fork the repository

    # Click the Fork button on GitHub
  2. Clone your fork

    git clone https://github.com/YOUR_USERNAME/linkweaver-server.git
    cd linkweaver-server
  3. Create a feature branch

    git checkout -b feature/amazing-feature
  4. Make your changes

    • Follow the existing code style
    • Add tests for new features
    • Update documentation as needed
  5. Test your changes

    npm run test
    npm run lint
  6. Commit your changes

    git commit -m "✨ Add amazing feature"
  7. Push to your fork

    git push origin feature/amazing-feature
  8. Create a Pull Request

    • Go to GitHub and create a PR
    • Describe your changes clearly
    • Wait for review and merge

Code Style

  • Use TypeScript for all new code
  • Follow ESLint configuration
  • Write meaningful commit messages
  • Add JSDoc comments for functions
  • Include tests for new features

📊 Project Stats

GitHub Stats

📄 License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

License

📧 Contact & Support

🙋‍♂️ Get in Touch

GitHub Email LinkedIn

Show Your Support

If you found this project helpful, please consider giving it a star! ⭐

GitHub Stars


Made with ❤️ by Bhavyabhardwaj

Building the future, one link at a time 🔗

About

A powerful, feature-rich full-stack URL manager with advanced analytics and seamless user management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages