A scalable full-stack web application with authentication, protected routes, and a user dashboard.
Built using React.js, Node.js, Express, and mySQL.
- User Registration
- User Login
- Password Hashing using bcrypt
- JWT-based authentication
- Protected routes
- Fetch logged-in user profile
- Secure API communication
- Logout functionality
- Password hashing
- JWT verification middleware
- Protected backend routes
- Error handling
- React.js (Vite)
- React Router DOM
- Axios
- Context API
- Node.js
- Express.js
- mySQL
- bcryptjs
- jsonwebtoken
assig/ │ ├── frontend/ # React Frontend └── backend/ # Express Backend
cd backend npm install
Create a .env file inside backend/:
PORT=5000
JWT_SECRET=your-super-secret-jwt-key-change-in-production
DB_HOST=localhost
DB_USER=root
DB_PASSWORD= your_password
DB_NAME=assig_db
Run backend: npm run dev
Backend runs at: http://localhost:5000
cd frontend npm install npm run dev
Frontend runs at: http://localhost:5173
Backend runs at: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register user |
| POST | /api/auth/login | Login user |
| GET | /api/auth/profile | Get logged-in user (Protected) |
- User logs in
- Backend generates JWT
- JWT stored in localStorage
- Token sent in Authorization header
- Backend verifies token via middleware
- Modular backend architecture (routes, controllers, middleware)
- Context API for global state management
- Easily extendable to add CRUD features (tasks/notes)
- Can be deployed using:
- Vercel (Frontend)
- Render / Railway (Backend)
- mySQL (Database)
- Add Task CRUD system
- Add Role-based authorization
- Add Refresh Tokens
- Add UI styling (TailwindCSS / Material UI)
- Add Docker support
Vikas Mishra
Full Stack Developer