Skip to content

Spyboss/EchoJournal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

54 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 Echo Journal

A modern, AI-powered daily journaling application built with Next.js, Supabase, and Google AI

Echo Journal Supabase TypeScript Tailwind CSS

✨ Features

πŸ“ Core Journaling

  • Text & Voice Input: Write or record your daily thoughts. Voice notes are transcribed locally as a placeholder until you wire an external transcription service.
  • Supabase Storage: Journal entries are persisted in Supabase Postgres and fetched on demand after each create/delete operation.
  • Chronological Display: Clean, organized view of your journal history
  • Secure Authentication: Email/password login with Supabase Auth

πŸ€– AI-Powered Insights

  • Genkit Flows (Opt-In): Google Genkit flows are implemented for sentiment analysis and weekly reflections. They require server-side execution and are currently disabled in the static Cloudflare Pages build.
  • Weekly Reflection Page: Presents placeholder copy while Genkit access is re-enabled. Integrate with an external Genkit runtime to restore summaries and prompts.

🎨 Modern Design

  • Dark/Light Theme: Toggle between themes for comfortable reading
  • Responsive Design: Works perfectly on desktop, tablet, and mobile
  • Minimalist UI: Clean interface that focuses on your content
  • Smooth Animations: Subtle transitions for a polished experience

πŸ”§ Technical Features

  • Supabase Database: Authenticated CRUD access to the journal_entries and profiles tables
  • Voice Recording: Built-in audio recording and playback controls with accessibility affordances
  • Entry Management: Edit, delete, and organize your entries
  • Accessibility Hooks: Screen-reader announcements, skip links, and focus management utilities

πŸš€ Quick Start

Prerequisites

Make sure you have the following installed:

  • Node.js (v18 or higher)
  • npm or yarn
  • Supabase CLI (for database management)

Installation

  1. Clone the repository

    git clone <repository-url>
    cd EchoJournal
  2. Install dependencies

    npm install
  3. Set up environment variables

    Copy .env.example to .env.local and supply the values below. The application falls back to placeholder Supabase credentials if they are missing, but authentication and storage will fail.

    Variable Required? Description
    NEXT_PUBLIC_SUPABASE_URL βœ… Supabase project URL
    NEXT_PUBLIC_SUPABASE_ANON_KEY βœ… Supabase anonymous client key
    GOOGLE_GENAI_API_KEY ⚠️ Optional Required when running Genkit flows locally

    To configure Supabase:

    • Create a Supabase project at Supabase Console
    • Enable Email/Password authentication
    • Create the database tables in the Supabase Setup section
    • Configure redirect URLs under Authentication β†’ URL configuration so Supabase can redirect after sign-in
  4. Start the development server

    npm run dev
  5. Open your browser

    Navigate to http://localhost:9002

πŸ› οΈ Development

Available Scripts

# Development
npm run dev              # Start development server with Turbopack
npm run genkit:dev       # Start Genkit AI development server
npm run genkit:watch     # Start Genkit with file watching

# Building
npm run build            # Build for production (static export)

# Testing
npm run test             # Run Jest tests
npm run test:watch       # Run tests in watch mode
npm run test:ci          # Run full CI test suite

# Code Quality
npm run lint             # Run ESLint
npm run typecheck        # Run TypeScript type checking

Project Structure

EchoJournal/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ weekly-reflection/ # Weekly reflection page
β”‚   β”‚   β”œβ”€β”€ layout.tsx         # Root layout
β”‚   β”‚   └── page.tsx          # Home page
β”‚   β”œβ”€β”€ ai/                    # AI integration
β”‚   β”‚   β”œβ”€β”€ flows/            # AI workflows
β”‚   β”‚   └── ai-instance.ts    # AI configuration
β”‚   β”œβ”€β”€ components/           # React components
β”‚   β”‚   β”œβ”€β”€ ui/              # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ AuthForm.tsx     # Authentication forms
β”‚   β”‚   └── theme-*.tsx      # Theme components
β”‚   β”œβ”€β”€ contexts/            # React contexts
β”‚   β”œβ”€β”€ hooks/               # Custom React hooks
β”‚   └── lib/                 # Utilities and services
β”‚       β”œβ”€β”€ supabase.ts      # Supabase client config
β”‚       β”œβ”€β”€ journalService.ts # Journal API service
β”‚       └── utils.ts         # Utility functions
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ docs/                    # Documentation
└── wrangler.toml           # Cloudflare Pages configuration

πŸ“š Documentation Map

πŸ—„οΈ Supabase Setup

1. Create Supabase Project

  1. Go to Supabase Console
  2. Create a new project
  3. Enable Authentication with Email/Password
  4. Set up your PostgreSQL database

2. Configure Database Schema

