A judgment-free space to share your thoughts, receive support, and find peace. SageSpace is a mental health support platform that provides a quiet corner of the internet for reflection and community.
- User Authentication: Secure sign-up and sign-in with email verification and OTP
- Google OAuth: Quick sign-in with Google accounts
- Profile Management: Customize your profile with display names, usernames, and avatars
- Message System: Send and receive supportive messages with privacy controls
- AI-Powered Suggestions: Get thoughtful questions and affirmations from Google Gemini AI
- Privacy Controls: Toggle message acceptance settings with secure session validation
- Modern UI: Beautiful, accessible interface with warm pastel color palette and SaaS-style navigation
- Responsive Design: Optimized for all devices with consistent branding
- Session Management: Secure session-based authentication with NextAuth.js
- Frontend: Next.js 15, React 19, TypeScript
- Styling: Tailwind CSS, shadcn/ui components, custom warm pastel palette
- Authentication: NextAuth.js with Google OAuth and credentials provider
- Database: MongoDB with Mongoose ODM
- Email: Resend for verification emails with custom templates
- AI: Google Gemini for intelligent message suggestions and support
- Forms: React Hook Form with Zod validation schemas
- Utilities: use-debounce for optimized API calls, custom validation functions
- State Management: React Context for authentication state
- Node.js 18+
- MongoDB database (Atlas recommended)
- Google OAuth credentials
- Resend API key
- Google Gemini API key
- Clone the repository:
git clone <repository-url>
cd sagespace- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.localFill in your environment variables in .env.local:
# Database
MONGO_URI=your_mongodb_connection_string
# NextAuth
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3000
# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Email Service
RESEND_API_KEY=your_resend_api_key
# AI Service
GEMINI_API_KEY=your_gemini_api_key- Run the development server:
npm run devOpen http://localhost:3000 to see the application.
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ ├── messages/ # Message management
│ │ ├── profile/ # Profile operations
│ │ └── suggest-messages/ # AI suggestions
│ ├── dashboard/ # User dashboard
│ ├── home/ # Landing page
│ ├── messages/ # Messages page
│ ├── profile/ # Profile management
│ ├── settings/ # User settings
│ ├── signin/ # Sign in page
│ ├── signup/ # Sign up page
│ └── verify/ # Email verification
├── components/ # Reusable UI components
│ └── ui/ # shadcn/ui components
├── context/ # React context providers
├── helpers/ # Utility functions
├── lib/ # Library configurations
├── model/ # MongoDB models
├── schemas/ # Zod validation schemas
├── types/ # TypeScript type definitions
└── validation/ # Custom validation functions
POST /api/signup- User registration with email verificationPOST /api/auth/[...nextauth]- NextAuth authentication (credentials + Google OAuth)POST /api/resend- Resend verification emailPOST /api/verify-code- Verify OTP code
GET /api/profile- Get user profilePUT /api/profile- Update user profilePUT /api/change-password- Change user passwordGET /api/check-username- Check username uniqueness
GET /api/messages- Fetch user messagesPOST /api/messages- Send new messagePUT /api/toggle-messages- Toggle message acceptance (legacy)POST /api/toggle-messages/secure-route- Secure message toggle with session validation
POST /api/suggest-messages- Get AI-powered message suggestions using Google Gemini
- NextAuth.js integration with credentials and Google OAuth
- Email verification with OTP system
- Session-based authentication
- Secure API routes with session validation
- Password hashing and validation
- Modern SaaS-style navigation with session awareness
- Warm pastel color palette for emotional comfort
- Responsive design across all devices
- Consistent branding and typography
- Loading states and error handling
- Google Gemini AI for intelligent message suggestions
- Supportive questions and affirmations generation
- Context-aware responses
- MongoDB with Mongoose for data persistence
- Comprehensive API endpoints with validation
- Error handling and proper HTTP status codes
- Username uniqueness validation
- Backend: Complete with all API endpoints and database models
- Authentication: Fully implemented with NextAuth.js
- Frontend: Modern UI with consistent design system
- AI Integration: Google Gemini integration complete
- Security: Session validation and secure routes implemented
- Fork the repository
- Create a 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 - see the LICENSE file for details.
SageSpace - A safe space for your thoughts.