This project provides multiple backend implementations (Flask, FastAPI, Java Spring Boot, NestJS, and Go) of a user authentication system with banking functionality, all compatible with a single GUI client.
flask-fastapi-user-auth/
├── fastapi_server/
│ └── server.py # FastAPI server with full banking functionality
├── flask_server/
│ └── server.py # Flask server with basic authentication
├── java_server/ # Java Spring Boot server with full banking functionality
│ ├── src/main/java/com/example/banking/
│ │ ├── controller/ # REST controllers
│ │ ├── service/ # Business logic services
│ │ ├── model/ # Data models
│ │ └── config/ # Security and JWT configuration
│ ├── pom.xml # Maven dependencies
│ └── users.json # User data storage
├── nestjs_server/ # NestJS TypeScript server with full banking functionality
│ ├── src/
│ │ ├── auth/ # Authentication module
│ │ ├── account/ # Account management module
│ │ └── main.ts # Application entry point
│ ├── package.json # Node.js dependencies
│ └── users.json # User data storage
├── go_server/ # Go server with full banking functionality
│ ├── main.go # Main application file
│ ├── go.mod # Go module dependencies
│ └── users.json # User data storage
├── client.py # Universal GUI client for all backends
├── requirements.txt # Python dependencies
└── readme.md # This file
- User registration and login
- JWT token-based authentication
- Password hashing with bcrypt
- Create Account: Create a new bank account with initial balance
- Deposit: Add money to your account
- Withdraw: Remove money from your account (with balance validation)
- Transfer: Send money to another account
- Close Account: Close your account (requires zero balance)
- Account Info: View account details and balance
- Unique account numbers (10-digit UUID-based)
- Balance validation for withdrawals and transfers
- Account ownership verification
- Token expiration handling
- Install Python dependencies:
pip install -r requirements.txt- Install Java 17 or higher
- Install Maven 3.6 or higher
- Navigate to the Java server directory:
cd java_server
mvn clean install- Install Node.js 18 or higher
- Navigate to the NestJS server directory:
cd nestjs_server
npm install- Install Go 1.19 or higher
- Navigate to the Go server directory:
cd go_server
go mod tidycd fastapi_server
python server.pyServer runs on: http://127.0.0.1:5000
cd java_server
mvn spring-boot:runServer runs on: http://127.0.0.1:5000
cd nestjs_server
npm run start:devServer runs on: http://127.0.0.1:5000
cd go_server
go run main.goServer runs on: http://127.0.0.1:5000
cd flask_server
python server.pyServer runs on: http://127.0.0.1:5000 (default Flask port)
python client.pyNote: The client automatically detects and works with any of the five backend servers.
POST /register- Register a new userPOST /login- Login and get JWT tokenGET /protected- Access protected resource
POST /accounts/create- Create a new accountGET /accounts/my-account- Get account informationPOST /accounts/deposit- Deposit moneyPOST /accounts/withdraw- Withdraw moneyPOST /accounts/transfer- Transfer money to another accountPOST /accounts/close- Close account
The GUI client provides:
- User registration and login
- Account creation with initial balance
- Deposit and withdrawal operations
- Money transfers between accounts
- Account closure
- Real-time balance updates
- Error handling and validation
- User data:
users.json - Account data:
accounts.json
- User data:
users.json(BCrypt hashed passwords) - Account data:
accounts.json
- User data:
users.json(BCrypt hashed passwords) - Account data:
accounts.json
All data files are created automatically when the servers start.
- Start any backend server (FastAPI, Java Spring Boot, NestJS, Go, or Flask)
- Run the client application
- Register a new user or login
- Create an account with initial balance (All backends support this)
- Perform banking operations (deposit, withdraw, transfer)
- View account information and balance
| Feature | Flask | FastAPI | Java Spring Boot | NestJS | Go |
|---|---|---|---|---|---|
| Authentication | ✅ | ✅ | ✅ | ✅ | ✅ |
| Banking Operations | ✅ | ✅ | ✅ | ✅ | ✅ |
| JWT Tokens | ✅ | ✅ | ✅ | ✅ | ✅ |
| Password Hashing | ✅ | ✅ | ✅ (BCrypt) | ✅ (BCrypt) | ✅ (BCrypt) |
| Data Storage | JSON | JSON | JSON | JSON | JSON |
| Performance | Good | Excellent | Excellent | Excellent | Excellent |
| Type Safety | ✅ | ✅ | ✅ | ✅ | ✅ |
| Language | Python | Python | Java | TypeScript | Go |
- Each user can have only one active account
- Account numbers are unique 10-digit identifiers
- Transfers require valid recipient account numbers
- Accounts must have zero balance to be closed
- JWT tokens expire after 1 hour
- The client automatically adapts to different backend response formats
- Java Spring Boot and NestJS use BCrypt for enhanced password security
- Choose your preferred technology stack: Python (Flask/FastAPI), Java (Spring Boot), TypeScript (NestJS), or Go