Project structure #
This document explains what each package does.
Table of contents
Root level #
This is where most of the magic happens. Most packages with actual code are located in this folder.
This folder holds a simple caldav implementation which is responsible for the caldav feature.
This package contains all cli-related files and functions.
To learn more about how to add a new command, see the cli docs.
To learn more about how to use this cli, see the cli usage docs.
This package configures handling of Vikunja’s runtime configuration. It sets default values and sets up viper and tells it where to look for config files, how to interpret which env variables for config etc.
See also the docs about adding a new configuration parameter.
This package contains the db connection handling and db fixtures for testing. Each other package gets its db connection object from this package.
This package is responsible for all file-related things. This means it handles saving and retrieving files from the db and the underlying file system.
All integration tests live here. See integration tests for more details.
config, this will set up the logging, based on different logging backends.
This init is called in
main.go after the config init is done.
This package handles all mail sending. To learn how to send a mail, see notifications.
This package handles all metrics which are exposed to the prometheus endpoint. To learn how it works and how to add new metrics, take a look at how metrics work.
This package handles all migrations. All migrations are stored and executed in this package.
To learn more, take a look at the migrations docs.
This is where most of the magic happens. When adding new features or upgrading existing ones, that most likely happens here.
Because this package is pretty huge, there are several documents and how-to’s about it:
Everything that can have multiple implementations (like a task migrator from a third-party task provider) lives in a respective sub package in this package.
Contains openid related authentication.
Contains all possible avatar providers a user can choose to set their avatar.
All project background providers are in sub-packages of this package.
Handles everything related to the
restore commands of Vikunja.
A simple key-value store with an implementation for memory and redis. Can be used to cache values.
See writing a migrator.
red (redis) #
This package initializes a connection to a redis server. This initialization is automatically done at the startup of Vikunja.
It also has a function (
GetRedis()) which returns a redis client object you can then use in your package
to talk to redis.
It uses the go-redis library, please see their configuration on how to use it.
Note: Only use this package directly if you have to use a direct redis connection.
In most cases, using the
keyvalue package is a better fit.
This package defines all routes which are available for Vikunja clients to use. To add a new route, see adding a new route.
This is where all http-handler functions for the api are stored. Every handler function which does not use the standard web handler should live here.
All user-related things like registration etc. live in this package.
A small package, containing some helper functions:
MakeRandomString: Generates a random string of a given length.
Sha256: Calculates a sha256 hash from a given string.
See their function definitions for instructions on how to use them.
The single purpose of this package is to hold the current Vikunja version which gets overridden through build flags each time
mage release or
mage build is run.
It is a separate package to avoid import cycles with other packages.