Skip to content

Momento ๐Ÿ“– โ€” An AI-powered digital scrapbook that turns photos & stories into vintage postcard memories. Uses Google Gemini to generate poetic titles, handwritten-style messages, emotion tags and insights. Next.js + Prisma, Vercel-ready.

Notifications You must be signed in to change notification settings

InfiKnight-TGP/Momento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

38 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Momento ๐Ÿ“–

An AI-powered digital scrapbook that transforms your photos and stories into beautiful, vintage-style postcard memories. Momento uses Google's Gemini AI to analyze both images and personal narratives, creating poetic titles and handwritten-style messages that capture the essence of each moment.

โœจ Features

  • ๐Ÿ“ธ Photo Upload: Modern drag-and-drop modal interface for adding memories
  • โœ๏ธ Natural Storytelling: Write about your memories conversationally (minimum 50 characters)
  • ๐Ÿค– AI-Powered Insights: Gemini 2.5 Flash analyzes photos and stories to generate:
    • Poetic, vintage postcard-style titles
    • Warm, handwritten-style descriptions
    • Emotion tags and themes
    • People, locations, and events extraction
  • ๐ŸŽจ Vintage Postcard UI: Interactive flip cards with:
    • Front: Beautiful photo with title overlay
    • Back: Handwritten note with AI-generated message
    • Random rotation angles for authentic scrapbook feel
  • ๐Ÿ“š Scrapbook Gallery: Masonry grid layout with 3D flip animations
  • ๐Ÿ”– Bookmark Button: Floating action button for quick memory creation
  • ๐Ÿ“ฑ Mobile Responsive: Optimized for all screen sizes
  • โ˜๏ธ Cloud Storage: Photos stored securely in Google Cloud Storage
  • ๐Ÿ“„ Pagination: Efficient loading with 20 memories per page

๐Ÿ› ๏ธ Tech Stack

  • Frontend: Next.js 14.2.15, React 18.3.1, TypeScript 5.6.3, Tailwind CSS 3.4.14
  • Backend: Next.js API Routes, Prisma ORM 5.22.0
  • AI: Google Vertex AI with Gemini 2.5 Flash
  • Storage: Google Cloud Storage 7.12.0
  • Database: SQLite (via Prisma, easily swappable to PostgreSQL)
  • Fonts: Custom handwritten fonts (Caveat, Dancing Script)
  • Icons: Lucide React 0.408.0
  • Deployment: Vercel-ready

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • Google Cloud Project with the following APIs enabled:
    • Vertex AI API
    • Cloud Storage API

Installation

  1. Clone the repository
git clone <repository-url>
cd momento
  1. Install dependencies
npm install
  1. Set up environment variables

Create a .env file in the root directory:

# Database (SQLite by default)
DATABASE_URL="file:./prisma/dev.db"

# Google Cloud
GOOGLE_CLOUD_PROJECT="your-project-id"
GOOGLE_CLOUD_STORAGE_BUCKET="your-bucket-name"

# Google Vertex AI
GOOGLE_VERTEX_AI_LOCATION="us-central1"
  1. Set up the database
npm run db:migrate    # Run Prisma migrations
npm run db:studio     # (Optional) Open Prisma Studio
  1. Run the development server
npm run dev