-- Create journal_entries table
CREATE TABLE journal_entries (
  id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
  user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
  content TEXT NOT NULL,
  sentiment_score NUMERIC,
  sentiment_summary TEXT,
  title TEXT,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

-- Enable Row Level Security
ALTER TABLE journal_entries ENABLE ROW LEVEL SECURITY;

-- Create policy for users to only access their own entries
CREATE POLICY "Users can only access their own entries" ON journal_entries
  FOR ALL USING (auth.uid() = user_id);

-- Create profiles table for storing user metadata
CREATE TABLE profiles (
  id UUID PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE,
  email TEXT,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);

ALTER TABLE profiles ENABLE ROW LEVEL SECURITY;

CREATE POLICY "Users can view their profile" ON profiles
  FOR SELECT USING (auth.uid() = id);

CREATE POLICY "Users can upsert their profile" ON profiles
  FOR INSERT WITH CHECK (auth.uid() = id)
  TO authenticated;

CREATE POLICY "Users can update their profile" ON profiles
  FOR UPDATE USING (auth.uid() = id)
  TO authenticated;

The application automatically upserts a profile record the first time a user signs in. Confirm that the authenticated role can insert and update the profiles table.

3. Deploy to Cloudflare Pages

# Build the static site
npm run build

# The built files will be in the 'out' directory
# Upload to Cloudflare Pages or connect your GitHub repository
# for automatic deployments

πŸ€– AI Features

Genkit flows are scaffolded in src/ai/flows and can be executed when the app runs with a server runtime (e.g., Next.js server actions or an external Genkit worker). In the static Cloudflare Pages export the flows do not execute.

  • Sentiment Analysis (analyzeSentiment): Accepts a journal entry string and returns { sentiment, summary }. Wire this flow into an API route (e.g., /api/sentiment) and call it from JournalService.analyzeSentiment to enrich entries.
  • Weekly Reflection (analyzeWeeklyReflection): Accepts concatenated entries and returns { summary, prompt }. The weekly reflection page currently surfaces placeholder text until this flow is restored.

Run npm run genkit:dev to start the Genkit dev server locally and test the flows with a valid GOOGLE_GENAI_API_KEY.

🎨 Customization

Themes

The app supports both light and dark themes with a smooth toggle transition. Themes are built with:

  • Tailwind CSS: Utility-first styling
  • CSS Variables: Dynamic theme switching
  • System Preference: Automatically detects user's system theme

Color Palette

  • Primary: Calm blue (#4682B4) for relaxation
  • Secondary: Light gray (#D3D3D3) for backgrounds
  • Accent: Teal (#008080) for interactive elements
  • Text: High contrast for readability

πŸ§ͺ Testing

Test commands are configured in package.json, but the repository does not currently include unit or integration test suites. Add tests alongside new features and execute them with:

# Run all tests (if present)
npm run test

# Type checking and linting used in CI
npm run test:ci

πŸ“± Device Support

  • Responsive Layout: Tailwind CSS utility classes ensure the journal and weekly reflection pages adapt from mobile to desktop viewports.
  • Voice Recording: MediaRecorder-based capture works in browsers that expose microphone APIs. Mobile Safari currently requires user interaction to begin recording.
  • Accessibility Enhancements: Skip links, focus management, and toast announcements improve keyboard and assistive technology support.

πŸ”’ Security

  • Supabase Authentication: Secure user management
  • Row Level Security: Database access control
  • Environment Variables: Secure API key management
  • HTTPS Only: Encrypted data transmission

πŸš€ Deployment

Cloudflare Pages

npm run build
# Upload the 'out' directory to Cloudflare Pages
# or connect your GitHub repository for automatic deployments

Vercel

npm run build
# Deploy to Vercel

🚦 Current Limitations

  • AI features that depend on Genkit (src/ai/flows/*) require a server runtime and do not execute in the static Cloudflare Pages build.
  • JournalService.analyzeSentiment expects a /api/sentiment route, which is not implemented. Connect it to an external service before enabling sentiment enrichment.
  • Voice note transcription currently returns placeholder text from the client-side mock transcription.
  • Real-time Supabase subscriptions are not enabled; entries refresh after explicit CRUD operations.

🀝 Contributing

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

Development Guidelines

  • Code Style: Follow the existing TypeScript and React patterns
  • Testing: Add tests for new features
  • Documentation: Update README for significant changes
  • Commits: Use conventional commit messages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Next.js Team: For the amazing React framework
  • Supabase Team: For the backend infrastructure and database
  • Cloudflare: For the fast and reliable hosting platform
  • Google AI: For the sentiment analysis capabilities
  • Radix UI: For the beautiful component primitives
  • Tailwind CSS: For the utility-first styling approach

πŸ“ž Support

If you have any questions or need help:

  • Documentation: Check the /docs folder
  • Issues: Open an issue on GitHub
  • Discussions: Use GitHub Discussions for questions

Made with ❀️ for better journaling

Start your mindful writing journey today!

Last updated: 2024-11-22

About

AI-powered journaling web app built with Next.js and TypeScript. Helps users reflect, track habits, and gain insights through intelligent summaries and mood analytics.

Topics

Resources

Stars

Watchers

Forks

Contributors