Architecture
Featul is built as a Turborepo monorepo with the following structure:- apps/app - Main Next.js 16 application (App Router, Turbopack)
- apps/web - Marketing and documentation site
- packages/api - Type-safe API layer using jstack over Hono
- packages/auth - Authentication with better-auth
- packages/db - PostgreSQL database with Drizzle ORM
- packages/ui - Shared component library
System Requirements
Ensure your hosting environment meets these minimum requirements before deploying.
Runtime
- Node.js: >= 20.0.0 (specified in root
package.json) - Package Manager: Bun 1.2.21+ (recommended) or npm
- Database: PostgreSQL 14+ (Neon serverless compatible)
Infrastructure
- PostgreSQL database (recommended: Neon, Supabase, or AWS RDS)
- Redis instance (Upstash for rate limiting and caching)
- Object storage (optional, for file uploads)
- Email service (for authentication and notifications)
Deployment Options
Featul supports multiple deployment platforms:Vercel
Deploy with zero configuration using Vercel’s platform
Cloudflare
Deploy using Cloudflare Workers with Wrangler
Pre-Deployment Checklist
Before deploying to production:Configure Environment Variables
Set up all required environment variables including database credentials, authentication secrets, and API keys. See Environment Variables.
Set Up Database
Provision a PostgreSQL database and run migrations using Drizzle. See Database Setup.
Configure Authentication
Set up OAuth providers (Google, GitHub) and configure authentication domains for multi-tenant support.
Multi-Tenancy Considerations
Featul implements multi-tenant architecture with subdomain routing:- Pattern:
{workspace-slug}.featul.com - Reserved subdomains:
www,app,featul,staging - Custom domains supported via DNS verification
- Cross-subdomain cookie authentication
- Wildcard SSL certificates (
*.yourdomain.com) - Dynamic subdomain routing
- Cross-subdomain cookie configuration
Build Process
Featul uses Turborepo for optimized builds:- Turborepo builds packages in dependency order
- Shared packages (
@featul/db,@featul/auth,@featul/api) build first - Applications (
apps/app,apps/web) build last - Next.js optimizes and bundles the application
Production Optimizations
For production deployments:- Caching: Configure Redis for session storage and rate limiting
- CDN: Use Vercel Edge Network or Cloudflare CDN for static assets
- Database: Enable connection pooling with Neon serverless or PgBouncer
- Monitoring: Configure Sentry for error tracking (pre-configured)
- Analytics: Set up analytics and observability tools
Security Considerations
- Use environment variables for all secrets
- Enable HTTPS/TLS for all connections
- Configure CORS for API endpoints
- Set secure cookie policies (
httpOnly,secure,sameSite) - Implement rate limiting with Upstash Redis
- Use strong random values for
BETTER_AUTH_SECRET - Configure Content Security Policy (CSP) headers
Next Steps
Environment Variables
Configure required environment variables
Database Setup
Set up PostgreSQL and run migrations
Deploy to Vercel
Deploy your application to Vercel
Deploy to Cloudflare
Deploy using Cloudflare Workers