Open http://localhost:3000 to see your scrapbook!

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ api/memories/          # API routes for CRUD operations
โ”‚   โ”‚   โ””โ”€โ”€ route.ts           # GET (with pagination) & POST endpoints
โ”‚   โ”œโ”€โ”€ globals.css            # Global styles + postcard animations
โ”‚   โ”œโ”€โ”€ layout.tsx             # Root layout with metadata
โ”‚   โ””โ”€โ”€ page.tsx               # Home page with scrapbook grid
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ AddMemoryModal.tsx     # Modal for creating new memories
โ”‚   โ”œโ”€โ”€ BookmarkButton.tsx     # Floating bookmark FAB
โ”‚   โ”œโ”€โ”€ PostcardCard.tsx       # 3D flip postcard component
โ”‚   โ”œโ”€โ”€ PhotoUpload.tsx        # [Legacy] Photo upload widget
โ”‚   โ”œโ”€โ”€ StoryInput.tsx         # [Legacy] Story input field
โ”‚   โ”œโ”€โ”€ CreateMemory.tsx       # [Legacy] Old creation form
โ”‚   โ””โ”€โ”€ MemoryGallery.tsx      # [Legacy] Old gallery view
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ ai.ts                  # Gemini AI integration with prompt engineering
โ”‚   โ”œโ”€โ”€ db.ts                  # Prisma client singleton
โ”‚   โ””โ”€โ”€ storage.ts             # Google Cloud Storage upload logic
โ”œโ”€โ”€ types/
โ”‚   โ””โ”€โ”€ memory.ts              # TypeScript type definitions
โ””โ”€โ”€ prisma/
    โ”œโ”€โ”€ schema.prisma          # Database schema (SQLite)
    โ”œโ”€โ”€ dev.db                 # SQLite database file
    โ””โ”€โ”€ migrations/            # Database migration history

๐ŸŽจ How It Works

  1. Click the Bookmark: Floating bookmark button in the top-right corner
  2. Upload a Photo: Drag and drop or browse for an image
  3. Tell Your Story: Write naturally about the moment (minimum 50 characters)
  4. AI Magic: Gemini 2.5 Flash analyzes your photo and story to create:
    • A catchy vintage postcard title (max 6 words)
    • A warm, handwritten-style message (2-3 sentences)
    • Emotion tags, themes, locations, and events
  5. View Your Postcard: Click any postcard to flip and read the AI-generated message
  6. Random Rotations: Each postcard has a unique tilt for an authentic scrapbook feel

๐Ÿค– AI Integration

The application uses Google's Gemini 2.5 Flash model for multimodal analysis (image + text). The AI is prompted with specific instructions to act as a "poetic postcard writer" that creates:

  • Vintage Titles: Short, catchy phrases like "Greetings from Paris!" or "A Perfect Sunset Moment"
  • Handwritten Messages: Warm, personal 2-3 sentence notes that capture the essence and emotion
  • Structured Insights: JSON-formatted tags including:
    • Emotions (peaceful, grateful, joyful, etc.)
    • People and their relationships
    • Life themes (family, travel, celebration)
    • Locations mentioned or detected
    • Events that occurred

Image Processing

  • Images are fetched from Google Cloud Storage
  • Converted to base64 for Vertex AI API
  • Analyzed together with the user's story for context-aware insights

๐Ÿ—„๏ธ Database Schema

The application uses SQLite (easily swappable to PostgreSQL) with a single Memory model:

model Memory {
  id          String   @id @default(cuid())
  imageUrl    String
  story       String
  
  // AI-generated content
  title       String?  @default("Untitled Memory")
  description String?
  
  // AI-extracted insights (stored as JSON strings for SQLite compatibility)
  emotions    String?
  people      String?
  themes      String?
  locations   String?
  events      String?

  // Search and discovery
  embedding   String?
  keywords    String?
  
  createdAt   DateTime @default(now())
  
  @@index([createdAt])
}

Key Changes from Original Design:

  • Switched from PostgreSQL Json fields to String fields for SQLite compatibility
  • Added title and description fields for AI-generated postcard content
  • Data is serialized as JSON strings and parsed in the application layer

๐Ÿšข Deployment

Vercel Deployment (Recommended)

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Configure environment variables in Vercel dashboard:
    • GOOGLE_CLOUD_PROJECT
    • GOOGLE_CLOUD_STORAGE_BUCKET
    • GOOGLE_VERTEX_AI_LOCATION
    • DATABASE_URL (use a production database like PostgreSQL or Supabase)
  4. Deploy!

