Development Setup โ
This guide helps you set up a development environment for the BlackLab Frontend project, covering both the Java backend and JavaScript frontend.
1. Prerequisites โ
- Java IDE:
- IntelliJ IDEA (requires license for Tomcat)
- Eclipse (setup guide)
- Visual Studio Code (Tomcat setup)
- Node.js:
- Download Node.js (use 24.x for this branch)
- Frontend Editor:
- Visual Studio Code with the Vue extension (VSCode will prompt to install it when opening
src/frontend)
- Visual Studio Code with the Vue extension (VSCode will prompt to install it when opening
2. Run BlackLab Server with Docker โ
2.1 Install Docker โ
- Download Docker Desktop
- Follow installation instructions for your OS
- Start Docker Desktop
2.2 Create docker-compose.yml โ
yaml
services:
blacklab:
image: instituutnederlandsetaal/blacklab:dev
ports:
- 8082:8080 # Maps container port 8080 (BlackLab) to host port 8082, as 8080 will be used by Tomcat- Save as
docker-compose.yml.
2.3 Start BlackLab โ
bash
docker compose up -d- BlackLab Server API: http://localhost:8082/blacklab-server/
3. Configure and Run the BlackLab Frontend โ
3.1 Create blacklab-frontend.properties โ
properties
# Point to the Vite dev server (host+port, no trailing slash)
vite=localhost:5173
# Point to the BlackLab instance running in Docker
blsUrl=http://localhost:8082/blacklab-server/
# Disable caching of template files and configs serverside
cache=false- This config makes the frontend use the Vite dev server for JS modules and disables caching for immediate updates.
3.2 Run in Your IDE โ
- Start the BlackLab Frontend servlet from your IDE (IntelliJ, VSCode, or Eclipse).
- The frontend will be available at http://localhost:8080/blacklab-frontend/, but will not work until the frontend JavaScript is built.
4. Start the Vite Dev Server โ
Compile and watch JavaScript files using Vite.
Run the following in src/frontend/:
bash
cd src/frontend/
npm install
npm start- Vite dev server: http://localhost:5173/
Note:
The default Vite port is 5173. To use a different port, update the start command in package.json and the vite setting in blacklab-frontend.properties.
Hot Reload:
When you change a JS file, the page reloads automatically.
5. Development Workflow โ
- The Vite dev server auto-reloads on JS changes.
- If you see "No corpora available", add a corpus to BlackLab.
- For production, run
mvn clean packagein the project root to build and embed frontend assets in the WAR file. Removevitefrom your config when testing the production build.
6. Backend Development Notes โ
The backend is written in Java and is mainly responsible for:
- Serving the correct JavaScript file and setting up the page skeleton (using Apache Velocity).
- Handling requests:
MainServletfetches corpus data from BlackLab, reads the relevantsearch.xml, and determines which page to serve (via*Responseclasses). This sets up the header, footer, and client-side variables (mainly URLs). - Most of the application logic happens client-side.
- The backend also handles the
documentpage, retrieving XML and metadata and converting it to HTML.