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
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:
- Open the server link first
- Wait about 20–30 seconds for the server to wake up
- Then open and test the frontend application
- Next.js (App Router)
- React
- Tailwind CSS
- Axios
- Node.js
- Express
- TypeScript
- MongoDB (Mongoose)
- Google Gemini API
- Zod validation
- Rate limiting
- Structured error handling
The system follows a simple full-stack architecture:
User → Next.js Frontend → Express API → MongoDB → Gemini AI
- User submits a journal entry from the frontend
- The backend stores the entry in MongoDB
- When analysis is requested, the backend sends the entry to the Gemini AI API
- AI returns emotion, keywords, and a summary
- 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.
- Create journal entries
- Fetch user entries
- AI-powered emotion analysis
- Keyword extraction
- AI-generated summary insights
- Rate-limited AI endpoint
- Clean API architecture
client/ => Next.js frontend
server/ => Express API
git clone https://github.com/yourusername/ai-assisted-journal-system.git
cd ai-assisted-journal-system
cd server
npm install
Create a .env file.
| 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
cd ../client
npm install
npm run dev
Frontend runs at:
http://localhost:3000
POST /api/v1/journal
Body:
{
"userId": "string",
"ambience": "string",
"text": "journal entry text"
}
GET /api/v1/journal/:userId
Returns all entries for the user.
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"
}
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
- Emotion trend visualization
- Redis caching
- Background job processing for AI analysis
- Authentication system