The application is configured for zero-config deployment with the included vercel.json.

Database for Production

Option 1: Switch to PostgreSQL Update schema.prisma:

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

// Change String fields to Json
emotions    Json?
people      Json?
themes      Json?

Option 2: Use Supabase (PostgreSQL)

  • Create a Supabase project
  • Get your connection string
  • Update DATABASE_URL in environment variables

๐Ÿ“ Scripts

npm run dev         # Start development server
npm run build       # Build for production
npm run start       # Start production server
npm run lint        # Run ESLint
npm run db:migrate  # Run Prisma migrations
npm run db:studio   # Open Prisma Studio

๐ŸŽฏ Recent Major Updates

UI/UX Overhaul

  • โœ… Replaced standard gallery with vintage postcard design
  • โœ… Added 3D flip card animations (front: photo, back: story)
  • โœ… Implemented random rotation angles for authentic scrapbook look
  • โœ… Created floating bookmark button for memory creation
  • โœ… Added handwritten fonts (Caveat, Dancing Script)
  • โœ… Redesigned modal interface with preview and validation

AI Enhancement

  • โœ… Upgraded from Gemini 1.5 Pro to Gemini 2.5 Flash
  • โœ… Changed prompt engineering to generate vintage postcard-style content
  • โœ… Added title generation (max 6 words)
  • โœ… Added poetic description generation (2-3 sentences)
  • โœ… Fixed image processing (base64 conversion)

Database Changes

  • โœ… Migrated from PostgreSQL to SQLite for easier development
  • โœ… Added title and description fields
  • โœ… Changed Json fields to String fields (SQLite compatibility)
  • โœ… Created initial migration 20251104181228_init

API Improvements

  • โœ… Added pagination support (20 memories per page)
  • โœ… Added minimum character validation (50 chars)
  • โœ… Improved error handling and logging
  • โœ… Better response structure with metadata

Dependency Updates

  • โœ… Next.js: 14.2.5 โ†’ 14.2.15
  • โœ… React: 18 โ†’ 18.3.1
  • โœ… Prisma: 5.16.0 โ†’ 5.22.0
  • โœ… Vertex AI: 1.4.0 โ†’ 1.7.0
  • โœ… TypeScript: 5 โ†’ 5.6.3
  • โœ… Added @typescript-eslint plugins

๐Ÿค Contributing

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

๐Ÿ“œ License

This project is licensed under the MIT License.

๐Ÿ”ฎ Future Features

  • ๐Ÿ” Semantic Search: Vector embeddings for finding similar memories
  • ๐Ÿ‘ฅ Multi-user Support: User accounts and authentication
  • ๐Ÿ“Š Emotional Insights: Timeline of emotional patterns
  • ๐Ÿ”— Memory Connections: Link related memories together
  • ๐Ÿ“ฑ Mobile App: Native iOS/Android with React Native
  • ๐ŸŽจ Custom Themes: Multiple postcard styles and color schemes
  • ๐ŸŒ Sharing: Generate shareable postcard links
  • ๐Ÿ“ฅ Export: Download postcards as PDFs or images
  • ๐Ÿ—ฃ๏ธ Voice Notes: Add audio recordings to memories
  • ๐Ÿ“… Calendar View: Browse memories by date

๐Ÿ™ Acknowledgments

  • Google Cloud Platform for Vertex AI and Cloud Storage
  • Vercel for seamless deployment
  • The Next.js team for an amazing framework
  • The Prisma team for excellent database tooling

Made with โค๏ธ using AI and modern web technologies

About

Momento ๐Ÿ“– โ€” An AI-powered digital scrapbook that turns photos & stories into vintage postcard memories. Uses Google Gemini to generate poetic titles, handwritten-style messages, emotion tags and insights. Next.js + Prisma, Vercel-ready.

Resources

Stars

Watchers

Forks

Packages

No packages published