An open API service indexing awesome lists of open source software.

https://github.com/rafat-alam/mdx-editor

MDX Editor is a modern platform for creating and organizing .mdx documents with AI-assisted writing, live preview, and folder management for dynamic, interactive content.
https://github.com/rafat-alam/mdx-editor

nextjs postgresql redux-tookit tailwindcss typescript

Last synced: 6 months ago
JSON representation

MDX Editor is a modern platform for creating and organizing .mdx documents with AI-assisted writing, live preview, and folder management for dynamic, interactive content.

Awesome Lists containing this project

README

          

# MDX Editor ๐Ÿš€๐Ÿ“

**MDX Editor** is a powerful and intuitive platform built to help you **create, organize, and share knowledge** effortlessly โœจ. Whether youโ€™re writing technical documentation, learning notes, or community guides, MDX Editor gives you everything you need in one place ๐Ÿ“š.

## Why MDX Editor? โœจ๐Ÿ’ก

* ๐Ÿ“ **Structured Repositories**
Organize your content using folders and MDX files ๐Ÿ“‚. Treat folders as main topics and files as subtopics to maintain a clean, logical hierarchy ๐Ÿง .

* โœ๏ธ **Rich MDX Editing with Live Preview**
Write Markdown, JSX, and code blocks with real-time previews ๐Ÿ‘€, so you always see exactly what youโ€™re building โšก.

* ๐Ÿค– **AI-Powered Content Generation (RAG)**
Generate accurate and up-to-date documentation using ๐Ÿง โœจ:

* ๐Ÿ“š Repository-wide context
* ๐ŸŒ Web crawling for fresh information
* ๐Ÿ”— URL-based trusted sources
* โšก LLM-only generation for quick drafts

* ๐Ÿ› ๏ธ **Smart Content Refinement**
Improve clarity, structure, and accuracy with AI-assisted refinements โœจ. Enhance specific sections without rewriting the entire document ๐Ÿงน.

* ๐ŸŒ **Share with the Community**
Publish repositories publicly to help others learn ๐Ÿค, or keep them private for personal or internal use ๐Ÿ”’.

* ๐ŸŽ“ **Learn by Exploring**
Browse public repositories ๐Ÿ“–, view combined topics ๐Ÿงฉ, and get inspired by community-driven knowledge ๐ŸŒŸ.

## Built for Everyone ๐Ÿ’ก๐Ÿ‘ฅ

* ๐Ÿ‘จโ€๐Ÿ’ป Developers & engineers
* ๐ŸŽ’ Students & learners
* โœ๏ธ Writers & educators
* ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Teams building internal documentation

**Free to use ๐Ÿ†“, easy to get started ๐Ÿš€, and powerful as you grow ๐Ÿ“ˆ**, MDX Editor transforms ideas into **well-structured, shareable documentation**โ€”faster โšก and smarter ๐Ÿง .

## Future Updates ๐Ÿ”ฎ๐Ÿ› ๏ธ

### v2 ๐ŸŒฑ

1. Profile settings ๐Ÿ‘ค
2. Change name โœ๏ธ
3. Change username ๐Ÿ†”
4. Change email ๐Ÿ“ง
5. Change password ๐Ÿ”’
6. Middleware to Proxy ๐Ÿงฉ
7. OAuth SignIn / SignUp ๐Ÿ”‘
8. Connect RAG ๐Ÿค–

### v3

1. Connect GPT

## Project Structure ๐Ÿ—‚๏ธ

