This repository contains the web application code for the NIH-funded Brain Behavior Quantification and Synchronization (BBQS) Ecosystem for Multi-modal Brain-behavior Experimentation and Research (EMBER) Data Archive. This web application allows users to view information about the program, search projects, and submit data.
For native development instructions, please refer to the individual frontend and backend readme files. This is the recommended approach for developers looking to make code contributions or perform debugging.
This is the simplest configuration for developers to get the web application up and running.
- Docker & Docker Compose
-
Create .env.docker file in BBQS-EMBER-web/backend/config. We will add six variables:
DEBUG,DATABASE_URL,DJANGO_SECRET_KEY,POSTGRES_USER,POSTGRES_PASSWORD, andPOSTGRES_DB. -
Set debug mode to true, by adding
DEBUG=Trueto your .env.docker -
Define
DATABASE_URLfollowing the pattern:postgres://[user]:[password]@postgres:5432/[dbname]-
For example, following the steps above, if we defined:
- user as "ember"
- password as "test123"
- and dbname as "ember_db"
DATABASE_URL=postgres://ember:test123@postgres:5432/ember_db -
Please note that within docker the hostname is the Docker service name "postgres" rather than "localhost"
-
-
Define
POSTGRES_USER,POSTGRES_PASSWORD, andPOSTGRES_DBusing the same user, password, and dbname as above. -
Run the following to generate a secret key and write it to your .env.docker file:
uv run python - <<'EOF' >> backend/config/.env.docker from django.core.management.utils import get_random_secret_key print(f"DJANGO_SECRET_KEY={get_random_secret_key()}") EOF -
A complete .env should look like
DEBUG=True DATABASE_URL=postgres://myusername:mypassword@postgres:5432/mydatabase DJANGO_SECRET_KEY=key POSTGRES_USER=myusername POSTGRES_PASSWORD=mypassword POSTGRES_DB=mydatabase
-
Start the frontend, backend, and database containers:
docker compose -f docker-compose.dev.yml up -d
-
Apply database migrations
docker compose -f docker-compose.dev.yml exec backend uv run manage.py migrate -
Create a superuser
docker compose -f docker-compose.dev.yml exec backend uv run manage.py createsuperuser -
Load initial data
docker compose -f docker-compose.dev.yml exec backend uv run manage.py load_initial_projects
On subsequent runs, you will only need to run the first command from the initial setup, listed below for quick reference
-
Start the frontend, backend, and database:
docker compose -f docker-compose.dev.yml up -d
-
The frontend should now be running at http://localhost:8080 and the backend at http://localhost:8000.
- To view the API endpoints, see http://localhost:8000/docs
- To view the admin console, see http://localhost:8000/admin
Contibutions are welcome through pull requests. Please notify the BBQS EMBER team for review.