Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Assisted Journal System

A full-stack journal system that stores user entries and analyzes emotional signals using an LLM.

Users can:

  • Write journal entries after immersive nature sessions
  • Analyze emotions using AI
  • View emotional insights from their entries

Live Demo

Frontend (Client) https://ai-assisted-journal-system-theta.vercel.app/

Backend API (Server) https://ai-assisted-journal-system-mk9a.onrender.com/

Note

The backend server is deployed on a free Render instance, which may go to sleep after inactivity.

Before testing the application:

  1. Open the server link first
  2. Wait about 20–30 seconds for the server to wake up
  3. Then open and test the frontend application

Screenshots

Create Journal Entry

Create Entry

AI Emotion Analysis and User Insights

AI Analysis and User Insights


Tech Stack

Frontend

  • Next.js (App Router)
  • React
  • Tailwind CSS
  • Axios

Backend

  • Node.js
  • Express
  • TypeScript
  • MongoDB (Mongoose)

AI Integration

  • Google Gemini API

Validation & Security

  • Zod validation
  • Rate limiting
  • Structured error handling

Architecture Overview

The system follows a simple full-stack architecture:

User → Next.js Frontend → Express API → MongoDB → Gemini AI

Flow

  1. User submits a journal entry from the frontend
  2. The backend stores the entry in MongoDB
  3. When analysis is requested, the backend sends the entry to the Gemini AI API
  4. AI returns emotion, keywords, and a summary
  5. Results are stored and returned to the client

To reduce unnecessary AI usage, analysis results are cached in the database, preventing repeated LLM calls for the same entry.


Features

  • Create journal entries
  • Fetch user entries
  • AI-powered emotion analysis
  • Keyword extraction
  • AI-generated summary insights
  • Rate-limited AI endpoint
  • Clean API architecture

Project Structure

client/   => Next.js frontend
server/   => Express API

Running the Project

1. Clone Repository

git clone https://github.com/yourusername/ai-assisted-journal-system.git
cd ai-assisted-journal-system

2. Setup Backend

cd server
npm install

Create a .env file.

Environment Variables

Variable Description
PORT Server port (default 8000)
MONGO_URI MongoDB connection string
GEMINI_API_KEY Google Gemini API key
CLIENT_URI Frontend URL for CORS configuration

Example:

PORT=8000
MONGO_URI=your_mongodb_uri
GEMINI_API_KEY=your_google_gemini_api_key
CLIENT_URI=http://localhost:3000

Run backend:

npm run dev

Server runs at:

http://localhost:8000

3. Setup Frontend

cd ../client
npm install
npm run dev

Frontend runs at:

http://localhost:3000

API Endpoints

Create Entry

POST /api/v1/journal

Body:

{
  "userId": "string",
  "ambience": "string",
  "text": "journal entry text"
}

Get Entries

GET /api/v1/journal/:userId

Returns all entries for the user.


Analyze Entry

POST /api/v1/journal/analyze

Body:

{
  "text": "journal entry text"
}

Response:

{
  "emotion": "calm",
  "keywords": ["rain", "nature", "peace"],
  "summary": "User experienced relaxation during the forest session"
}

Design Decisions

Emotion analysis is triggered on demand rather than during entry creation.

Benefits:

  • Reduces LLM cost
  • Improves entry creation speed
  • Gives users control over when analysis happens

Future Improvements

  • Emotion trend visualization
  • Redis caching
  • Background job processing for AI analysis
  • Authentication system

About

Full-stack AI journal system demonstrating REST API design, LLM integration, and scalable backend architecture using Node.js, Express, TypeScript, MongoDB, and Next.js.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages