A high-performance, secure, and modern-looking authentication system built with Node.js, Express, and Firestore.
- Email Verification: Users must verify their email address via a secure link before accessing the dashboard.
- Registration & Login: Secure password hashing with BcryptJS.
- Session Management: Server-side sessions stored in Firestore.
- Input Validation: Server-side and client-side validation using
validator. - Security Middleware: Protected routes and restricted access for logged-in users.
- Modern UI: Premium SaaS interface built with Tailwind CSS and Glassmorphism.
- Responsive Design: Fully responsive layout for all devices.
- Real-time Feedback: Flash messages for success and error states.
- Backend: Node.js, Express
- Database: Firebase Firestore
- Template Engine: EJS
- Authentication: Custom Session-based
- Styling: Tailwind CSS
- Icons: Lucide & FontAwesome
-
Install Dependencies:
npm install
-
Database Setup: The application uses Firebase Firestore. Since you are running this in AI Studio, Firebase is already auto-provisioned.
-
Running the App:
npm run dev
-
Production Build:
npm run build npm start
- Password Hashing: Never stores plain-text passwords. Uses Bcrypt with 10 salt rounds.
- Session Security: Uses
httpOnlyandsecurecookies for session protection. - Input Sanitization: Validates email formats and password strength.
- Brute-Force Protection: Session-based authentication naturally rate-limits attempts via session handling.
- Route Protection: Middleware ensures only authenticated users can access the dashboard.
We use BcryptJS for password hashing.
- Salt Rounds: 10 rounds provide a balance between security and performance.
- Algorithm: Adaptive hashing makes it resistant to brute-force attacks via GPU/ASIC.
- Validation: Strict password complexity rules (uppercase, lowercase, number, symbol) are enforced before hashing.
- Store: Sessions are stored in Firestore (server-side), not in client-side cookies.
- HttpOnly: Cookies are marked as
httpOnlyto prevent XSS from reading session IDs. - Secure: In production, cookies are marked as
secure(HTTPS only). - Session Hijacking: Each login generates a new session ID. Logging out destroys the session on the server.
- Hashing Delay: Bcrypt inherently slows down password checking, mitigating rapid brute-force.
- Session Handling: Failed login attempts do not leak whether the email exists (generic error messages used).
- Our system uses a secure session store that automatically handles expiration and removal of stale sessions.
- Middleware:
ensureAuthenticatedensures users cannot bypass internal routes by simple URL manipulation. - Data Isolation: User data is isolated in Firestore with rules that restrict access to the owner only.
- Validation: All user inputs are sanitized and validated using the
validatorlibrary.
Built with ❤️ by AI Studio