A full-stack note-taking application with OTP-based authentication and Google OAuth integration. This version includes only the authentication functionality.
- OTP-Based Authentication: Secure email + OTP verification
- Google OAuth: One-click sign-in with Google
- Dashboard: Simple Hello World dashboard (notes functionality coming in next phase)
- Mobile & Web Responsive: Works perfectly on all devices
- Modern UI: Professional design with Tailwind CSS
- React 19 + TypeScript
- Vite (Build tool)
- Tailwind CSS (Styling)
- React Router DOM (Routing)
- Node.js + Express
- TypeScript
- MongoDB + Mongoose
- JWT Authentication
- Nodemailer (Email service)
- Google OAuth
note-taking-app/
├── client/ # Frontend React app
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── assets/ # Images and static files
│ ├── SETUP.md # Client setup guide
│ └── package.json
├── server/ # Backend Node.js app
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── models/ # MongoDB models
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ └── utils/ # Utility functions
│ ├── SETUP.md # Server setup guide
│ └── package.json
└── README.md
- Node.js (v16 or higher)
- MongoDB (local or Atlas)
- Gmail account for email service
cd server
# Install dependencies
npm install
# Create .env file with your configuration
# See server/SETUP.md for the exact contentEnvironment Variables (.env):
# Server
PORT=8000
NODE_ENV=development
# Database
MONGO_URI=mongodb+srv://your-username:your-password@your-cluster.mongodb.net/notes-app?retryWrites=true&w=majority
# JWT
JWT_SECRET=your-super-secret-jwt-key-here
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Email (Gmail)
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
# Client URL
CLIENT_URL=Start the server:
npm run devcd client
# Install dependencies
npm install
# Create .env file with your configuration
# See client/SETUP.md for the exact contentEnvironment Variables (.env):
# API Configuration
VITE_API_BASE_URL=http://localhost:8000/api
# Google OAuth
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
# Sample User Data (for development)
VITE_SAMPLE_USER_NAME=John Doe
VITE_SAMPLE_USER_EMAIL=john.doe@example.com
VITE_SAMPLE_USER_DOB=1990-01-01Start the client:
npm run dev- User fills registration form (Name, Date of Birth, Email)
- Clicks "Get OTP" → Backend sends OTP to email
- If user already exists → Shows message to sign in instead
- User enters OTP on verification page
- Account created → Redirected to Dashboard
- User enters email
- Clicks "Resend OTP" → Receives OTP (with 59-second countdown)
- Enters OTP → Authenticated → Dashboard
- User clicks "Continue with Google" (available on both signup and signin)
- Google OAuth popup appears
- User authenticates → Direct access to Dashboard
POST /api/auth/signup- Send OTP for registrationPOST /api/auth/verify-otp- Verify OTP and authenticatePOST /api/auth/google- Google OAuth authentication
POST /api/notes/create- Create a new noteGET /api/notes/get- Get all notes (with pagination/filters)GET /api/notes/get/:id- Get single note by IDPUT /api/notes/update/:id- Update a noteDELETE /api/notes/remove/:id- Delete a note
/signup- Registration page/signin- Login page/verify-otp- OTP verification page/dashboard- Simple Hello World dashboard (protected)
- Simple Layout: Hello World message with welcome text
- Header: Logo and sign out button
- Sign Out: Logout functionality
- Non-scrollable pages
- Full image background (no blue border)
- Responsive design for mobile and web
- Professional UI matching your mockups
- Email + OTP authentication
- Google OAuth integration
- JWT token management
- Protected routes
- Connected to your existing API endpoints
- Error handling and loading states
- Proper data flow between frontend and backend
- Loading states during API calls
- Error messages for failed operations
- Smooth navigation between pages
- Persistent authentication
cd server
npm run dev # Start development server
npm run build # Build for production
npm start # Start production servercd client
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint- CORS Error: Ensure CLIENT_URL is set correctly in backend .env
- MongoDB Connection: Check MONGO_URI format and network access
- Email Not Sending: Verify Gmail credentials and App Password
- Google OAuth: Ensure client ID is correct and origins are authorized
If you get "The given origin is not allowed for the given client ID" error:
- Go to Google Cloud Console
- Select your project
- Go to "APIs & Services" > "Credentials"
- Find your OAuth 2.0 Client ID and click on it
- Under "Authorized JavaScript origins", add:
http://localhost:5173http://localhost:3000(if using different port)
- Under "Authorized redirect URIs", add:
http://localhost:5173http://localhost:5173/
- Click "Save"
- Use browser dev tools to check network requests
- Check server logs for backend errors
- Verify environment variables are loaded correctly
- Test OTP functionality with real email addresses