A comprehensive, production-ready SaaS platform built with Next.js 16, designed for multi-tenant blogging, newsletter management, and team collaboration. This project uses a monorepo structure powered by Turborepo.
- Multi-Tenancy: Built-in support for strict data isolation per organization.
- Custom Domains: Map custom domains (e.g.,
blog.example.com) or subdomains to specific organizations. - Advanced Editor: Notion-style block editor powered by Tiptap, supporting local image uploads, markdown shortcuts, and rich text.
- Blog Engine: Optimized rendering for high-performance blog posts with SEO fields (meta title, description).
- Comments System: Threaded comments with spam protection.
- Newsletter: Integrated email subscription forms and management using Resend.
- Role-Based Access Control (RBAC): Granular permissions for Owners, Admins, Editors, and Viewers.
- Billing & Subscriptions: Stripe integration for managing SaaS subscriptions (Free, Pro, Enterprise tiers).
- Media Management: Centralized media handling for blog assets.
- Monitoring: Sentry integration for error tracking and performance monitoring.
-
Framework: Next.js 16 (App Router)
-
Framework: Built with Next.js 14, utilizing Server Components for optimal performance and SEO.
-
Styling: Styled with Tailwind CSS 4.0, removing unused CSS at build time for the smallest bundle size.
-
Database: Powered by Neon (Serverless Postgres), ensuring low-latency data access.
-
ORM: Managed by Prisma, providing type-safe database queries.
-
Authentication: Secured by Clerk, offering seamless user sign-ups and logins.
-
Deployment: Deployed on Vercel, leveraging its global Edge Network for speed. com/)
-
Email: Resend
-
Monorepo Tools: Turborepo
.
├── apps
│ └── web # The main Next.js SaaS application
│ ├── src/app # App Router (Routes & Layouts)
│ │ ├── (auth) # Authentication routes
│ │ ├── dashboard # Tenant dashboard
│ │ ├── sites # Public-facing blog renderer (Custom Domains)
│ │ └── api # Backend API endpoints
│ └── src/components # App-specific components
├── packages
│ ├── db # Shared Database Client (Prisma)
│ ├── ui # Shared Design System & UI Components
│ ├── config # Shared configurations (ESLint, Prettier)
│ └── typescript-config # Shared TSConfig
└── turbo.json # Turborepo pipeline configuration- Node.js 18+ (LTS recommended)
- Docker (optional, for local DB)
- npm or pnpm
- Clone the repository:
git clone https://github.com/biezz-2/blog.git
cd blog- Install dependencies
npm install- Environment Setup Copy the example environment file and configure your secrets.
cp .env.example .env-
Database Setup Push the schema to your database.
# Run from root npm run db:push -w packages/dbNote: Ensure your
DATABASE_URLis set correctly in.env. -
Run Development Server Start the application in development mode.
npm run devThe app should be running at http://localhost:3000.
Run these commands from the root directory:
npm run dev: Start all applications in development mode.npm run build: Build all applications and packages.npm run lint: Lint the codebase.npm run format: Format code with Prettier.
npm run db:generate -w packages/db: Generate Prisma Client.npm run db:studio -w packages/db: Open Prisma Studio to view data.
This project is optimized for deployment on Vercel.
- Connect your repository to Vercel.
- Configure the Root Directory as
apps/web(or let Vercel detect the monorepo). - Add your Environment Variables in the Vercel Project Settings.
- Deploy!
Key variables required for the application to function:
| Variable | Description |
|scan|scan|
| DATABASE_URL | PostgreSQL Connection String |
| NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Clerk Public Key |
| CLERK_SECRET_KEY | Clerk Secret Key |
| STRIPE_SECRET_KEY | Stripe Secret Key |
| NEXT_PUBLIC_APP_DOMAIN | The root domain of your SaaS (e.g., saas.com) |
See .env.production.example for the full list.