Skip to content

biswajit-debnath/IntelliJournal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ““ AI-Powered Journal App

Next.js React TypeScript Prisma OpenAI Clerk Hacktoberfest

๐ŸŒŸ Overview

AI-Powered Journal App is an intelligent journaling application that combines traditional diary writing with cutting-edge AI analysis. Built with modern web technologies, this app helps users track their thoughts, emotions, and daily experiences while providing insightful AI-driven analysis of their mental state and writing patterns.

โœจ What Makes This Special?

This journal app goes beyond simple text entry by leveraging OpenAI's GPT-4 to provide:

  • ๐Ÿง  Intelligent Mood Analysis - Automatically detects and categorizes your emotional state
  • ๐Ÿ“Š Content Summarization - Generates concise summaries of your entries
  • ๐ŸŽจ Visual Mood Representation - Color-coded mood indicators for quick emotional tracking
  • ๐Ÿค– Q&A System - Ask questions about your past entries and get AI-powered insights
  • ๐Ÿ”„ Real-time Updates - Automatic analysis updates as you write

๐Ÿ› ๏ธ Technology Stack

Frontend

  • โš›๏ธ React 19.1.0 - Modern UI library with latest features
  • ๐Ÿ”ท Next.js 15.4.6 - Full-stack React framework with App Router
  • ๐Ÿ“˜ TypeScript 5.0 - Type-safe development experience
  • ๐ŸŽจ Tailwind CSS 4.0 - Utility-first CSS framework for rapid styling

Backend & Database

  • ๐Ÿ—„๏ธ PostgreSQL (Neon DB) - Serverless PostgreSQL database platform
  • ๐Ÿ”ง Prisma 6.15.0 - Next-generation ORM for type-safe database access
  • ๐ŸŒ Next.js API Routes - Serverless backend functionality
  • โ˜๏ธ Neon DB - Modern serverless Postgres with branching, autoscaling, and bottomless storage

AI & Machine Learning

  • ๐Ÿค– OpenAI GPT-4.1-mini - Advanced language model for analysis
  • ๐Ÿ”— LangChain 0.3.34 - Framework for building AI applications
  • ๐Ÿ“„ Vector Store - Semantic search capabilities for journal entries
  • ๐Ÿ” Embeddings - OpenAI embeddings for intelligent content analysis

Authentication & Security

  • ๐Ÿ” Clerk 6.31.5 - Complete authentication and user management
  • ๐Ÿ‘ค User Profiles - Secure user data management
  • ๐Ÿ›ก๏ธ Protected Routes - Authenticated access control

Development Tools

  • ๐Ÿ“ ESLint - Code linting and quality assurance
  • โšก React Autosave - Automatic content saving functionality
  • ๐Ÿ“Š Zod - Runtime type validation and schema parsing

๐Ÿ—๏ธ Application Architecture

Directory Structure

journal-app/
โ”œโ”€โ”€ ๐Ÿ“ src/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ app/                    # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ page.tsx           # Landing page
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ (dashboard)/       # Protected dashboard routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ layout.tsx     # Dashboard layout with sidebar
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ journal/       # Journal management
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ page.tsx   # Journal list view
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ ๐Ÿ“ [journalId]/ # Individual entry editing
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ api/               # Backend API routes
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ journal/       # Journal CRUD operations
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ question/      # AI Q&A system
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ sign-in/           # Authentication pages
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ sign-up/
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ components/            # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Editor.jsx         # Rich text editor with analysis
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ EntryCard.tsx      # Journal entry preview cards
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Question.jsx       # AI question interface
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ NewEntryCard.tsx   # New entry creation
โ”‚   โ””โ”€โ”€ ๐Ÿ“ utils/                 # Utility functions
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ ai.ts              # AI analysis logic
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ auth.ts            # Authentication helpers
โ”‚       โ”œโ”€โ”€ ๐Ÿ“„ api.ts             # API client functions
โ”‚       โ””โ”€โ”€ ๐Ÿ“„ db.ts              # Database connection
โ”œโ”€โ”€ ๐Ÿ“ prisma/                    # Database schema and migrations
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ schema.prisma          # Database models
โ”‚   โ””โ”€โ”€ ๐Ÿ“ migrations/            # Database migration history
โ””โ”€โ”€ ๐Ÿ“„ package.json               # Dependencies and scripts

