Skip to content

swayam03275/Airly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 Airly

Share Your Moments, Discover Amazing Content ✨

Node.js React TypeScript MongoDB Express.js Tailwind

License: MIT GitHub stars GitHub forks Athena Award Badge


πŸ“– About Airly

Airly is an image-based social media webapp where people can share posts, like and comment on posts, and discover popular content through a smart ranking algorithm 🧠.

Built as a full-stack webapp with a clean, minimal design inspired by Pinterest, featuring a scalable backend architecture.

✨ Key Features

  • πŸ“Έ Image Sharing - Upload and share your moments
  • πŸ’– Smart Engagement - Advanced like and comment system
  • πŸ” Intelligent Discovery - AI-powered content ranking
  • πŸ‘€ User Profiles - Personalized user experiences
  • πŸ“± Responsive Design - Works seamlessly across devices
  • πŸ” Secure Authentication - JWT-based user management

πŸ‘¨β€πŸ’» About the Developer

Swayam - Passionate Full-Stack Developer πŸš€

GitHub Repository

Building scalable web applications with modern technologies πŸ’»

🎯 Why I Built This!

"Learning by building real-world applications" πŸ’‘

I built this as my first full-stack webapp project with a strong focus on:

  • 🎯 Backend Mastery - Deep dive into Node.js ecosystem
  • πŸ“Š Advanced Queries - MongoDB aggregation pipelines
  • πŸ—οΈ System Architecture - Scalable application design
  • 🎨 Modern Frontend - React + TypeScript best practices

This project was also created for the Hack Club Athena Award - a "you ship, we ship" initiative! πŸ†

πŸ› οΈ Tech Stack

Backend Technologies πŸ”§

Technology Purpose Why I Chose It
Node.js Runtime Environment Developer-friendly, JavaScript ecosystem
Express Web Framework Minimal, flexible, robust
MongoDB Database Document-based, denormalized approach
Cloudinary Image Storage Automatic optimization, easy integration
JWT Authentication Stateless, secure token-based auth

Frontend Technologies 🎨

Technology Purpose Why I Chose It
React UI Library Component-based, modern ecosystem
TypeScript Language Type safety, better DX
Vite Build Tool Fast development, optimized builds
Tailwind Styling Utility-first, rapid UI development
Redux State Management Predictable state, persistence

πŸ—οΈ Architecture Highlights

  • πŸ“Š Smart Algorithms: Advanced ranking system with weighted engagement metrics
  • πŸ” Text Indexing: Multi-field search across posts and users
  • πŸ›‘οΈ Security: JWT authentication with refresh tokens
  • πŸ“± Responsive: Mobile-first design with Tailwind CSS
  • ⚑ Performance: Database indexing and optimized queries
  • πŸ—‚οΈ Organization: Clean folder structure with proper separation of concerns

πŸ“š Key Learnings & Growth

πŸŽ“ Skills Developed

Full Stack API Design Database Authentication

πŸš€ Technical Achievements

  • πŸ“Š MongoDB Aggregation Pipelines - Complex data processing
  • πŸ” JWT Authentication System - Secure user management
  • πŸ“ File Upload Handling - Multer + Cloudinary integration
  • 🎯 TypeScript Mastery - Type-safe React development
  • πŸ”— API Integration - RESTful service architecture
  • πŸ“± State Management - Redux Toolkit with persistence

πŸ† Challenges Conquered

Challenge Solution Learning
🌐 CORS Issues Proper middleware configuration Cross-origin security
πŸ“€ File Uploads Multer + Cloudinary pipeline Media handling patterns
πŸ” Complex Queries MongoDB aggregation mastery Database optimization
πŸ”‘ Token Management JWT refresh token strategy Security best practices
🎨 UI Consistency TypeScript + Tailwind system Design systems

πŸ“Έ Screenshots

🚧 Coming Soon! Screenshots will be added once the application is deployed.

Preview of the beautiful, Pinterest-inspired interface

🎯 Cool Backend Features I Built

1. Popular Posts Algorithm

The popular posts feature implements a algorithm like a ranking system that goes far beyond simple "most liked" sorting. Instead of just counting likes, this algorithm creates a engagement score that considers the quality and type of user interaction.

How the Algorithm Works: we decide stuff on basis of these things -

  • Likes (2x weight)
  • Comments (1x weight)
  • Views (0.5x weight)
  • Recency factor - When scores are tied, newer posts get slight preference to keep content fresh.

imagine a post with 10 likes and 5 comments might rank higher than one with 20 likes but no comments. (yes this is an algorithmm)

This algorithm uses MongoDB's aggregation pipeline thingy to calculate scores(likes, comments) in real-time.


2. Text indexing advance search across multiple fields

multi-field text indexing is something so cool that it takes out stuff out of a mess of data to a request made by a user - that provides intelligent, context-aware search results.

