Second Brain is a full-stack TypeScript monorepo (React frontend + Express backend) for personal knowledge management. Save links, articles, videos and notes; organize them into multiple “brains,” tag and search items, auto-extract URL metadata, and share public collections via unique links. Built with MongoDB, JWT auth, TailwindCSS and TypeScript for a reliable, developer-friendly foundation.
-
Install dependencies
npm install
-
Set up environment
cp packages/server/.env.example packages/server/.env # Edit .env with your MongoDB URI and JWT secret -
Start development
npm run dev
This starts both the server (port 5000) and client (port 3000) concurrently.
second-brain/
├── packages/
│ ├── server/ # Express.js backend
│ │ ├── src/
│ │ │ ├── models/ # MongoDB schemas
│ │ │ ├── routes/ # API endpoints
│ │ │ └── middleware/
│ │ └── package.json
│ └── client/ # React frontend
│ ├── src/
│ │ ├── components/
│ │ ├── contexts/
│ │ └── main.tsx
│ └── package.json
└── package.json # Workspace root
Backend:
- Node.js + Express
- TypeScript
- MongoDB + Mongoose
- JWT Authentication
- bcrypt for password hashing
- Automatic URL metadata extraction
Frontend:
- React 18
- TypeScript
- Tailwind CSS
- React Router
- Axios for API calls
- Lucide React icons
- Authentication: Register/login with JWT
- Multiple Brains: Organize content into different collections
- Content Types: Links, articles, videos, notes
- Auto Metadata: Automatic title/description extraction from URLs
- Safety Moderation: Groq AI checks shared content safety
- Age Restriction: Unsafe content is automatically marked 18+
- Source Health: Shared links show "Source Deleted" if unreachable
- Search & Filter: Full-text search and type filtering
- Tags: Organize items with custom tags
- Sharing: Share brains publicly with unique URLs
- Responsive: Works on desktop and mobile
POST /api/auth/register- Create accountPOST /api/auth/login- Sign in
GET /api/brains- Get user's brainsPOST /api/brains- Create new brainPOST /api/brains/:id/share- Generate share linkGET /api/brains/shared/:token- View shared brain
GET /api/items- Get items (with search/filter)POST /api/items- Add new itemPUT /api/items/:id- Update itemDELETE /api/items/:id- Delete item
# Server (.env)
PORT=5000
MONGODB_URI=mongodb://localhost:27017/second-brain
JWT_SECRET=your-super-secret-jwt-key
GROQ_API_KEY=your-groq-api-key
GROQ_MODERATION_MODEL=llama-3.1-8b-instant
# Client (packages/client/.env)
VITE_API_BASE_URL=/api
VITE_GOOGLE_CLIENT_ID=your-google-client-id# Build for production
npm run build
# Start production server
npm startA Chrome extension is available at packages/extension for one-click capture.
- Go to
chrome://extensions - Enable Developer mode
- Click Load unpacked
- Select
packages/extension
- Start backend:
npm run dev - Open extension popup and set API URL (default
http://localhost:5000/api) - Login with your Second Brain account
- Select default brain
- Click Add to Brain on any webpage