Skip to content

Latest commit

 

History

History
202 lines (172 loc) · 9.71 KB

File metadata and controls

202 lines (172 loc) · 9.71 KB

🧠 BrainLog

BrainLog is a full-stack productivity tool that helps developers capture, organize, and revise their learning history effortlessly.

While solving problems, reading blogs, or having insightful discussions online, we often lose track of what we learned. BrainLog solves this by automatically capturing important links and storing them in a structured system, allowing users to revisit and revise their knowledge anytime.

The system uses a Chrome Extension to capture URLs (title, link, timestamp, and category) with a single click and sends them to a backend powered by NestJS. All data is securely stored in PostgreSQL using Prisma ORM. A React + Tailwind dashboard then provides a powerful revision interface where users can review their learning across different time ranges such as daily, weekly, monthly, yearly, or custom ranges.

BrainLog is designed to function as a personal knowledge log for developers, ensuring that valuable insights, problem-solving sessions, and learning resources are never forgotten.


🚀 Features

  • One-Click Capture Save any webpage instantly using the Chrome extension.

  • 🗂 Custom Categories Organize links into categories like DSA, Blogs, Work, Ideas, or create your own.

  • 📅 Flexible Revision System Review saved items by:

    • Day
    • Week
    • Month
    • Year
    • Custom date range
  • Revision Tracking Mark items as revised to track what you've already reviewed.

  • 🔐 Authentication Secure user accounts using JWT-based authentication.

  • 🐳 Dockerized Environment Easy development setup with Docker and Docker Compose.

Tech Stack

Part Technology Why
Backend Node.js + NestJS + Prisma Structured, TypeScript-first, scalable
Frontend React + Vite + Tailwind CSS Fast dev experience, component-based UI
Database PostgreSQL (via Docker) Reliable, easy to move to cloud later
Extension Plain HTML/CSS/JS No build step needed, works directly in Chrome

Project Structure

