A modern, full-stack TypeScript application foundation with authentication, user management, AI provider integration, and a beautiful UI built with React, Tailwind CSS, and shadcn/ui components.
- Email/password registration and login
- Email verification workflow
- Password reset functionality
- Secure session management with PostgreSQL storage
- Role-based access control (user/admin)
- Support for multiple AI providers (OpenAI, Anthropic, OpenRouter)
- Secure API key management and storage
- Model selection and availability checking
- Generic chat/completion endpoints
- Easy to extend with new providers
- User profiles with Gravatar support
- Account settings and profile editing
- Password change functionality
- Admin user management interface
- Role-based route protection
- Built with React, TypeScript, and Tailwind CSS
- shadcn/ui component library for consistent design
- Dark/light/system theme support
- Fully responsive design
- Accessible components with proper ARIA labels
- User-specific settings with database persistence
- Theme preferences
- Customizable app-specific settings
- Notification preferences
- TypeScript throughout the entire stack
- Hot module reloading in development
- TanStack React Query for server state management
- Drizzle ORM for type-safe database operations
- Express.js backend with middleware
- Vite for fast development and building
- React 18 with TypeScript
- Vite for development and building
- Tailwind CSS for styling
- shadcn/ui for UI components
- TanStack React Query for server state
- Wouter for routing
- React Hook Form with Zod validation
- Node.js with Express.js
- TypeScript with ES modules
- Drizzle ORM for database operations
- PostgreSQL database
- Express sessions with PostgreSQL storage
- Nodemailer for email service
- bcrypt for password hashing
- AI Integrations - OpenAI, Anthropic SDKs
- Node.js 18+
- PostgreSQL database (or Neon Database account)
- SMTP email service credentials
git clone <your-foundation-repo>
cd app-foundation
npm installCreate a .env file:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/myapp"
# Session Secret
SESSION_SECRET="your-super-secret-session-key-here"
# Email Service (for verification emails)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_SECURE="false"
SMTP_USER="your-email@gmail.com"
SMTP_PASS="your-app-password"
SMTP_FROM="Your App <your-email@gmail.com>"
# Frontend URL (for email links)
FRONTEND_URL="http://localhost:5000"# Push schema to database
npm run db:push
# Optional: Open Drizzle Studio to view/manage data
npm run db:studionpm run devYour app will be available at http://localhost:5000
βββ client/ # Frontend React app
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ pages/ # Page components
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions
β β βββ contexts/ # React contexts
βββ server/ # Backend Express app
β βββ middleware/ # Express middleware
β βββ services/ # Business logic services
β βββ utils/ # Server utilities
β βββ auth.ts # Authentication logic
β βββ routes.ts # API routes
β βββ storage.ts # Database operations
βββ shared/ # Shared types and schemas
β βββ schema.ts # Database schema & validation
β βββ version.ts # Version management
βββ scripts/ # Build and utility scripts
- User registers with email/password
- Email verification sent automatically
- User verifies email via link
- Full access granted to authenticated routes
- Sessions persist for 90 days by default
- user: Standard user with access to profile and settings
- admin: Full access including user management
- Supports light, dark, and system themes
- CSS custom properties for easy customization
- Persisted in user settings
- users: Core user data with authentication fields
- user_settings: Flexible settings with AI provider configs and API key storage
- Define database tables in
shared/schema.ts - Add API routes in
server/routes.ts - Create storage methods in
server/storage.ts - Build frontend pages and components
- Add routes in
client/src/App.tsx
The foundation includes AI provider infrastructure:
- Configure providers in settings:
POST /api/settings - Get available providers:
GET /api/ai/providers - Fetch models:
GET /api/models/:provider - Send chat requests:
POST /api/ai/chat - Frontend components:
AIProviderCard,AIProviderContext
- Modify
client/src/index.cssfor global styles - Customize theme colors in CSS custom properties
- Add new shadcn/ui components with
npx shadcn-ui add <component>
All environment variables are documented in the .env example above.
Make sure to set production values for deployment.
npm run build- Set all
.envvariables in your hosting environment - Update
FRONTEND_URLto your production domain - Use a strong
SESSION_SECRET - Configure proper SMTP credentials
MIT License - feel free to use this foundation for your projects!
This is a foundation template - fork it and make it your own!
Built with β€οΈ using modern web technologies