๐Ÿ—ƒ๏ธ Database Schema

User Model

model User {
  id        String   @id @default(cuid())
  email     String   @unique
  firstName String?
  lastName  String?
  clerkId   String   @unique
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  journalEntries JournalEntry[]
}

Journal Entry Model

model JournalEntry {
  id        String   @id @default(cuid())
  content   String   @db.Text
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  userId String
  user   User   @relation(fields: [userId], references: [id])
  analysis Analysis?
}

AI Analysis Model

model Analysis {
  id        String   @id @default(cuid())
  mood      String                    # Detected emotional state
  summery   String   @db.Text         # AI-generated summary
  subject   String   @db.Text         # Main topics/themes
  negative  Boolean                   # Negative sentiment indicator
  color     String                    # Mood color representation
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  entryId String       @unique
  entry   JournalEntry @relation(fields: [entryId], references: [id])
}

๐Ÿš€ Key Features

๐Ÿ“ Smart Journal Editor

  • Real-time Writing: Seamless text editing experience
  • Auto-save Functionality: Never lose your thoughts with automatic saving
  • Live Analysis: AI analysis updates in real-time as you write
  • Rich Content Support: Full text formatting capabilities

๐Ÿง  AI-Powered Analysis

  • Mood Detection: Automatically identifies emotional state from writing
  • Content Summarization: Generates concise summaries of entries
  • Subject Identification: Extracts main themes and topics
  • Sentiment Analysis: Determines positive/negative emotional tone
  • Color Coding: Visual mood representation with hex color codes

๐Ÿค– Intelligent Q&A System

  • Natural Language Queries: Ask questions about your journal history
  • Semantic Search: Find relevant entries based on meaning, not just keywords
  • Pattern Recognition: Discover trends and patterns in your writing
  • Contextual Responses: Get answers based on your entire journal history

๐Ÿ‘ค User Management

  • Secure Authentication: Powered by Clerk for robust security
  • User Profiles: Personalized experience for each user
  • Data Privacy: Your journal entries are private and secure

๐Ÿ“ฑ Modern UI/UX

  • Responsive Design: Works perfectly on desktop and mobile
  • Intuitive Navigation: Clean, modern interface design
  • Dashboard Layout: Organized sidebar navigation
  • Visual Feedback: Loading states and real-time updates

๐Ÿ“‹ API Endpoints

Journal Management

  • POST /api/journal - Create new journal entry
  • GET /api/journal/[journalId] - Retrieve specific entry
  • PATCH /api/journal/[journalId] - Update entry content and trigger analysis

AI Features

  • POST /api/question - Ask questions about journal entries
  • Analysis Pipeline - Automatic AI analysis on content updates

๐Ÿ”„ Development Timeline

Based on Git commit history, here's how the application evolved:

๐ŸŽฏ Phase 1: Foundation (Week 1)

  • Initial Setup: Created Next.js app with TypeScript foundation
  • Authentication: Integrated Clerk for secure user management
  • Database: Set up PostgreSQL with Prisma ORM

๐Ÿ—๏ธ Phase 2: Core Features (Week 2)

  • Database Schema: Implemented complete User and JournalEntry models
  • Dashboard Layout: Created responsive sidebar navigation
  • Basic UI: Built entry cards and navigation components

๐Ÿ“ Phase 3: Journal Functionality (Week 2)

  • Journal Display: Implemented journal entry listing and display
  • Entry Creation: Added new journal entry functionality
  • Navigation: Enhanced UI with entry navigation and routing

โœจ Phase 4: Advanced Features (Week 3)

  • Editor Implementation: Built rich text editor with autosave
  • Real-time Updates: Added live content editing capabilities

๐Ÿค– Phase 5: AI Integration (Week 3)

  • AI Analysis: Implemented OpenAI-powered mood and content analysis
  • Subject Detection: Added subject field extraction
  • Visual Analysis: Complete analysis display with color coding

๐Ÿง  Phase 6: Intelligence Layer (Week 4)

  • Enhanced Editor: Improved editing with real-time analysis updates
  • Better Navigation: Streamlined user interface improvements