revision-tracker/
│
├── README.md
│
├── backend/
│   ├── docker-compose.yml
│   ├── .env
│   ├── .env.example
│   ├── package.json
│   ├── tsconfig.json
│   │
│   ├── prisma/
│   │   ├── schema.prisma           ← defines User + Link models, relations
│   │   └── migrations/             ← auto-generated by Prisma, never edit manually
│   │       └── 20260101_init/
│   │           └── migration.sql
│   │
│   └── src/
│       ├── main.ts                 ← starts the server, sets port, enables CORS
│       ├── app.module.ts           ← root module, imports all feature modules
│       │
│       ├── auth/
│       │   ├── auth.module.ts          ← wires together auth controllers/services/strategies
│       │   ├── auth.controller.ts      ← routes: POST /auth/register, POST /auth/login,
│       │   │                              GET /auth/google, GET /auth/google/callback,
│       │   │                              GET /auth/github, GET /auth/github/callback
│       │   ├── auth.service.ts         ← logic: validate password, create JWT, find-or-create OAuth user
│       │   │
│       │   ├── strategies/
│       │   │   ├── jwt.strategy.ts         ← reads Bearer token from every request header,
│       │   │   │                              decodes it, attaches user to request object
│       │   │   ├── local.strategy.ts       ← validates email + password on login
│       │   │   ├── google.strategy.ts      ← handles Google OAuth2 redirect + callback
│       │   │   └── github.strategy.ts      ← handles GitHub OAuth redirect + callback
│       │   │
│       │   ├── guards/
│       │   │   ├── jwt-auth.guard.ts        ← protects routes — returns 401 if no valid token
│       │   │   ├── local-auth.guard.ts      ← used only on the login route
│       │   │   ├── google-auth.guard.ts     ← used on /auth/google route
│       │   │   └── github-auth.guard.ts     ← used on /auth/github route
│       │   │
│       │   └── dto/
│       │       ├── register.dto.ts          ← { email, password } with validation rules
│       │       └── login.dto.ts             ← { email, password }
│       │
│       ├── users/
│       │   ├── users.module.ts         ← wires users feature
│       │   ├── users.service.ts        ← findById, findByEmail, findOrCreateOAuthUser, create
│       │   └── users.controller.ts     ← GET /users/me (returns logged-in user's profile)
│       │
│       └── links/
│           ├── links.module.ts         ← wires links feature
│           ├── links.controller.ts     ← all routes protected by JwtAuthGuard:
│           │                              POST   /links
│           │                              GET    /links
│           │                              GET    /links/weeks
│           │                              GET    /links/stats
│           │                              PATCH  /links/:id
│           │                              DELETE /links/:id
│           ├── links.service.ts        ← all DB queries scoped to req.user.id
│           └── dto/
│               ├── create-link.dto.ts      ← { url, title, category, customLabel }
│               └── filter-links.dto.ts     ← { week?, year?, category?, revisited? }
│
├── frontend/
│   ├── package.json
│   ├── vite.config.ts
│   ├── tailwind.config.ts
│   ├── tsconfig.json
│   ├── index.html
│   │
│   └── src/
│       ├── main.tsx                ← mounts React app into index.html
│       ├── App.tsx                 ← sets up React Router, protected vs public routes
│       │
│       ├── pages/
│       │   ├── LoginPage.tsx           ← email/password form + Google/GitHub buttons
│       │   ├── RegisterPage.tsx        ← registration form
│       │   └── DashboardPage.tsx       ← main page: stats + filters + link list
│       │
│       ├── components/
│       │   ├── LinkCard.tsx            ← single link: checkbox, title, url, category pill, delete
│       │   ├── FilterBar.tsx           ← week dropdown + category chips + status chips
│       │   ├── StatsBar.tsx            ← total / revisited / pending / categories count
│       │   ├── Navbar.tsx              ← app name + logged-in user email + logout button
│       │   └── ProtectedRoute.tsx      ← wraps dashboard route, redirects to /login if no token
│       │
│       ├── hooks/
│       │   ├── useLinks.ts             ← fetches links, handles filter state, toggle revisited
│       │   └── useAuth.ts              ← login, logout, register, stores token, reads current user
│       │
│       ├── api/
│       │   ├── links.ts                ← all fetch() calls for links endpoints
│       │   └── auth.ts                 ← all fetch() calls for auth endpoints
│       │
│       └── context/
│           └── AuthContext.tsx         ← global auth state (user, token, isLoggedIn)
│                                          wraps entire app so any component can access it
│
└── extension/
    ├── manifest.json               ← permissions: activeTab, scripting
    │                                  declares popup and background script
    ├── popup/
    │   ├── popup.html              ← login check → save form with category picker
    │   └── popup.js                ← checks if token stored, reads current tab,
    │                                  sends POST /links with Bearer token in header
    ├── background/
    │   └── background.js           ← service worker, minimal for now
    └── icons/
        ├── icon16.png
        ├── icon48.png
        └── icon128.png

How the Parts Talk to Each Other

Chrome Extension
    │
    │  POST /links (save a new link)
    ▼
NestJS Backend  ──── Prisma ORM ────► PostgreSQL (Docker)
    ▲
    │  GET /links?week=12&category=dsa (fetch with filters)
    │  PATCH /links/:id (mark as revisited)
    │
React Frontend
---

## 🎯 Vision

BrainLog aims to become a **developer’s second brain**, helping users capture knowledge instantly and build a long-term learning memory system.

Instead of forgetting what you solved or learned last week, BrainLog ensures every valuable insight is logged, organized, and easy to revisit.

---

## 📌 Status

Currently under active development.

Copyright (c) 2026 Himanshu. All rights reserved.

All Rights Reserved.

No part of this software or its associated files may be copied, reproduced, distributed, or transmitted in any form or by any means, including photocopying, recording, or other electronic or mechanical methods, without the prior written permission of the author.

This code is provided for demonstration purposes only and does not grant any license to use, modify, or redistribute the source code for personal or commercial projects.