Skip to content

JackZong/next-doc

Repository files navigation

NextDoc

License: MIT Next.js Tailwind CSS Better Auth

NextDoc is a modern, clean, and powerful documentation management and collaboration platform built with Next.js 16+. It aims to help teams manage knowledge bases and project documentation more efficiently through a premium UI/UX experience.

English | 简体中文

✨ Features

  • 🔐 Authentication: Powered by Better-Auth, supporting email registration, social login (GitHub/Google), password reset, and mandatory email verification.
  • 📄 Multi-project Management: Create multiple documentation projects with flexible visibility settings (Public, Private, Password protected).
  • 📝 Premium Editing Experience: Built-in Markdown editor with real-time preview to meet all creator needs.
  • 👥 Role-Based Access Control (RBAC): Three-tier roles including Admin, Editor, and Viewer.
  • 🎨 Modern UI: Built with the latest Tailwind CSS 4.0 and Shadcn UI, featuring a sleek and premium Dark Mode.
  • 📧 Email System: SMTP configuration for sending verification emails and password recovery links.
  • 🛠️ Admin Dashboard: Integrated management panel to easily handle users, projects, and global system settings.

🚀 Tech Stack

🛠️ Quick Start

1. Clone the repository

git clone https://github.com/your-username/next-doc.git
cd next-doc

2. Install dependencies

pnpm install

3. Environment Configuration

Copy .env.example to .env and fill in your configurations:

# Core Configuration
BETTER_AUTH_SECRET=your_auth_secret
BETTER_AUTH_URL=http://localhost:3000

# Database (LibSQL/SQLite Example)
DATABASE_URL=file:./dev.db

# Social Login (Optional)
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

# SMTP Email Configuration (For verification and password reset)
SMTP_HOST=
SMTP_PORT=
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=

4. Initialize Database

# Generate migrations
pnpm db:generate

# Push schema to database
pnpm db:push

# Create default admin account
pnpm db:seed

Default Admin Account:

  • Email: admin@example.com
  • Password: Password123

5. Start Development Server

pnpm dev

Open http://localhost:3000 to see the results.

📊 Database Configuration

NextDoc supports multiple database engines through Drizzle ORM. You can choose the database that fits your needs.

1. Switch Database Type

Modify the DB_TYPE variable in your .env file:

  • SQLite (Default): Perfect for small teams or personal use, no extra setup required.
  • MySQL: Suitable for medium to large-scale projects.
  • PostgreSQL: Ideal for projects requiring advanced features or high scalability.

2. Configuration Examples

📂 SQLite

DB_TYPE=sqlite
SQLITE_PATH=./data/nextdoc.db

🐬 MySQL

DB_TYPE=mysql
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=your_user
MYSQL_PASSWORD=your_password
MYSQL_DATABASE=next-doc

🐘 PostgreSQL

DB_TYPE=postgres
POSTGRES_URL=postgresql://user:password@localhost:5432/next-doc

3. Sync Database Schema

After modifying DB_TYPE or updating your models, run the following commands:

# Generate migrations for the specific database
pnpm db:generate

# Push schema change to database
pnpm db:push

4. Visual Management

Run the following command to open Drizzle Studio:

pnpm db:studio

📸 Screenshots

Login

Login Page

Dashboard

Home Preview

Project

Project Page

  • Landing Page: Modern glassmorphism design showcasing public projects.
  • Admin Panel: Manage users, permissions, and system configurations.
  • User Settings: Update profile and security settings (change password).

🚢 Deployment

For production deployment, it is recommended to use PM2 to manage the process.

1. Build the project

pnpm build

2. Start with PM2

The project includes an ecosystem.config.js file for easy deployment.

# Register or update the process in PM2
pm2 start ecosystem.config.js

# To restart after updates
pm2 restart next-doc

# Monitoring logs
pm2 logs next-doc

📄 License

This project is licensed under the MIT License.


💡 If this project helps you, please give us a Star 🌟!

About

NextDoc is a modern, clean, and powerful documentation management and collaboration platform built with Next.js 16+. It aims to help teams manage knowledge bases and project documentation more efficiently through a premium UI/UX experience.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages