Skip to main content

Prerequisites

Before installing FinAI, ensure your system meets the following requirements:
Python
3.11+
required
FinAI requires Python 3.11 or higher. You can verify your Python version:
python --version
pip
package manager
required
Python package installer (usually included with Python)
Git
version control
For cloning the repository and version management

Installation Steps

1

Clone the Repository

Download the FinAI source code from GitHub:
git clone https://github.com/Montero52/finai-expense-manager.git
cd finai-expense-manager
2

Create Virtual Environment

Create an isolated Python environment to avoid dependency conflicts:
python -m venv venv
venv\Scripts\activate
Your terminal prompt should change to show (venv) when the virtual environment is active.
3

Install Dependencies

Install all required Python packages from the requirements file:
pip install -r requirements.txt
This installs the following core dependencies:
  • Flask 3.1.2 - Web application framework
  • SQLAlchemy 2.0.45 - Database ORM
  • Flask-SQLAlchemy 3.1.1 - Flask integration for SQLAlchemy
  • Flask-Mail 0.10.0 - Email support for password reset
  • pandas 2.3.3 - Data processing and Excel export
  • python-dotenv 1.2.1 - Environment variable management
  • google-generativeai - Google Gemini AI SDK
  • Werkzeug 3.1.5 - WSGI utilities and security
4

Verify Installation

Confirm all packages are installed correctly:
pip list
You should see all packages listed in requirements.txt with their versions.

Database Initialization

FinAI uses SQLite by default with automatic initialization. The database configuration in config.py handles this:
config.py
# Database
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'instance', 'quanlychitieu.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
The application automatically creates the database on first run:
app/__init__.py
# Tự động tạo thư mục instance nếu chưa có
try:
    os.makedirs(app.instance_path)
except OSError:
    pass

db = SQLAlchemy(app)

# Tạo bảng database (nếu chưa có)
with app.app_context(): 
    db.create_all()
The SQLite database file will be automatically created at instance/quanlychitieu.db when you first run the application.

Create Admin Account

Before running the application, create a superuser account for system management:
python create_admin.py
Default Admin Credentials:
Change the default admin password immediately after your first login for security.

Running the Development Server

Start the Flask development server:
python run.py
The application runs with debug mode enabled as configured in run.py:
run.py
from app import app

if __name__ == "__main__":
    app.run(debug=True)
Access the application at: http://127.0.0.1:5000
Debug mode should be disabled in production environments. See the Production deployment guide for details.

Troubleshooting

Virtual Environment Not Activating

If the activation script fails on Windows:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Import Errors

If you encounter module import errors:
pip install --upgrade pip
pip install -r requirements.txt --force-reinstall

Port Already in Use

If port 5000 is occupied, specify a different port:
app.run(debug=True, port=5001)

Next Steps

After setting up your environment, proceed to Configuration to set up environment variables and API keys.

Build docs developers (and LLMs) love