A modern, full-stack application that allows users to create custom subdomains with emojis. Built with Next.js 15, Prisma, PostgreSQL, and TypeScript.
- User Registration & Login: Secure authentication with session management
- Form Validation: Zod schema validation with React Hook Form
- Password Requirements: Strong password validation with real-time feedback
- Session Management: Secure session tokens with automatic expiration
- Custom Subdomains: Create unique subdomains with custom emojis
- Database Storage: All tenant data stored in PostgreSQL (no Redis dependency)
- User Ownership: Each subdomain is associated with a user account
- Admin Dashboard: Manage all subdomains with user information
- Real-time Validation: Check subdomain availability instantly
- Modern UI: Beautiful, responsive design with Tailwind CSS
- Emoji Picker: Intuitive emoji selection for subdomain branding
- Form Validation: Real-time validation with helpful error messages
- Loading States: Smooth user feedback during operations
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS, Radix UI components
- Database: PostgreSQL with Prisma ORM
- Authentication: Custom session-based auth with better-auth
- Validation: Zod schemas with React Hook Form
- Deployment: Ready for Vercel deployment
-
Clone the repository
git clone <repository-url> cd platforms
-
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env.local
Add your database URL:
DATABASE_URL="postgresql://username:password@localhost:5432/platforms"
-
Set up the database
npx prisma migrate dev npx prisma db seed
-
Start the development server
pnpm dev
- User: Authentication and user management
- Tenant: Subdomain information and ownership
- Session: User session management
- Account: OAuth account connections (for future use)
- Verification: Email verification tokens
model Tenant {
id String @id @default(cuid())
subdomain String @unique
name String?
emoji String
description String?
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
- Email/password authentication
- Session-based auth with secure tokens
- Protected admin routes
- Form validation with Zod
- Password strength requirements
- Sign Up: Create a new account at
/auth/signup
- Sign In: Access your account at
/auth/signin
- Admin Access: Manage subdomains at
/admin
- Authentication Required: Users must be logged in
- Unique Subdomains: Each subdomain is globally unique
- Emoji Branding: Custom emoji for visual identity
- Optional Metadata: Name and description fields
- Automatic Redirect: Redirects to subdomain after creation
- Length: 3-63 characters
- Characters: Lowercase letters, numbers, hyphens only
- Reserved Words: Common subdomains are blocked
- Availability: Real-time availability checking
- Format:
subdomain.yourdomain.com
- Content: Custom emoji, name, description, and creator info
- Status: Active/inactive status management
- FormField: Reusable form input with error handling
- Textarea: Multi-line text input
- EmojiPicker: Custom emoji selection component
- Zod Schemas: Type-safe validation
- React Hook Form: Efficient form state management
- Real-time Feedback: Instant validation feedback
platforms/
βββ app/
β βββ actions.ts # Server actions
β βββ admin/ # Admin dashboard
β βββ api/ # API routes
β βββ auth/ # Authentication pages
β βββ s/[subdomain]/ # Subdomain pages
β βββ subdomain-form.tsx # Subdomain creation form
βββ components/
β βββ ui/ # Reusable UI components
βββ lib/
β βββ auth.ts # Authentication configuration
β βββ auth-utils.ts # Auth utilities
β βββ tenants.ts # Tenant management
β βββ validations/ # Zod validation schemas
β βββ utils.ts # Utility functions
βββ prisma/
βββ schema.prisma # Database schema
- Connect Repository: Link your GitHub repository to Vercel
- Environment Variables: Add your
DATABASE_URL
- Database: Use Vercel Postgres or external PostgreSQL
- Deploy: Automatic deployment on push to main branch
DATABASE_URL="postgresql://..."
NODE_ENV="production"
pnpm dev
- Start development serverpnpm build
- Build for productionpnpm start
- Start production servernpx prisma studio
- Open database GUInpx prisma migrate dev
- Run database migrationsnpx prisma db seed
- Seed database with sample data
# Create a new migration
npx prisma migrate dev --name migration_name
# Reset database
npx prisma migrate reset
# View database
npx prisma studio
The seed script creates test users:
- Alice:
alice@prisma.io
- Bob:
bob@prisma.io
- Authentication: Test sign-up and sign-in flows
- Subdomain Creation: Create subdomains with different names
- Admin Dashboard: Manage subdomains and view user information
- Subdomain Access: Visit created subdomains
- Input Validation: Server-side and client-side validation
- SQL Injection Protection: Prisma ORM with parameterized queries
- Session Security: Secure session tokens with expiration
- Password Security: Strong password requirements
- CSRF Protection: Form-based CSRF protection
- OAuth providers (Google, GitHub)
- Email verification
- Custom domain support
- Analytics dashboard
- API rate limiting
- Advanced tenant customization
- Multi-language support
This project is licensed under the MIT License.