The website of https://rahvaalgatus.ee built with JavaScript on Node.js, JSX for templates and Sass for CSS. It uses SQLite for its database, which is bundled with the Better SQLite3 Node.js package. No external database servers required.
After installing a stable version of Node.js (so far tested against Node.js v14 and NPM v2), follow these steps:
-
Install the JavaScript modules necessary for the server and client-side components.
npm install cd app && npm install
Ensure NPM uses the included
npm-shrinkwrap.json
file to get the exact same versions Rahvaalgatus was developed with. -
Compile the client-side JavaScripts and stylesheets with Make:
make
Note that you also need to have
jq
v1.6 or later installed as compiling some of the assets depend on Jq scripts. -
Initialize the database:
make db/create
Note that for generating the initial SQLite database via Make, you need to have the SQLite command line application available. Try installing it either via your package manager or from SQLite's home page. Ensure it's at least version 3.24. Alternatively you can initialize the SQLite database with
config/database.sql
via some other means. Thesqlite3
executable isn't required during runtime. -
Run the server:
make web
For a different port, pass
PORT
to Make:make web PORT=8888
-
Set up the <rahvaalgatus.test> domains.
While Rahvaalgatus home page works fine when accessed via http://localhost, its parliament and local government sites link to specific subdomains. Email confirmation and notification emails also use the host from
Config.url
(config/development.json
for the development environment). To be able to click on links in emails during development, update the configuration to use or set up your preferred domain.To use <rahvaalgatus.test>, add it to your
/etc/hosts
file:127.0.0.1 rahvaalgatus.test 127.0.0.1 riigikogu.rahvaalgatus.test 127.0.0.1 kohalik.rahvaalgatus.test
-
Open your local domain (e.g. http://rahvaalgatus.test:3000) in your browser and proceed with typing code.
To have the frontend JavaScripts and stylesheets be compiled automatically as you change files, use autocompile
:
make autocompile
Environment specific configuration for the server is in config/$ENV.js
. To run it in the production environment, for example, pass ENV
to Make:
make web ENV=production
The few client-side JavaScript files of Rahvaalgatus, however, are not dependent on the environment.
To test signing in or signing initiatives with Mobile-Id, use one of the Mobile-Id test phone numbers:
Phone | Personal id | Name |
---|---|---|
+37268000769 +37258000769 |
60001017869 | Eid2016 Testnumber |
+37200000766 | 60001019906 | Mary Änn O’Connež-Šuslik Testnumber |
+37200000566 | 60001018800 | Mary Änn O’Connež-Šuslik Testnumber (PNOEE-certificate) |
For more info and test numbers, see the SK ID Solutions wiki.
To test signing in or signing initiatives with Smart-Id, use the following test personal id:
Personal id | Name |
---|---|
30303039914 | Qualified Ok1 Testnumber |
30303039903 | Qualified Ok Testnumber |
30303039816 | Multiple Ok Testnumber |
39912319997 | Bod Testnumber |
For more test ids, see the Smart-Id documentation wiki.
The project has JavaScript server unit tests written with Mocha, Must.js and Mitm.js.
Run them with Make:
make test
To run a specific test, use the $TEST
environment variable when invoking Make:
make test TEST=./test/bin/web_test.js
To have the tests run automatically as you change files, use autotest
:
make autotest
Rahvaalgatus also has a public API available that's usable both from the server side and via client-side JavaScript, if you wish to embed a signature counter on your initiative's marketing page, for example.
An example of getting the number of signatures on an initiative:
curl https://rahvaalgatus.ee/initiatives/92cc16ee-107e-4208-b92c-2ffed24d4f4b -H "Accept:application/vnd.rahvaalgatus.initiative+json; v=1"
See the full API documentation on SwaggerHub or in a machine-readable OpenAPI v3 format from the openapi.yaml
file from this repository. There are a few examples of use in Estonian also on https://rahvaalgatus.ee/api.
We're open to adding more structured data to the public API, so feel free to create an issue on GitHub if you find something's missing.
Rahvaalgatus is released under the GNU Affero General Public License, which in summary means:
- You can use this program for no cost.
- You can use this program for both personal and commercial reasons.
- You have to share the source code when you run it online.
- You have to share modifications (e.g bug-fixes) you've made to this program.
For more details, see the LICENSE
file.
Development of Rahvaalgatus is led and sponsored by SA Eesti Koostöö Kogu.
Parts of it sponsored by Andri Möll and Teeme Ära SA.
More details about Rahvaalgatus the platform.
If you find Rahvaalgatus needs improving, please don't hesitate to create an issue on GitHub.