This goes far beyond simple keyword matching to deliver relevant and fast results across different types of content.


πŸ€– AI Usage & Transparency

AI Assisted

I used AI tools strategically and minimally throughout this project for learning and problem-solving:

🎯 Where AI Helped

  • πŸ“š Learning TypeScript patterns and React best practices
  • 🧱 Masonry Layout Implementation - Pinterest-style grid system
  • πŸ” Complex Aggregation Queries - MongoDB pipeline optimization
  • πŸ› Debugging Assistance - Understanding error patterns

πŸ—οΈ What's 100% Original

  • 🧠 Core Logic & Algorithms - All my design and implementation
  • πŸ›οΈ System Architecture - Database design and API structure
  • 🎨 UI/UX Decisions - Component design and user flows
  • πŸ”§ Problem-Solving Approach - Technical decision-making

AI helped me learn faster, but the creativity and engineering are mine! πŸ’ͺ


πŸš€ Quick Start Guide

Prerequisites πŸ“‹

Node.js MongoDB Cloudinary

1. Clone the Repository

git clone https://github.com/swayam03275/Airly.git
cd Airly

2. Backend Setup

cd Backend
npm install

# Create environment variables file
cp .env.example .env
# Edit .env file with your actual values (MongoDB URI, JWT secrets, Cloudinary credentials)

# Start the backend server
npm run dev

The backend server will start on http://localhost:8000

3. Frontend Setup

Open a new terminal window/tab:

cd frontend
npm install

# Create environment variables file
cp .env.example .env
# Edit .env file to set VITE_SERVER_API=http://localhost:8000/api/v1

# Start the frontend server
npm run dev

The frontend will start on http://localhost:5173

4. Environment Configuration

Backend (.env)

  • MONGODB_URI: Your MongoDB connection string
  • ACCESS_TOKEN_SECRET & REFRESH_TOKEN_SECRET: Generate strong random strings
  • CLOUDINARY_*: Get these from your Cloudinary dashboard
  • UPSTASH_REDIS_REST_URL & UPSTASH_REDIS_REST_TOKEN: Required for feed caching (recommended)

Frontend (.env)

Redis Caching (Feed API)

Airly uses Upstash Redis REST caching for feed endpoints to reduce repeated aggregation load on MongoDB and improve response time.

Why Redis Here

  • Feed endpoints are read-heavy and frequently repeated.
  • Aggregation pipelines for sorting and ranking are comparatively expensive.
  • Redis stores precomputed response payloads for short TTL windows.

Environment Variables

Add these values in backend environment configuration:

  • UPSTASH_REDIS_REST_URL
  • UPSTASH_REDIS_REST_TOKEN

What Is Cached

  • GET /api/v1/feed?sort=recent
  • GET /api/v1/feed?sort=liked
  • GET /api/v1/feed?sort=popular

Each cache key includes sort mode, tag, pagination pointer, and user identity segment so personalized flags remain correct.

Step-by-Step Runtime Flow

  1. Request reaches feed controller.
  2. Controller builds deterministic cache key from query and user context.
  3. Redis get is attempted first.
  4. If key exists, cached payload is returned immediately.
  5. If key does not exist, MongoDB aggregation pipeline executes.
  6. Response payload is stored in Redis with TTL.
  7. Response is sent to the client.
  8. On tweet create, edit, or delete, related feed cache keys are invalidated.

How Vercel Path Works

  1. Vercel routes /api/v1/* to api/serverless.
  2. Serverless handler initializes Mongo connection once per warm instance.
  3. Serverless handler initializes Redis integration in non-blocking safe mode.
  4. If Redis env is missing or unavailable, app continues without cache.

Expected Impact

  • Significant latency reduction on repeated feed requests.
  • Lower MongoDB query pressure for hot endpoints.
  • Faster user-perceived feed loading for repeated sorts and pagination patterns.

5. Testing

  • Backend API: Use Postman or similar tools to test API endpoints
  • Frontend: Use your browser to test the UI and user flows
  • Full Stack: Ensure both servers are running to test the complete application

6. Database Setup

If using local MongoDB:

# Make sure MongoDB is installed and running
mongod

If using MongoDB Atlas:

  1. Create a cluster at MongoDB Atlas
  2. Get your connection string and add it to the backend .env file

Project Structure

  • /Backend - Node.js/Express API server
  • /frontend - React/TypeScript client application
  • Both folders have their own package.json and dependencies

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“œ License

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

⭐ Show Your Support

If you found this project helpful, please give it a ⭐ on GitHub!

GitHub stars


Made with πŸ’– by Swayam

Happy Coding! πŸš€

About

Airly is an image-based social media app built with the MERN stack and TypeScript. Users can post images, like, comment, and explore trending posts via a smart ranking algorithm. It features a scalable backend, modern UI with Tailwind CSS, Redux for state management, and secure Cloudinary image handling.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors