Real-Time Collaborative Docs (Inspired by Google Docs)
image
image
image
image
image
image
image

A fully-featured, production-grade real-time document collaboration platform inspired by Google Docs — built with Next.js 15, TypeScript, Pusher, and Cloud-native architecture.Focused on scalability, performance, DX, and modern SaaS engineering.

Features

Real-time messaging using Pusher
Live document editing (Google Docs–style)
Online/offline presence indicators
Message read receipts
Group chats & one-on-one messaging
File & image attachments via Cloudinary CDN
Rich text editing + formatting tools
Message notifications & alerts
Production-ready landing page
Professional custom artwork
Real-time event messages via Discord
Monitoring dashboard
Secure payments using Stripe
Users can upgrade to a PRO plan
Beautiful UI components via shadcn/ui
Optional authentication via Clerk
100% TypeScript codebase
Scale-tested architecture
Many more advanced SaaS features
Responsive Designs
File & Folder
Production Code
server.ts
import { NextRequest } from 'next/server';

export const middleware = async (req: NextRequest) => {
  let user = undefined;
  let team = undefined;
  const token = req.headers.get('token');

  if(req.nextUrl.pathname.startsWith('/auth')) {
    user = await getUserByToken(token);

    if(!user) {
      return NextResponse.redirect('/login');
    }
  }

  if(req.nextUrl.pathname.startsWith('/team')) {
    user = await getUserByToken(token);

    if(!user) {
      return NextResponse.redirect('/login');
    }

    const slug = req.nextUrl.query.slug;
    team = await getTeamBySlug(slug); // [!code highlight]

    if(!team) { // [!code highlight]
      return NextResponse.redirect('/'); // [!code highlight]
    } // [!code highlight]
  } // [!code highlight]

  return NextResponse.next(); // [!code highlight]
}

export const config = {
  matcher: ['/((?!_next/|_static|_vercel|[\w-]+\.\w+).*)'], // [!code highlight]
};
server.ts
import { createMiddleware, type MiddlewareFunctionProps } from '@app/(auth)/auth/_middleware';
import { auth } from '@/app/(auth)/auth/_middleware'; // [!code --]
import { auth } from '@/app/(auth)/auth/_middleware'; // [!code ++]
import { team } from '@/app/(team)/team/_middleware';

const middlewares = {
  '/auth{/:path?}': auth,
  '/team{/:slug?}': [ auth, team ],
};

export const middleware = createMiddleware(middlewares); // [!code focus]

export const config = {
  matcher: ['/((?!_next/|_static|_vercel|[\w-]+\.\w+).*)'],
};
Tech Stack
/svg/react.svg
/svg/docker.svg
/svg/nextjs.svg
/svg/sql.svg
/svg/github.svg
/svg/nextjs.svg
/svg/nextjs.svg
System Design & Docker