A Local-First, AI-Powered Note Taking App
Second Brain is an intelligent note-taking application designed to capture thoughts in any formatβtext, voice, code, or checklistsβand retrieve them instantly using AI. Unlike traditional apps that rely on keyword matching, Second Brain uses Vector Embeddings and Google Gemini to understand the meaning of your notes, allowing you to find information even if you don't remember the exact words.
Built with a Local-First architecture using Hive, it ensures your data is always accessible, blazing fast, and private on your device.
Capture ideas in the format that fits best:
- Text Notes: Rich text support for daily thoughts.
- β Smart Checklists: Interactive tasks with reordering and strikethrough.
- π» Code Snippets: A full IDE-like experience with syntax highlighting (Atom One Dark theme) and language detection.
- ποΈ Dual-Mode Voice:
- Transcribe: Convert speech to text instantly.
- Record: Save actual audio files (
.m4a) with an in-note playback player.
- Semantic Search: Search by meaning, not just keywords. (e.g., searching for "groceries" will find "milk and eggs").
- Local Embeddings: Vector search logic runs efficiently on-device.
- Google Gemini Integration: Uses Gemini 1.5 Flash for reasoning and data processing.
- Offline-First: Powered by Hive (NoSQL), making it faster than SQL-based apps.
- Material 3 Design: A modern, clean interface with Dark Mode support.
- Gatekeeper Logic: Prevents AI hallucinations by verifying relevance before answering.
| Category | Technology | Usage |
|---|---|---|
| Framework | Flutter | Cross-platform UI |
| Language | Dart | Business Logic |
| State Management | Riverpod 2.6+ | App State & Dependency Injection |
| Local Database | Hive | NoSQL Storage (Replaces SharedPreferences) |
| AI Model | Google Gemini API | RAG & Embeddings |
| Code Editor | Flutter Code Editor | Syntax Highlighting |
| Audio Engine | Record & Audioplayers | Voice Recording & Playback |
The app follows Clean Architecture principles to ensure scalability and testability:
lib/
βββ core/ # Global utilities (Theme, Constants, Errors)
βββ features/
β βββ notes/ # Main Feature
β β βββ data/ # Hive Models, Repositories, Data Sources
β β βββ domain/ # Entities & Abstract Repositories
β β βββ presentation/ # Screens (Editor, List), Providers, Widgets
β βββ chat/ # RAG Chat Interface
β βββ search/ # Vector Search Logic
βββ main.dart # App Entry & DI Setup
- Flutter SDK (
>=3.5.0) - A Google Cloud API Key (for Gemini)
- Clone the repository
git clone https://github.com/Muhammad-Bilal-03/second_brain.git
cd second_brain
- Install dependencies
flutter pub get
- Configure Environment
Create a
.envfile in the root directory and add your API key:
GEMINI_API_KEY=your_api_key_here
- Run the app
flutter run
- Phase 1: Core Foundation (CRUD, Riverpod, Hive Migration)
- Phase 2: Multi-Modal Input (Code Editor, Voice Recorder, Checklists)
- Phase 3: Intelligence (Vector Embeddings, Semantic Search)
- Phase 4: RAG Chatbot (Full conversational interface with notes)
Contributions are welcome! Please fork the repository and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
**Built by Muhammad Bilal** Empowering thoughts with AI.