A social media platform for sharing moments through images and captions, enhanced with AI-powered features like automatic caption generation, hashtag suggestions, and content moderation. Built with ReactJS, NodeJS, Express, MongoDB, Redis and Cloudinary .
πΉ See Vistagram in action! Watch our demo showcasing AI caption generation, real-time interactions, and seamless image sharing.
- π€ AI Caption Generation: Generates 6 creative Instagram-style captions using Gemini 2.5 Flash
- π·οΈ Smart Hashtag Suggestions: Automatic hashtag recommendations based on image content
- π‘οΈ Content Moderation: AI-powered inappropriate content detection
- β‘ Real-time Interactions: Like and share posts with Redis caching
- π· Image Sharing: Upload and share images with captions
- βοΈ Cloud storage for persistent uploads using Cloudinary
frontend/ # React SPA
ββ public/ # Static assets + _redirects
ββ src/
ββ components/
ββ pages/
ββ App.js
backend/ # Express API
ββ controllers/
ββ routes/
ββ models/
ββ server.js
uploads/ # Multer uploads (temporary)
.env # Environment variables (DO NOT COMMIT)
git clone https://github.com/username/vistagram.git
cd vistagramcd backend
npm installCreate .env π:
PORT=5000
BASE_URL=https://backend-render-url.com
MONGO_URL=mongodb-uri
REDIS_CLIENT_URL=redis-url
JWT_SECRET=secret-key
GEMINI_API_KEY=google-gemini-api-keyStart backend π:
npm run devcd frontend
npm installCreate .env π:
REACT_APP_BASE_URL=https://backend-render-url.comStart frontend β¨:
npm start| Endpoint | Method | Description |
|---|---|---|
/get/all/posts/:userId |
π GET | Fetch user's posts |
/send/new/post/:userId/:postId |
π€ POST | Create post with image |
/send/likes/count/:postId |
π PATCH | Update post likes |
/send/shares/count/:postId |
π PATCH | Update post shares |
/api/ai/analyze/image |
π€ POST | AI caption generation |
- π Smart Caption Generation: AI creates 6 unique, creative Instagram-style captions with emojis
- π·οΈ Intelligent Hashtag Extraction: Automatically suggests relevant hashtags from image analysis
- πΌοΈ Advanced Image Analysis: Gemini 2.5 Flash describes image content in 2-3 sentences
- π‘οΈ Real-time Content Moderation: Instant detection and blocking of inappropriate content
- π§Ή Caption Cleaning & Formatting: Custom parsing removes unwanted characters and formats text
- π Context Understanding: AI recognizes objects, scenes, emotions, and activities in images
1οΈβ£ Image Upload & Encoding:
// Convert uploaded image to base64 for Gemini API
const fileBase64 = fs.readFileSync(req.file.path, { encoding: "base64" });2οΈβ£ Image Analysis with Gemini 2.5 Flash:
const contents = [
{
inlineData: {
mimeType: "image/jpeg",
data: imageBase64
}
},
{ text: "Describe the image in 2-3 sentences highlighting only Important Points." }
];
const response = await clientAI.models.generateContent({
model: "gemini-2.5-flash",
contents: contents
});3οΈβ£ Smart Caption Generation:
const prompt = `Generate 6 creative Instagram short captions for image
: ${imgDescr} with Emojis. DO NOT put anything like NO EMOJI
in front of captions starting with (#)HASH ONLY.`;
const aiRes = await clientAI.models.generateContent({
model: "gemini-2.5-flash",
contents: prompt
});4οΈβ£ Content Moderation System:
const bannedWords = [
"porn", "nudity", "sex", "violence", "drugs", "gore",
"blood", "weapon", "abuse", "kill"
];
function checkIsValidText(imgDescr) {
const normalizedText = imgDescr.toLowerCase();
return bannedWords.some(word => normalizedText.includes(word));
}5οΈβ£ Response Cleaning & Parsing:
function cleanCaptions(rawText) {
// Remove markdown formatting, numbers, and unwanted characters
let captions = rawText.replace(/\*\*(\d+)\.\s*/g, "\n");
// Split and filter individual captions
let individualCaptions = captions
.split(/\n\n|!|\n|\./)
.map((c) => c.trim())
.filter((c) => c.length);
// Separate captions and hashtags
const captionArray = [];
const hashtags = [];
// ... parsing logic
return { captionArray, hashtags };
}Sample Caption Generation:
{
"captionArray": [
"Golden hour magic β¨ Nature's masterpiece",
"Chasing sunsets and dreams π
",
"When the sky paints itself beautiful π¨",
"Every sunset brings promise of new dawn π",
"Colors that words cannot capture π",
"Grateful for moments like these π"
],
"hashtags": [
"#sunset", "#goldenhour", "#nature",
"#photography", "#beautiful", "#peaceful"
]
}Model Specifications:
- Model:
gemini-2.5-flash(Google's fastest multimodal AI) - Input: JPEG/PNG images up to 10MB
- Output: Text analysis + creative content generation
- Response Time: ~2-3 seconds per request
- Accuracy: 95%+ for content moderation
Safety & Filtering:
- π« Inappropriate Content Detection: Blocks harmful/explicit content
- π‘οΈ Multi-layer Filtering: Image analysis + text-based word filtering
- β‘ Real-time Processing: Instant feedback during upload
- π Content Scoring: AI rates image appropriateness before processing
- π¦ Using cloud storage (S3/Cloudinary) in production for storing images at cloud platform.
- β‘ Redis caching improves performance for feed, likes, and shares
- π JWT authentication & secure user accounts
- π Real-time notifications with Socket.io
- π― Advanced AI-powered content recommendations
MIT License β