This is a simple signup/login flow with Google integration. The project consists of a backend server and a frontend application, providing user authentication through traditional login and Google OAuth.
- Node.js (v14.x or later)
- MongoDB
- npm (comes with Node.js)
-
Install backend dependencies:
npm install
-
Navigate to the frontend directory and install frontend dependencies:
cd frontend npm install
Create a .env
file in the root directory and add the following environment variables:
[email protected]
EMAIL_PASS=your_email_password
GOOGLE_CLIENT_ID=your_google_client_id
JWT_SECRET=your_jwt_secret
MONGO_URI=your_mongo_db_uri
SESSION_SECRET=your_session_secret
GOOGLE_CLIENT_SECRET=your_google_client_secret
REACT_APP_GOOGLE_CLIENT_ID=your_react_google_client_id
GOOGLE_CLIENT_ID=your_google_client_id
-
Start the backend server:
npm start
-
Start the frontend application:
cd frontend npm start
Open your browser and navigate to http://localhost:3000
.
backend/
: Contains the backend code including routes, models, and configuration.frontend/
: Contains the frontend React application.docs/
: Contains API documentation and other relevant documentation files.
Detailed API documentation can be found in the docs
directory. This includes all available routes and the required request/response formats.
- User registration and login
- Google OAuth integration for login
- Password reset functionality
- Protected routes accessible only by authenticated users
For development, the backend server runs on http://localhost:8080
and the frontend development server runs on http://localhost:3000
. Ensure both servers are running concurrently for full functionality.
To deploy this application, ensure you have set up the environment variables on your production server. Both the backend and frontend can be deployed separately according to the preferred deployment strategy (e.g., Docker, Heroku, AWS).