SecureConnect is a secure authentication system built with Next.js, TypeScript, and MySQL. It provides a robust user authentication flow with real-time validation and session management.
- Username, Password, and Confirm Password fields with validation
- Real-time error display under each input field
- Username validation (minimum 8 characters, uniqueness check)
- Password complexity requirements (lowercase, uppercase, special character)
- Password strength indicator
- Confirmation dialog after successful signup
- Automatic redirection to login page after signup
- Username and Password fields with validation
- Real-time error display
- Session management with JWT tokens
- Secure authentication flow
- Personalized welcome message
- Session information display
- Logout functionality
- Next.js 15 (App Router)
- TypeScript
- Tailwind CSS
- MySQL (for user data storage)
- bcryptjs (for password hashing)
- JSON Web Tokens (for session management)
- Node.js (v18 or higher)
- MySQL server
-
Create a MySQL database named
secure_connectby running the provided SQL script:mysql -u root -p < database_setup.sqlOr manually execute these SQL commands in your MySQL client:
CREATE DATABASE IF NOT EXISTS secure_connect; USE secure_connect; CREATE TABLE IF NOT EXISTS users ( id INT AUTO_INCREMENT PRIMARY KEY, username VARCHAR(255) NOT NULL UNIQUE, password VARCHAR(255) NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );
-
Configure your database connection in
.env.local(see below)
Create a .env.local file in the root directory with the following variables:
DB_HOST=localhost
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
DB_NAME=secure_connect
JWT_SECRET=your_jwt_secret_key
- Clone the repository
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open http://localhost:3000 in your browser
/src/app- Next.js App Router pages/src/components- Reusable UI components/src/lib- Utility functions and database connection/src/context- React context for authentication state/src/app/api- API routes for authentication
- Password hashing with bcryptjs
- HTTP-only cookies for JWT storage
- Real-time validation
- Password strength indicator
- Session management
This project is licensed under the MIT License.