Development environment

The Virtualpaper server is written with Go and the frontend uses React-Admin framework and Typescript.

Setting up the environment

The easiest way to get started is by using the provided docker-compose file. See Demo environment for more info.

The provided makefile has lots of commands for building, and developing testing the system.

Since the server requires use of libtesseract and other binaries, it is easiest to develop the server inside the provided docker image.

To use it, use commands:

# initialize dev env, 
# create /dev directory for data and config
make dev-init

### continue running or debugging the image...

Running the server in dev container

After successfully building the docker image, run

make dev-start-container

This will start the server, which is now listening at http://127.0.0.1:8000.

Running in debug mode with Delve

After successfully building the docker image, run

make dev-debug

This will start the delve-process, which listens for a debug tool to connect before actually starting the server. Delve is listening on port 2345 with api-version 2. You can use IDE to connect to remote Delve session with these settings.

When you need to recompile the program, you need to kill the container and restart it, and then reconnect the delve client.

Accessing the database in the demo env

For convenience, it might make sense to open the PostgreSql and Meilisearch ports to localhost to get access to them. To do this, add following lines to docker-compose.yml:

# under meilisearch:
    expose: 
      - "7700"

# under postgres:
    expose:
      - "5432"

After the modification, make sure to restart the stack with:

make test-stop
make test-start