```
db/
โ”œโ”€โ”€ index.ts (function to get _db instance)
โ””โ”€โ”€ schema.ts

public/
โ””โ”€โ”€ team/ (team profile pictures)

src/
โ”œโ”€โ”€ app/
โ”‚ โ”œโ”€โ”€ about (page)
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ api
โ”‚ โ”‚ โ”œโ”€โ”€ ai
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ gemini (route)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ gpt (route) (Comming Soon...)
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ auth
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ [...nextauth] (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ forgot-pass (route)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ signup (route)
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ edit
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ add-file (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ add-folder (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ add-repo (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ remove (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ rename (route)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ save (route)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ set-repo-vis (route)
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ get
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ all-public-repos (route)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ path (route)
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ”œโ”€โ”€ rag
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ repo (route) (Comming Soon...)
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ url (route) (Comming Soon...)
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ web (route) (Comming Soon...)
โ”‚ โ”‚ โ”‚
โ”‚ โ”‚ โ””โ”€โ”€ u/[username] (route)
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ editor (page)
โ”‚ โ”œโ”€โ”€ forgot-pass (page)
โ”‚ โ”œโ”€โ”€ public-repos (page)
โ”‚ โ”œโ”€โ”€ settings (page)
โ”‚ โ”œโ”€โ”€ signin (page)
โ”‚ โ””โ”€โ”€ u/[...path] (page)
โ”‚
โ”œโ”€โ”€ components
โ”‚ โ”œโ”€โ”€ about
โ”‚ โ”œโ”€โ”€ dashboard
โ”‚ โ”œโ”€โ”€ editor
โ”‚ โ”œโ”€โ”€ forgot-pass
โ”‚ โ”œโ”€โ”€ home
โ”‚ โ”œโ”€โ”€ nav-menu
โ”‚ โ”œโ”€โ”€ public-repos
โ”‚ โ”œโ”€โ”€ signin
โ”‚ โ”œโ”€โ”€ signup
โ”‚ โ”œโ”€โ”€ ui
โ”‚ โ”œโ”€โ”€ ui2
โ”‚ โ””โ”€โ”€ themeprovider
โ”‚
โ”œโ”€โ”€ data/
โ”‚ โ””โ”€โ”€ team_members_data.json
โ”‚
โ”œโ”€โ”€ lib/
โ”‚ โ””โ”€โ”€ utils.ts
โ”‚
โ”œโ”€โ”€ module/
โ”‚ โ”œโ”€โ”€ entities/
โ”‚ โ”‚ โ”œโ”€โ”€ node.ts
โ”‚ โ”‚ โ””โ”€โ”€ user.ts
โ”‚ โ”‚
โ”‚ โ”œโ”€โ”€ repo/
โ”‚ โ”‚ โ”œโ”€โ”€ node_repo.ts
โ”‚ โ”‚ โ””โ”€โ”€ user_repo.ts
โ”‚ โ”‚
โ”‚ โ””โ”€โ”€ services/
โ”‚ โ”œโ”€โ”€ auth_service.ts
โ”‚ โ”œโ”€โ”€ helper_service.ts
โ”‚ โ”œโ”€โ”€ node_service.ts
โ”‚ โ””โ”€โ”€ user_service.ts
โ”‚
โ”œโ”€โ”€ store/ (Redux Toolkit)
โ”‚ โ”œโ”€โ”€ authSlice.ts
โ”‚ โ””โ”€โ”€ store.ts
โ”‚
โ””โ”€โ”€ middleware.ts (Edge Runtime)

types/
โ””โ”€โ”€ next-auth.d.ts
```

## API Flow ๐Ÿ”๐Ÿง 

```
Client (UI / Fetch / Axios)
โ†“
Middleware (Edge)
- coarse authentication gate (logged in or not)
- protected route allow/deny
- lightweight session existence check
โ†“
API Route (Controller)
- full authentication check (authoritative)
- input validation
- data normalization
โ†“
Service (Business Logic)
- permissions (ownership, roles)
- workflows
- transactions
- orchestration
โ†“
Repository (Data Access)
- database queries only
โ†“
Database
```

## Local Development Setup ๐Ÿง‘โ€๐Ÿ’ปโš™๏ธ

### Clone Repository ๐Ÿ“ฆ

```bash
git clone https://github.com/rafat-alam/mdx-editor.git
cd mdx-editor
```

### Create `.env` File ๐Ÿ”

```env
# Database connection string
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DB_NAME?sslmode=require"

# NextAuth secret key
NEXTAUTH_SECRET="your_nextauth_secret_here"

# SMTP (Brevo) credentials
BRAVO_USER="your_brevo_username_here"
BRAVO_PASS="your_brevo_password_here"

# Gemini API key
GEMINI_API_KEY="your_gemini_api_key_here"

# Upstash (Redis API)
UPSTASH_REDIS_REST_URL="https://user-redis-0000.upstash.io"
UPSTASH_REDIS_REST_TOKEN="upstash_redis_rest_token_here"
```

### Install Dependencies ๐Ÿ“ฅ

```bash
npm install
```

### Run Drizzle ORM (First Time Only) ๐Ÿ—„๏ธ

```bash
npx drizzle-kit generate
npx drizzle-kit migrate
```

### Run Project (Development) โšก

```bash
npm run dev
```

### Run Project (Production) ๐Ÿš€

```bash
npm run build
npm run start
```

## License (MIT) ๐Ÿ“œโœ…

```
MIT License

Copyright (c) 2025 Rafat Alam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
---