Microservice Development with Jolie, npm, VS Code, and Docker
Microservice development is a key approach for building scalable, maintainable, and efficient systems. In this guide, we’ll show you how to quickly get started with developing and running a microservice using Jolie, npm, Visual Studio Code (VS Code), and Docker. These tools simplify the process and allow you to focus on building robust, containerized microservices.

Prerequisites for Microservice Development
Before diving into the development process, ensure you have the following tools installed:
- npm: Node.js package manager to handle dependencies.
- Docker: To create containers for running your microservices.
- VS Code: The development environment for coding your microservice.
Make sure to enable Dev Containers in VS Code for a smooth development experience. Jolie comes preloaded in the Docker images we’ll be using, so there’s no need for additional installation. Once these tools are set up, you’re ready to begin the development of your microservice.
Step 1: Set Up Your Microservice Project with npm
Start by creating a new directory for your project. Open your terminal and run the following commands:
mkdir tutorial
cd tutorial
Next, initialize your Jolie project with npm:
npm init jolie
You’ll be prompted with questions during the initialization process. The default options are typically sufficient for this tutorial, so just press enter. Be sure to enable the Dockerfile and devcontainer configuration options.
When prompted, select “Empty Jolie project” as the project type. After the setup, your directory should look similar to this, along with the node_modules directory.
Step 2: Write Your Microservice Code in VS Code
Now, let’s open your project folder in VS Code. Run the following command:
code .
Once VS Code opens the project, it will automatically detect the .devcontainer folder and prompt you to reopen the directory inside the container. Click the blue button to proceed. The container setup may take a few minutes on the first run.
Once everything is set up, you’re ready to write your microservice. For this tutorial, we’ll build a service that greets a user based on a query parameter. For example, calling http://localhost:8080/greet?name=Jane should return a response like { "greeting": "Hi Jane" }.
Open the main.ol file and add the following code:
type GreetRequest { name: string }
type GreetResponse { greeting: string }
interface GreeterInterface {
RequestResponse: greet(GreetRequest)(GreetResponse)
}
service Main {
execution: concurrent
inputPort GreeterInput {
location: "socket://localhost:8080"
protocol: http { format = "json" }
interfaces: GreeterInterface
}
main {
greet(request)( { greeting = "Hi " + request.name } )
}
}
Key Code Explanation:
- GreetRequest and GreetResponse types define the structure of the incoming and outgoing messages.
- GreeterInterface defines the API for our service.
- The Main service runs concurrently and exposes an HTTP port on
localhost:8080. It handles requests and returns the appropriate greeting.
Step 3: Run Your Microservice
Now that the code is ready, let’s run it. Open the terminal in VS Code and use the following command to run the Jolie service:
jolie main.ol
Your microservice should be running without any visible output in the terminal. It will be accessible at http://localhost:8080. To test the service, open a separate terminal and run this curl command:
curl 'http://localhost:8080/greet?name=Jane'
You should receive a response like this:
{ "greeting": "Hi Jane" }
Step 4: Build and Run Your Microservice in Docker
Next, let’s containerize the microservice. Use the Dockerfile generated during the project setup to build your Docker image:
docker build . -t tutorial:latest
To run the microservice container locally, use this command:
docker run -p 8080:8080 -it --rm tutorial:latest
This exposes your microservice on port 8080. You can test it again using the same curl command from earlier.
Why ZippyOPS is the Perfect Partner for Microservice Development
At ZippyOPS, we specialize in helping businesses optimize their DevOps processes and implement modern technologies like microservices. Whether you’re looking for consulting, implementation, or managed services in DevOps, DevSecOps, Cloud, Automated Ops, or Microservices, we have the expertise to streamline your operations.
For more information on how we can support your microservice development and infrastructure management, visit our services page, explore our products, and check out our solutions. Also, explore our YouTube channel for helpful tutorials.
If you’re ready to scale your microservices and DevOps processes, reach out to us at sales@zippyops.com for a consultation!


