A modern, multi-tenant blog platform built with Next.js 15, Clerk authentication, and Drizzle ORM. Each organization gets its own dedicated blog space with custom subdomains.
- π’ Multi-tenant Architecture: Each organization has its own blog space
- π Authentication & Authorization: Powered by Clerk
- π Blog Creation & Management: Intuitive editor for creating and managing posts
- π Custom Subdomains: Each organization gets a unique subdomain (e.g.,
org-name.localhost:3000) - π± Responsive Design: Beautiful, modern UI that works on all devices
- β‘ Fast Performance: Built with Next.js 15 and optimized for speed
- π¨ Modern UI: Clean, professional design with smooth animations
- Framework: Next.js 15 with App Router
- Authentication: Clerk
- Database: PostgreSQL with Drizzle ORM
- Styling: Tailwind CSS
- UI Components: Custom components with Radix UI primitives
- TypeScript: Full type safety
- Node.js 18+
- pnpm (recommended) or npm
- PostgreSQL database
- Clerk account
- Clone the repository:
git clone <repository-url>
cd my-app- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env.localFill in your environment variables:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/Bloghub"
# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
# For development subdomains
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/- Set up the database:
# Push the schema to your database
pnpm db:push
# (Optional) Open Drizzle Studio to view/edit data
pnpm db:studio- Run the development server:
pnpm devOpen http://localhost:3000 to view the application.
my-app/
βββ app/
β βββ (root)/ # Main app routes (authenticated)
β β βββ layout.tsx # Root layout with Clerk provider
β β βββ page.tsx # Home page with dashboard
β β βββ org/
β β βββ [slug]/
β β βββ page.tsx # Blog creation page
β β βββ blogs/ # Blog listing page
β β βββ action.ts # Server actions
β βββ (subdomain)/ # Public blog routes
β β βββ layout.tsx # Subdomain layout
β β βββ s/
β β βββ [subdomain]/
β β βββ page.tsx # Public blog page
β βββ api/
β β βββ blogs/
β β βββ route.ts # API for fetching blogs
β βββ components/
β βββ nav.tsx # Navigation component
β βββ dashboard.tsx # Organization dashboard
β βββ loading.tsx # Loading component
βββ components/
β βββ ui/ # Reusable UI components
βββ db/
β βββ index.ts # Database connection
β βββ schema.ts # Database schema
βββ lib/
βββ utils.ts # Utility functions
- Sign Up/In: Use Clerk authentication to create an account
- Create Organization: Create an organization in Clerk
- Create Blog Posts: Navigate to your organization's blog creation page
- Manage Posts: View and manage all your organization's posts
- Public Blog: Your blog is automatically available at
your-org-slug.localhost:3000
- Visit any organization's public blog at
org-slug.localhost:3000 - Read posts without authentication
- Clean, responsive reading experience
CREATE TABLE blogs (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
title VARCHAR(80) NOT NULL,
body TEXT NOT NULL,
org_id TEXT NOT NULL
);pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLintpnpm db:push- Push schema changes to databasepnpm db:studio- Open Drizzle Studiopnpm db:generate- Generate migrationspnpm deploy:check- Check deployment readiness
- New Pages: Add routes in the
app/directory - Database Changes: Modify
db/schema.tsand runpnpm db:push - API Endpoints: Add routes in
app/api/ - Components: Create reusable components in
app/components/
For detailed deployment instructions, see DEPLOYMENT.md which includes:
- Complete step-by-step deployment guide
- Database setup options (Vercel Postgres, Neon, Supabase, Railway)
- Environment variable configuration
- Custom domain and wildcard subdomain setup
- Troubleshooting tips
Run the deployment readiness check:
pnpm deploy:checkThis will verify:
- Environment variables are configured
- Dependencies are installed
- Git status is clean
- Click the "Deploy with Vercel" button above
- Set up required environment variables (see .env.example)
- Configure your database
- Set up Clerk authentication
- Add wildcard domain for subdomains
The app can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
See DEPLOYMENT.md for platform-specific instructions.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For detailed contribution guidelines, see CONTRIBUTING.md
MIT License - see LICENSE file for details
For support, please open an issue in the GitHub repository or contact the development team.
- π Deployment Guide
- π€ Contributing Guide
- π Environment Variables