A simple web application for user registration and login with a modern UI. The frontend is built with HTML, CSS, and JavaScript, and communicates with a backend API for authentication.
- User registration with name, email, and password
- User login with email and password
- Toggle between registration and login forms
- Responsive, card-style UI
- Stores authentication token in local storage on successful login
user_register/
├── backend/ # Your backend code (API endpoints)
├── frontend/
│ ├── register.html
│ ├── style.css
│ └── script.js
- Node.js (for backend)
- A modern web browser
The backend requires certain environment variables to be set. Create a .env file in your backend directory with the following example content:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT: The port your backend server will run on (default: 5000).MONGO_URI: MongoDB connection string.JWT_SECRET: Secret key for signing JWT tokens.
Note: Adjust variable names as needed to match your backend implementation.
-
Clone the repository:
git clone <your-repo-url> -
Backend:
- Navigate to the
backendfolder. - Create a
.envfile as described above. - Install dependencies and start your backend server (see your backend's README or main file for details).
- Ensure your backend runs on
http://localhost:5000and exposes/api/registerand/api/loginendpoints.
- Navigate to the
-
Frontend:
- Open
frontend/register.htmlin your browser.
- Open
- Click Register to create a new account.
- Click Login to sign in with your credentials.
- On successful login, you will be redirected to
dashboard.html(create this page as needed).
- Edit
style.cssto change the look and feel. - Update API URLs in
script.jsif your backend runs on a different address.
- If you see CORS errors, ensure your backend allows cross-origin requests.
- Make sure the backend server is running before using the frontend.
This project is for educational purposes.