Base Setup
Credentials
Managing sensitive information like passwords and API keys securely is crucial.
- All password/credentials/access data is stored in an
.env
file located within aconfig/
folder. - This
config/
folder (and specifically the.env
file) should be included in your project’s.gitignore
file to prevent accidental commits to version control..gitignore example # Ignore sensitive config filesconfig/.env - Credentials are loaded into the application environment at runtime using the
dotenv
library (or similar). - Rationale for
.env
: While environment variables are standard, using an.env
file allows credentials to be easily managed and shared across different development machines if needed (though care must be taken). ENV_PATH
Variable: To avoid issues with relative paths when locating the.env
file, the application requires an environment variable namedENV_PATH
to be set. This variable must contain the absolute path to your.env
file.Example (.bashrc / .zshrc) export ENV_PATH="/path/to/your/project/config/.env"- The application reads the
ENV_PATH
variable to know exactly where to find and load the.env
file usingdotenv
.
Environments & Tech Stack
The application consists of a Python backend and a React.js frontend.
Technology Choices
- Frontend (React): Chosen for familiarity and the benefits of a component-based framework with hooks, leading to more readable and maintainable code compared to vanilla JavaScript.
- Backend (Python with FastAPI & SQLAlchemy):
- Python was selected due to strong familiarity, excellent support for AI/ML tasks, and robust backend libraries.
- FastAPI: Chosen for its straightforwardness, performance, automatic type checking and validation (leading to cleaner code than alternatives like Flask for input validation), and suitability for APIs with a limited number of main endpoints.
- SQLAlchemy: Used as the ORM to simplify database interactions.
- Virtual Environment: The Python backend is developed within a virtual environment (e.g., using
venv
orconda
) to isolate dependencies and prevent conflicts with other projects or system-wide packages.
Future Considerations (Potential Rewrite)
- A future rewrite of most non-ML parts of the backend into Golang is being considered, primarily for potential performance improvements and Go’s excellent concurrency capabilities.
- Any custom machine learning components would likely remain in Python.