Skip to content

htmfilho/minimily

Repository files navigation

Minimily

Minimily is an application designed to help you keeping your life as simple as possible. We will help you to make decisions taking into account the impact on your health, family, living place, community and environment.

CircleCI

Installing

Requirements

Minimily is a web application and it has 3 requirements:

  1. The application is developed in Clojure, a language hosted on the Java Virtual Machine (JVM), which means it depends on a Java environment to work. The JVM is well known for its performance and large ecosystem.

  2. Leiningen is a build tool for Clojure applications. It is used during development, packaging and deployment.

  3. Minimily uses an embedded database that works out of the box, but in case you need more capacity, you can use PostgreSQL instead. PostgreSQL is a database that scales from a Raspberry PI to a high availability cluster. It requires some additional configuration at the beginning, but it is quite straightforward to work with.

Installing PostgreSQL

Execute the following commands to install PostgreSQL:

$ sudo apt-get install postgresql
$ sudo su - postgres -c "createuser -s $USER"

Then create the database for the application:

$ createdb minimily
$ createuser minimily -P
$ psql -d minimily
  =# grant connect on database minimily to minimily;
  =# \q

In the configuration file, available at config/[env]/config.edn, use the following URL to connect to PostgreSQL:

:DATABASE_URL "postgres://minimily:secret@localhost:5432/minimily"

Installing JVM

Minimily is open source and free like free beer. You can use Minimily and contribute to it as much as you can. In order to fulfill this promesse, we also need to use open source and free software. In the JVM world, there are free and paid distributions. We want you to be careful about which distribution to pick. So, we would like to recommend the following distributions:

Please, follow the installation instructions in their respective websites.

Using

Contributing

Installing Leiningen

Run from the terminal using the dev profile:

$ lein run

or using the prod profile:

$ lein with-profile prod run

Run from the REPL (dev profile):

$ lein repl
minimily.web=> (start-server 3000)
minimily.web=> (stop-server)

Package the application into a jar file (uberjar profile with prod config):

$ lein uberjar

Run the jar package:

$ java $JVM_OPTS -cp target/minimily-standalone.jar clojure.main -m minimily.web

To deploy to Heroku, make sure you have a PostgreSQL database and an environment variable named DATABASE_URL.

Code Conventions

The application is organized in decoupled modules. They are:

  • accounting: manages the finances of the family
  • documents: manages digitalized and phisical copies of documents
  • inventory: manages all objects in the house
  • auth: manages the authentification of users

Each module contains two basic folders:

  1. model: contains the code that access sources of data to add, search, retrieve, modify and delete records
  2. web: contains the code renders the web user interface to enable all possible data operations

The model is divided in two parts:

  1. sql: a collection of sql queries organized by entity, keeping them separated from the model logic.
  2. model workspace: the model that manages the data of the entities.

The web is divided in four parts:

  1. routing: associates urls with controller functions that return web content.
  2. controller: functions that receive requests from web clients and interact with the model to generate responses expected by the clients.
  3. ui:
  4. api:

Functions

  1. The prefix get- indicates the function returns a single value or record.
  2. The prefix find- indicates the function returns a collection of values or records.

Dependencies

  • HugSQL is a library to abstract SQL statements as functions.

License

Copyright © 2017-2018 Hildeberto Mendonca

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Releases

No releases published

Packages

No packages published