A modern, full-stack inspirational quotes application built with Next.js 15, TypeScript, Prisma, and PostgreSQL. Experience beautifully curated quotes with intelligent randomization, fullscreen meditation mode, and personalized preferences in a sleek, responsive interface.
- Intelligent Quote Delivery: Industry-best-practice randomization with 95% reduction in database queries
- Fullscreen Meditation Mode: Immersive experience with screen wake lock to prevent interruptions
- Smart Prefetching: Seamless quote browsing with intelligent background loading
- Perfect Randomization: Fisher-Yates shuffle algorithm ensures true variety without repetition
- Custom Preferences: Rotation intervals, quote sources, themes, and font sizes
- Quote Sources: Choose from preloaded quotes, your custom quotes, favorites, or mixed collection
- Dark/Light/System Mode: Adaptive theme switching with smooth transitions
- Typography Control: Four font size options for comfortable reading
- Mobile-Optimized: Responsive design with hamburger menu and touch-friendly controls
- Instant Loading: Queue-based system for zero-latency quote changes
- Offline Capability: Works without network after initial load
- Performance: 94% reduction in loading times with smart caching
- Secure Authentication: NextAuth.js v5 with encrypted sessions
- Personal Collections: Create, edit, and organize your own quotes
- Favorites System: Save and access your most inspiring quotes
- Data Privacy: Your data stays secure with industry-standard practices
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS, Radix UI components
- Database: PostgreSQL with Prisma ORM
- Authentication: NextAuth.js v5
- State Management: React Query (TanStack Query)
- Animations: Framer Motion
- Deployment Ready: Optimized for Vercel/Neon deployment
- Node.js 18+ and npm/yarn/pnpm
- PostgreSQL database (local or cloud service like Neon)
- Git
-
Clone the repository
git clone https://github.com/simplyrk/inspiro.git cd inspiro -
Install dependencies
npm install
-
Set up environment variables
Copy the example environment file and update with your values:
cp .env.example .env
Update the
.envfile with your database credentials and NextAuth configuration:# Database DATABASE_URL="postgresql://user:password@host/database?sslmode=require" # NextAuth NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET="your-secret-key-here"
Generate a secure secret for NextAuth:
openssl rand -base64 32
-
Set up the database
Run Prisma migrations to create the database schema:
npm run prisma:push
Generate Prisma client:
npm run prisma:generate
(Optional) Seed the database with sample quotes:
npm run seed
-
Start the development server
npm run dev
Open http://localhost:3000 in your browser.
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run prisma:generate- Generate Prisma clientnpm run prisma:push- Push schema changes to databasenpm run prisma:migrate- Run database migrationsnpm run prisma:studio- Open Prisma Studio GUInpm run seed- Seed database with sample quotes from quotes.csv
- Three-Layer Strategy: ID fetching β Client shuffling β Batch loading
- Fisher-Yates Shuffle: Perfect randomization algorithm used by Spotify/Netflix
- Smart Prefetching: Loads next batch when 5 quotes remain
- Offline-First: Works without network after initial load
- Database Queries: 100 quotes = 6 queries (vs. 100 traditional)
- Data Transfer: 77% reduction with intelligent batching
- Memory Management: In-memory cache with automatic cleanup
- Mobile Optimized: Minimal data usage for cellular connections
- NextAuth.js v5: Latest authentication with encrypted sessions
- Environment Isolation: Secure environment variable handling
- SQL Injection Prevention: Parameterized queries with Prisma
- XSS Protection: Sanitized inputs and outputs
inspiro/
βββ app/ # Next.js app directory
β βββ api/ # API routes
β β βββ auth/ # Authentication endpoints
β β βββ favorites/ # Favorites management
β β βββ preferences/ # User preferences
β β βββ quotes/ # Quote delivery system
β β βββ ids/ # Lightweight ID fetching
β β βββ batch/ # Batch quote fetching
β β βββ route.ts # Legacy randomization
β βββ auth/ # Authentication pages
β βββ quotes/ # Main application page
β βββ settings/ # User preferences
βββ components/ # React components
β βββ providers/ # Context providers
β βββ ui/ # Shadcn/ui components
βββ hooks/ # Custom React hooks
β βββ use-optimized-quotes.ts # Smart quote management
βββ lib/ # Utility functions
β βββ auth.ts # NextAuth configuration
β βββ prisma.ts # Database client
β βββ quote-service.ts # Core quote algorithms
βββ prisma/ # Database layer
β βββ schema.prisma # Database schema
β βββ seed.ts # Data seeding script
βββ public/ # Static assets
βββ quotes.csv # 1,570 curated quotes
The application uses the following main models:
- User: User accounts with authentication
- Quote: Both preloaded and user-created quotes
- Favorite: User's favorite quotes
- UserPreferences: Customizable user settings
- Account/Session: NextAuth authentication models
Inspiro implements industry best practices for content delivery:
- 95% Query Reduction: From 100 DB queries to 6 for 100 quotes viewed
- 77% Data Transfer Reduction: Intelligent batching minimizes bandwidth usage
- Client-Side Caching: In-memory quote storage for instant access
- Smart Prefetching: Background loading when approaching queue end
- Database Optimization: Composite indexes and efficient query patterns
POST /api/auth/signup- User registrationPOST /api/auth/[...nextauth]- NextAuth.js handlers
GET /api/quotes/ids- Fetch quote IDs (lightweight, ~5KB)POST /api/quotes/batch- Fetch specific quotes by IDsGET /api/quotes- Legacy endpoint with randomizationPOST /api/quotes- Create custom quote
GET /api/favorites- Get user's favoritesPOST /api/favorites- Add to favoritesDELETE /api/favorites- Remove from favoritesGET /api/preferences- Get user preferencesPUT /api/preferences- Update preferences
- Push your code to GitHub
- Import project to Vercel
- Add environment variables in Vercel dashboard
- Deploy
- Create a Neon account and new project
- Copy the connection strings
- Update environment variables
- Run migrations:
npm run prisma:push
Database Connection Errors
# Verify your DATABASE_URL format
DATABASE_URL="postgresql://username:password@host:5432/database?sslmode=require"
# Test connection
npm run prisma:studioNextAuth Session Issues
# Generate new secret
openssl rand -base64 32
# Clear browser cookies and restart dev server
npm run devBuild Errors
# Clean install
rm -rf node_modules package-lock.json
npm install
# Regenerate Prisma client
npm run prisma:generate
npm run buildQuotes Not Loading
- Check network tab for API errors
- Verify database has been seeded:
npm run seed - Ensure user preferences are set correctly
Performance Issues
- Clear browser cache
- Check if service worker is interfering
- Verify database indexes are created
If you encounter issues:
- Check the GitHub Issues
- Search existing issues before creating new ones
- Provide error messages and browser console logs
- Include your environment details (Node.js version, OS, etc.)
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
For issues, questions, or suggestions, please open an issue in the GitHub repository.