Portfolio
Loading Shiham's portfolio
Preparing the latest projects, skills, and contact paths with a quiet production-ready polish.
Initializing portfolio
Projects · Skills · Contact
Portfolio
Preparing the latest projects, skills, and contact paths with a quiet production-ready polish.
Initializing portfolio
Projects · Skills · Contact
A full-stack authentication app that lets users register, verify email addresses, sign in, recover passwords, and access a protected account dashboard.
This personal project was built to study how a web application can manage the complete account-access lifecycle across a frontend and API. It focuses on coordinating identity data, verification state, browser sessions, recovery tokens, and route access within one MERN application.
The React client manages authentication state with Zustand and sends credentialed Axios requests to an Express API. The API creates users in MongoDB through Mongoose, hashes passwords with bcryptjs, issues a seven-day JWT in an HTTP-only cookie, and checks that cookie before returning the current user.
Email verification uses a six-digit code, while password recovery uses a random one-hour reset token delivered through Mailtrap. The frontend redirects authenticated and unverified users through the appropriate routes and presents a protected dashboard with profile, join-date, last-login, and logout actions.
Related projects
Jan 2026 – Jun 2026
A multi-vendor commerce platform connecting buyers, sellers, and administrators through dedicated storefronts, dashboards, payments, chat, and personalized discovery.
A React/Vite single-page client uses React Router for navigation and Zustand for authentication state. Axios sends credentialed requests to an Express REST API, where controllers use a Mongoose user model backed by MongoDB. JWT cookie middleware protects session checks, and Mailtrap handles verification and password-recovery emails.
A personal full-stack authentication project built with MongoDB, Express.js, React, and Node.js. It demonstrates account registration, email verification, JWT-based sessions, protected routes, and password recovery.
This project was created to explore how a frontend application, backend API, database, browser cookies, and transactional email service work together during authentication.
The application supports account registration, six-digit email verification, login, logout, session restoration after page refreshes, protected routes, forgotten-password requests, and password resets through emailed links.
Advanced-MERN-Stack-Authentication/
├── backend/
│ ├── controllers/
│ ├── db/
│ ├── mailtrap/
│ ├── middleware/
│ ├── models/
│ ├── routes/
│ ├── utils/
│ └── index.js
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── pages/
│ │ ├── store/
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── package.json
│ └── vite.config.js
├── package.json
└── README.md
git clone https://github.com/theShihamAhamed/Advanced-MERN-Stack-Authentication.git
cd Advanced-MERN-Stack-Authentication
npm install
npm install --prefix frontend
Create a .env file in the project root.
PORT=5000
NODE_ENV=development
MONGO_URI=YOUR_MONGODB_CONNECTION_STRING
JWT_SECRET=YOUR_LONG_RANDOM_JWT_SECRET
MAILTRAP_TOKEN=YOUR_MAILTRAP_API_TOKEN
CLIENT_URL=http://localhost:5173
Use your own credentials and secrets. Do not commit the .env file or publish real database, JWT, or email-service credentials.
npm run dev
The backend is configured to run locally at:
http://localhost:5000
Open a second terminal and run:
npm run dev --prefix frontend
The Vite frontend is available locally at:
http://localhost:5173
All authentication routes use the /api/auth prefix.
POST /api/auth/signup
POST /api/auth/login
POST /api/auth/logout
POST /api/auth/verify-email
POST /api/auth/forgot-password
POST /api/auth/reset-password/:token
GET /api/auth/check-auth
The authentication-check endpoint requires a valid JWT cookie.
Integrating authentication emails required coordinating Mailtrap configuration, reusable email templates, verification codes, reset links, and token-expiry values. Separating email delivery into dedicated functions made each authentication workflow easier to manage and highlighted the importance of keeping email messages consistent with backend behaviour.
Maintaining the user session after a page refresh was challenging because the JWT was stored in an HTTP-only cookie and could not be read directly by React. The application solves this by calling a protected authentication-check endpoint during startup and restoring the authenticated user in Zustand from the server response.
Sending the authentication cookie between the React client and Express API required several matching settings. Axios needed credentials enabled, Express CORS needed to allow credentialed requests, the permitted origin needed to match the frontend, and the backend needed to configure the cookie correctly. This demonstrated how browser cookies, CORS, API origins, and route protection work together.
.env.example fileCompleted as a personal authentication-focused learning project. Further improvements would focus on automated testing, configuration management, validation, security hardening, and deployment readiness.
The case-study preview is collapsed. Activate the button to make the full content available.
Aug 2025 – Oct 2025
A marketplace for verified Sri Lankan homestays, supporting guest bookings, host onboarding, admin approval, and test-mode payments.
Oct 2025 – Nov 2025
A full-stack developer Q&A platform where programmers can ask, answer, vote, save questions, explore tags, and generate AI-assisted responses.