- Make sure you have installed Docker
- Run command
docker compose up --build
- Navigate to http://localhost:3000
- It till take 5-10 minutes to run at first, but will be significantly faster afterwards
- This is because it will cache some of the layers so it won't have to build again.
- URLS:
- Frontend: http://localhost:3000
- Websocket: ws://0.0.0.0:8080
- API: 0.0.0.0:9000
Follow the steps below to run the frontend locally:
-
Open your terminal and navigate to the
frontenddirectory:cd frontend -
Install project dependencies:
npm i
-
Start the development server:
npm run dev
-
Open a new terminal and start a server to feed mock brain signal:
node server.js
-
Open the link on browser:
http://localhost:3000
These instructions were tested on Windows and not guarnateed to work on Macs Setup database first (using TimeScaleDB):
-
Start TimescaleDB container:
docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=my_secure_password_123 -v C:\Users\alexl\Documents\timescale_data:/var/lib/postgresql/data timescale/timescaledb:latest-pg16 -
Open a terminal and set up env variables for sqlx-cli (code blocks are terminal commands):
$env:DATABASE_URL="postgres://postgres:my_secure_password_123@localhost:5432/postgres" -
Set up sqlx-cli
# Install cargo install sqlx-cli # Check Installed sqlx --version -
Navigate to Rust Workspace Root
cd backend -
if /migrations/ folder does not exist or schemas are updated:
sqlx migrate run- Just re-run
sqlx migrate run - Or
sqlx database drop sqlx database create sqlx migrate run - Just re-run
-
Generate sqlx-data.json schema snapshot:
cd shared-logic -
Generate sqlx-data.json schema snapshot:
cargo sqlx prepare --workspace
clean up database after testing(optional):
- connect to the database
docker exec -it timescaledb psql -U postgres
- clear all data in the table
TRUNCATE TABLE eeg_data;```
error: set `DATABASE_URL` to use query macros online, or run `cargo sqlx prepare` to update the query cache
```
- start up the database docker
- re-do : `$env:DATABASE_URL="postgres://postgres:my_secure_password_123@localhost:5432/postgres"`
- `cd shared-logic`
- then: `cargo sqlx prepare --workspace`
Run api server:
$env:RUST_LOG="info"
cd backend/api-server
cargo run
- Exposed to port 9000
- Endpoint: http://localhost:9000/
Run websocket server:
- start the docker database
$env:DATABASE_URL="postgres://postgres:my_secure_password_123@localhost:5432/postgres"
$env:RUST_LOG="info"
cd backend/websocket-server
cargo run
- Exposed to port 8080
- Endpoint: ws://127.0.0.1:8080
Set up LSL
- The "lsl" Rust crate uses the C/C++ compiler and Cmake, make sure those are setup
cmake --version #Verify Installation of cmake
- Install Muse LSL
pip install muselsl
Connect to the Muse Headset
-
Comment out the mock data generator in backend/backend-server/shared-logic/src/bc.rs
-
To print a list of available muses:
$ muselsl list
- To connect to the first available Muse Headset and begin a stream:
$ muselsl stream