2. Setup the Development Environment

In this chapter, you learn to create your development environment based on Ubuntu 20.04 and Julia version 1.5.


Get Experience with Modules

To get experience with Julia and modules, we start with building an application where we can register and retrieve persons. The module name is Accounts.

We use the Onion Architecture to define a model that consists of the layers Domain, API, and Infrastructure. The layers are declared as sub-modules. See also Domain-driven Design in section 2 Accounts Receivable of chapter 7 The design.

The Domain Layer.

The domain has the objects Person, Address, and AddressType.

The API Layer.

The API has the function create. It can be used for creating persons and addresses.

The Infrastructure Layer.

Infrastructure has the functions save and retrieve to save and retrieve persons.

Activity 2.1: Setup the Development Environment

You work with VSCode as IDE. Before installing it, you need first to install Julia and Git.


  • Ubuntu 20.04.

In this activity, you will create a development environment.

  • Install Julia.
  • Instal Git.
  • Install VSCode.
  • Add the Julia package PkgTemplates.

1Ctrl+Alt-TOpen a terminal window.
2Install JuliaFollow the Installation instructions.
3Install Git
4Install VSCode
6Close VSCode
7$ juliaStart Julia.
8julia> ]Go to the package manager.
9pkg> add PkgTemplatesAdd the PkgTemplates package.
10pkg> <BackSpace>Back to Julia REPL.
11julia> Ctrl-DExit Julia

Activity 2.2: Create the Accounts Module.

Many developers use PkgTempates to create Julia packages. You can upload packages to GitHub. Others can use them in their Julia projects.

You can also register your packages on GitHub in Julia Hub. For example, AppliSales and AppliGeneralLedger are registered packages that you use in the course.


  • Activity 2.1.
  • Ubuntu 20.04.
  • Julia 1.5+ installed.
  • VSCode 1.50+ installed.
  • Git 2.25.1+ installed.
  • Julia PkgTemplates package installed.

In this activity you will:

  1. Use the Julia package PkgTemplates to create our initial package Accounts.
  2. Start VSCode.

Step 1: Use the Julia package PkgTemplates to create our initial package Accounts.

Invenia created the package PkgTemplates. It assists you to create new Julia packages in an easy, repeatable, and customizable way.

1$ juliaStart Julia.
2julia> using PkgTemplatesLoad PkgTemplates.
3julia> t = Template()Construct a default template.
  authors: ["Rob Bontekoe <rbontekoe@appligate.nl> and contributors"]
  dir: "~/.julia/dev"
  host: "github.com"
  julia: v"1.0.0"
  user: "rbontekoe"
      file: "~/.julia/packages/PkgTemplates/aXRp5/templates/github/workflows/CompatHelper.yml"
      destination: "CompatHelper.yml"
      cron: "0 0 * * *"
      ignore: String[]
      name: nothing
      email: nothing
      branch: nothing
      ssh: false
      jl: true
      manifest: false
      gpgsign: false
      path: "~/.julia/packages/PkgTemplates/aXRp5/templates/licenses/MIT"
      destination: "LICENSE"
      version: v"0.1.0"
      file: "~/.julia/packages/PkgTemplates/aXRp5/templates/README.md"
      destination: "README.md"
      inline_badges: false
      file: "~/.julia/packages/PkgTemplates/aXRp5/templates/src/module.jl"
      file: "~/.julia/packages/PkgTemplates/aXRp5/templates/github/workflows/TagBot.yml"
      destination: "TagBot.yml"
      cron: "0 0 * * *"
      token: Secret("GITHUB_TOKEN")
      ssh: Secret("DOCUMENTER_KEY")
      ssh_password: nothing
      changelog: nothing
      changelog_ignore: nothing
      gpg: nothing
      gpg_password: nothing
      registry: nothing
      branches: nothing
      dispatch: nothing
      dispatch_delay: nothing
      file: "~/.julia/packages/PkgTemplates/aXRp5/templates/test/runtests.jl"
      project: false
4julia> t("Accounts")Create the package environment Accounts.
[ Info: Running prehooks
[ Info: Running hooks
 Activating environment at `~/.julia/dev/Accounts/Project.toml`
   Updating registry at `~/.julia/registries/General`
######################################################################## 100,0%
No Changes to `~/.julia/dev/Accounts/Project.toml`
No Changes to `~/.julia/dev/Accounts/Manifest.toml`
 Activating environment at `~/.julia/environments/v1.5/Project.toml`
[ Info: Running posthooks
[ Info: New package is at /home/rob/.julia/dev/Accounts
5julia> Ctrl-DExit Julia.
Step 2: Start VSCode.

A development platform like VSCode makes working with Julia easy. It replaces Atom with the extension Juno.

1$ cd ~/.julia/dev/Accounts/Go to Accounts folder.
2$ code .Start VSCode. By typing a dot you will only open the files int the current folder.
3Close the Welcome page

You will see the following file structure.

v Accounts
   > .github/workflows
  v src
    - Accounts.jl #1
  v test
    - runtests.jl #2
  - .gitignore
  - Manifest.toml #4
  - Project.toml #3
  - README.md

#1 File with the name of the module where you define among other things:

  • sub-modules,
  • (export) of the functions that others can invoke immediately,
  • as well as data structures, and
  • (import) of the elements, you want to use from other (sub-)modules or packages.

#2 Unit tests.

#3 Contains the module version and its dependencies.

#4 "The Manifest. toml is like a screenshot of your current environment that has all the information needed to replicate this environment elsewhere, e.g. the URL of unregistered packages, branch, commit, etc," see What’s the use a Project.toml file and the use of a Manifest.toml in a Julia project?. The file is mentioned in the file .gitignore and will not be pushed to GitHub. When you provide this file to another person then one can create the same environment as you have after activating the folder (pkg> activate .) representing the git clone of your package ($ git clone https://github.com/rbontekoe/Accounts.jl.git).

Activity 2.3: Create a Repository on GitHub

In this activity, you create a repository on GitHub. You can push changes in the design of the module to GitHub. Later on, you will learn how others can use the module.

In this step, you will add the extension .jl to the package name Accounts. This way, others can use it by adding it to their application with the command: add https://github.com/<your username>Accounts.jl.


In this activity you will:

  1. Create a repository on GitHub.
  2. Push our local repostitory to GitHub.

Step 1: Create a repository on GitHub.

"GitHub is a free code hosting platform for version control and collaboration." It is used by millions of developers worldwide. VSCode facilitates working with GitHub.

1Ctrl+Shift-PShow All Commands.
2Select: Publish to GitHubCreate a GitHub repository.
3Extend the name Accounts with: .jlDON'T FORGET this step!!!
4Select: Publish to GitHub public repository
Step 2: Push our local repostitory to GitHub.

However, the repository created in the previous step is empty. In this step, we 'push' our local data to Github.

1Ctrl+Shift-GOpen Source Control pane.
2Click on: ∙∙∙Open Views and More Actions menu. It is located in the upper right corner of the pane.
3Select: PushYou get the next message:
The branch 'master' has no upstream branch. Would you like to publish this branch?
4Select: OKGitHub is updated with the new repository.
5Go to Accounts.jl on GitHubAll files have the comment 'Files generated by PkgTemplates'.


In the course activities, we assume that you use Visual Studio Code, VSCode, as IDE (Integrated Development Environment). Before installing VSCode, it's best to download and install Julia and Git first.

See also, Getting started with Visual Studio Code.