-
Install dependencies
- PostgreSQL
- Python >= 3.10
-
Install the package
git clone git@github.com:open-reaction-database/ord-app.git cd ord-app pythom -m pip install -e ".[tests]"
-
Run the FastAPI server
cd ord_app/service_api ORD_APP_TESTING=TRUE fastapi dev main.pyThis creates a test PostgreSQL database and starts the server at http://localhost:8000. Navigate to http://localhost:8000/docs for the interactive Swagger docs.
You can run the Back-End and the Database using a single docker-compose file.
docker compose up -dAt the same time, you need to run the Front-End separately.
cd uinpm cinpm run devOr run the Front-End and Back-End in a single Dockerfile.
Note: the database must be on the same network as docker or docker must connect to the external database (and have access)
- Build the Docker image
docker build -f Dockerfile.single -t ord . - Run the Docker image
docker run \ --network ord_network \ -e VITE_API_ENDPOINT="http://localhost:8000/service_api/api/v1" \ -e VITE_AUTH0_DOMAIN="..." \ -e VITE_AUTH0_CLIENT_ID="..." \ -e VITE_AUTH0_AUDIENCE="..." \ -e VITE_AUTH0_ISSUER="..." \ -e PG_DSN="postgresql+asyncpg://ord@db:5432/ord" --rm -p 5173:5173 -p 8000:8000 ord
Envs for backend:
| Name | Description | Required | Default |
|---|---|---|---|
pg_dsn |
DSN for connecting to the database | false | postgresql+psycopg://ord@localhost:5400/ord |
cors_origins |
Allowed origins | false | ["http://localhost:5173"] |
app_env |
Manages the application context (debug parameters) | false | production (available: localhost, production) |
vite_auth0_domain |
Auth0 config | true | - |
vite_auth0_algorithms |
Auth0 config | true | - |
vite_auth0_audience |
Auth0 config | true | - |
vite_auth0_issuer |
Auth0 config | true | - |
vite_auth0_client_id |
Auth0 config | true | - |
Python tests are written with pytest:
pytest -vv