Development Setup
Installation
- Install and setup
git lfs: https://git-lfs.com/ - Create a new python environment and install the dependancies
uv venv --python 3.12.6
source .venv/bin/activate
uv pip install -e .
Node.js: https://nodejs.org/en/download
4. Install the UI dependencies
nvm use v22.19.0
npm --prefix toktagger/ui install
- Run the backend API service in development mode. The backend API will be accessible at
http://localhost:8002.
API_URL=http://0.0.0.0:8002 uvicorn toktagger.api.cli:app --host 0.0.0.0 --port 8002 --reload
- Run the frontend UI service in development mode. The UI will be accessible at
http://localhost:5173npm --prefix toktagger/ui run dev
Development Setup with Docker
Alternatively, you can run the application in development mode using docker:
docker compose --env-file .env.dev -f docker-compose.dev.yml up --build
This will start both the backend API and the frontend UI at the following urls:
| Service URL | Description |
|---|---|
http://localhost:5173/ |
User Interface |
http://localhost:8002/ |
Backend API |
http://localhost:27017/ |
MongoDB Database |
http://localhost:8081/ |
MongoExpress Admin Panel |
The development setup runs both the frontend and backend in development mode, so any changes to the code will automatically be reflected in the running application.
Setup local test data
Once the application is running, the following setup script can be used to automatically set up a basic model
Configure git LFS and pull the model
git lfs install
git lfs pull
Create some example datasets for testing.
python -m scripts.setup
Building the Single Page Application (SPA)
The version of the application which get served to users is built using the following command:
npm --prefix toktagger/ui run build
This will run vite build and create a production-ready version of the application in the toktagger/api/static directory. This is then packaged with the application when pip installed.