๐ŸŽฏ Phase 7: Q&A System (Week 4)

  • Intelligent Queries: Implemented AI-powered question answering
  • Semantic Search: Added vector-based journal entry search
  • Knowledge Extraction: Users can now ask questions about their writing patterns

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn
  • Neon DB account (or PostgreSQL database)
  • OpenAI API key
  • Clerk authentication keys

Installation

  1. Clone the repository

    git clone https://github.com/biswajit-debnath/ai-journal-app.git
    cd journal-app
  2. Checkout to dev branch

    git checkout dev
  3. Install dependencies

    npm install
  4. Environment Setup Create a .env.local file:

    # Database (Neon DB)
    DATABASE_URL="postgresql://username:password@ep-example.us-east-1.aws.neon.tech/journal_db?sslmode=require"
    
    # Clerk Authentication
    NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
    CLERK_SECRET_KEY=your_clerk_secret_key
    
    # OpenAI
    OPENAI_API_KEY=your_openai_api_key
  5. Database Setup

    # Generate Prisma client
    npx prisma generate
    
    # Run migrations
    npx prisma migrate dev
  6. Start Development Server

    npm run dev
  7. Access the Application Open http://localhost:3000 in your browser

๐ŸŽฏ Usage Guide

Getting Started

  1. Sign Up/Sign In: Create an account or log in using Clerk authentication
  2. Dashboard Access: Navigate to the main dashboard after authentication
  3. Create Entry: Click "New Entry" to start your first journal entry

Writing & Analysis

  1. Write Freely: Type your thoughts in the editor
  2. Auto Analysis: Watch as AI analyzes your mood and content in real-time
  3. Review Insights: Check the analysis panel for mood, summary, and themes
  4. Auto Save: Your content is automatically saved as you write

Exploring Your Journal

  1. Browse Entries: View all your entries on the main journal page
  2. Edit Entries: Click on any entry to edit and see updated analysis
  3. Ask Questions: Use the Q&A feature to query your journal history
  4. Discover Patterns: Ask about mood trends, recurring themes, or writing patterns

Sample Questions to Try

  • "What were my main concerns this week?"
  • "How has my mood changed over time?"
  • "What topics do I write about most often?"
  • "When was I feeling most positive?"

๐Ÿ”ฎ Future Enhancements

Planned Features

  • ๐Ÿ“Š Analytics Dashboard: Visual charts of mood trends and writing patterns
  • ๐Ÿ“ˆ Goal Tracking: Set and monitor personal development goals
  • ๐ŸŽจ Custom Themes: Personalized UI themes based on mood preferences
  • ๐Ÿ”Š Voice Entries: Speech-to-text for hands-free journaling
  • ๐Ÿ“š Entry Templates: Guided prompts for different types of reflection

Technical Improvements

  • โšก Performance: Enhanced loading speeds and caching
  • ๐Ÿ”’ Security: Advanced encryption for journal content
  • ๐ŸŒ Internationalization: Multi-language support
  • ๐Ÿ”„ Offline Mode: Write entries without internet connection
  • ๐Ÿ“ฆ Export Features: Backup and export journal data

๐Ÿค Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests.

Development Guidelines

  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.

๐Ÿ‘จโ€๐Ÿ’ป Author

Biswajit Debnath

๐Ÿ™ Acknowledgments

  • OpenAI for providing powerful language models
  • Clerk for seamless authentication solutions
  • Neon DB for modern serverless PostgreSQL database platform
  • Prisma for excellent database tooling
  • Next.js team for the amazing framework
  • LangChain for AI application development tools

๐Ÿ’ก Start your intelligent journaling journey today!

This AI-powered journal app is designed to help you better understand your thoughts, emotions, and personal growth patterns. Whether you're looking to track your mental health, reflect on daily experiences, or discover insights about yourself, this app provides the tools and intelligence to make your journaling more meaningful and insightful.

Built with โค๏ธ using modern web technologies and artificial intelligence.

About

Modern journal app powered by OpenAI GPT-4, featuring real-time analysis, mood detection, and semantic search. Next.js + TypeScript.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors