This is a simple authentication app that includes login, signup, and form validation functionality. It uses Node.js for the backend and the Provider package for state management in the frontend. The app also implements local data persistence to store user credentials securely.
- Features
- Technologies Used
- Installation
- Backend Setup
- Frontend Setup
- Folder Structure
- API Endpoints
- License
- User registration (Sign Up)
- User login (Sign In)
- JWT-based authentication
- Form validation on both frontend and backend
- Local data persistence using Flutter and Provider
- Secure password storage using bcrypt
- Error handling for invalid login/signup attempts
- Node.js with Express.js for REST API
- MongoDB for user data storage
- Mongoose for MongoDB object modeling
- JWT for user authentication
- Bcrypt.js for password hashing
- Flutter with Provider for state management
- LocalStorage for local persistence
-
Clone the repository:
git clone https://github.com/godzkrishu/UltronAuth--flutter cd simple-authentication-app -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the root directory and add the following:PORT=4000 MONGO_URI=your-mongodb-connection-string JWT_SECRET=your-secret-key
-
Run the server:
nodemon index.js
-
Your server will be running at
http://localhost:4000.
-
Install Flutter on your machine if you haven't already. Follow the official Flutter installation guide.
-
Install dependencies:
flutter pub get
-
Run the Flutter app:
flutter run
ultron/
├── README.md # Project readme file
├── analysis_options.yaml # Flutter analysis rules
├── android/ # Android-specific Flutter project files
├── assets/ # Images, fonts, and other assets
├── build/ # Build outputs
├── devtools_options.yaml # Dev tools configuration
├── ios/ # iOS-specific Flutter project files
├── lib/ # Flutter app source code
│ ├── main.dart # Entry point for the Flutter app
│ ├── screens/ # UI screens like login, signup
│ └── providers/ # State management using Provider
├── linux/ # Linux-specific Flutter project files
├── macos/ # macOS-specific Flutter project files
├── pubspec.lock # Lockfile for Flutter dependencies
├── pubspec.yaml # Flutter dependencies and metadata
├── server/ # Backend Node.js server code
│ ├── models/ # Mongoose models
│ ├── routes/ # API routes for authentication
│ ├── controllers/ # Business logic for handling requests
│ ├── index.js # Entry point for Node.js server
│ └── .env # Environment variables
├── test/ # Unit and widget tests for Flutter
├── ultron.iml # IntelliJ/Android Studio configuration file
├── web/ # Web-specific Flutter project files
├── windows/ # Windows-specific Flutter project files
## API Endpoints
### POST /api/signup
- Registers a new user
- Request Body:
```json
{
"name": "John Doe",
"email": "johndoe@example.com",
"password": "password123"
}- Response:
{ "message": "User created successfully!", "token": "JWT_TOKEN_HERE" }
-
Logs in an existing user
-
Request Body:
{ "email": "johndoe@example.com", "password": "password123" } -
Response:
{ "message": "Login successful!", "token": "JWT_TOKEN_HERE" }