Skip to content

Repository files navigation

Simple Authentication App

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.

Table of Contents

Features

  • 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

Technologies Used

Backend

  • 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

Frontend

  • Flutter with Provider for state management
  • LocalStorage for local persistence

Installation

Backend Setup

  1. Clone the repository:

    git clone https://github.com/godzkrishu/UltronAuth--flutter
    cd simple-authentication-app
  2. Install dependencies:

    npm install
  3. Set up environment variables: Create a .env file in the root directory and add the following:

    PORT=4000
    MONGO_URI=your-mongodb-connection-string
    JWT_SECRET=your-secret-key
  4. Run the server:

    nodemon index.js
  5. Your server will be running at http://localhost:4000.

Frontend Setup

  1. Install Flutter on your machine if you haven't already. Follow the official Flutter installation guide.

  2. Install dependencies:

    flutter pub get
  3. Run the Flutter app:

    flutter run

Folder Structure

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"
    }

POST /api/login

  • Logs in an existing user

  • Request Body:

    {
      "email": "johndoe@example.com",
      "password": "password123"
    }
  • Response:

    {
      "message": "Login successful!",
      "token": "JWT_TOKEN_HERE"
    }

About

Ultron Authentication app is authentication based app

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages