Skip to content

Configuration & Environment

Finly utilizes Pydantic BaseSettings in the Python backend to manage application configuration from environment variables and .env files.


Backend Configuration Variables

The following environment variables control core server behavior, database persistence, cryptographic signing, and background services:

Variable Default Value Description
PROJECT_NAME Finly API Application title reported in OpenAPI documentation.
VERSION 1.0.26 Semantic version string.
API_V1_STR /api/v1 URL path prefix for all REST endpoints.
SECRET_KEY Autogenerated secret Secret key used for signing JWT tokens and generating symmetric Fernet encryption keys. Must be kept secret.
ALGORITHM HS256 JWT signing algorithm.
ACCESS_TOKEN_EXPIRE_MINUTES 10080 (7 days) Token lifespan before requiring re-authentication.
DATABASE_URL sqlite:///./data/finly.db SQLAlchemy database connection URI. Points to local SQLite database.
FIRST_SUPERUSER_EMAIL admin@finly.local Email identifier of the initial administrator account.
FIRST_SUPERUSER_PASSWORD admin Initial administrator password generated on fresh boot.
FIRST_SUPERUSER_NAME Administrateur Finly Display name for the default superuser.
CORS_ORIGINS ["http://localhost:3000", ...] Allowed CORS origins for cross-origin frontend requests.
SYNC_INTERVAL_HOURS 12 Default background bank synchronization frequency in hours.
OLLAMA_BASE_URL http://127.0.0.1:11434 Base URL for the local Ollama inference server.
OLLAMA_MODEL qwen2.5:3b Default Ollama language model for the financial assistant.
OPENAI_API_KEY "" Optional API key for OpenAI GPT models.
ANTHROPIC_API_KEY "" Optional API key for Anthropic Claude models.
MISTRAL_API_KEY "" Optional API key for Mistral AI models.
GROQ_API_KEY "" Optional API key for Groq accelerated inference.

Frontend Environment Variables

The Next.js client interface reads the following environment variable at build or runtime:

Variable Default Value Description
NEXT_PUBLIC_API_URL http://127.0.0.1:8000/api/v1 Target URL prefix used by the frontend client (finly-api.ts) to communicate with the FastAPI backend.

Security Best Practices

Generating a Production Secret Key

In production environments, never rely on default secret keys. Generate a cryptographically secure 64-character hexadecimal key using Python:

python -c "import secrets; print(secrets.token_hex(32))"

Assign this value to SECRET_KEY in your environment.

Database Location

By default, the SQLite database is created in the data/ subdirectory relative to the backend execution root (data/finly.db).

  • Ensure the user executing the backend process has read and write permissions to this directory.
  • Exclude data/finly.db from public git repositories (already pre-configured in .gitignore).
  • For continuous backups, take a snapshot of finly.db when the application is idle or execute PRAGMA wal_checkpoint(TRUNCATE) before copying.