We are happy for anyone to contribute to Swetrix. This file will contain instrucitons on how to set up a development environment, find a task, and submit a pull request.
The easiest way to get started with Swetrix API is by using Docker and use it to run all the databases and other dependencies.
To easily open pull requests you should fork the repository. You can do this by clicking the "Fork" button in the top right corner of the repository page.
After you have forked the repository you can clone it to your local machine. You can do this by clicking the "Code" button and copying the URL. Then run the following command in your terminal:
git clone [email protected]:[YOUR_USERNAME]/swetrix-api.git
To install the dependencies you need to run the following command in the root of the repository:
npm install --legacy-peer-deps
Copy the .env.example
file and rename it to .env
.
To start the Docker container containing the databases you need to run the following command in the root of the repository:
docker-compose -f ./docker-compose-dev.yml up -d
To set up the analytics database and initialise the tables, you should run a script called initialise_database.js
which is located in the migrations/clickhouse
directory.
node migrations/clickhouse/initialise_database.js
To start the API you need to run the following command in the root of the repository:
npm run start:dev
To start the frontend locally you have to fork and clone the frontend repository, install it's dependencies (npm i
), set up it's .env
file and start it (npm run dev:staging
).
In this step, go to the Swetrix API specification page by following this link : Swagger Documentation - AuthController-Register. Click on the "try it out" button and then execute the request. After completing this step, take a look at the terminal output where you will find the following object:
"params": {
"url": "http://localhost: 3000/verify/e1365737-be07-4675-855-901efcd27668"
}
Copy the verification token provided and navigate to the "verify email token" method by visiting this link : Swagger Documentation - AuthController_Verify-mail. Once this step is done, the account will be successfully created.
This step is not necessary, but for your convenience you can generate some dummy data. To do that run a script called generate-dummy-data.js
which is located in the meta/clickhouse
directory.
node meta/clickhouse/generate-dummy-data.js --help
This command will give you all the required information on how to generate the data.
You can find a list of all the tasks in our roadmap (here's a link to the same page but as 'Issues' page).
If you want to create a new feature which is not in the roadmap - we support it, but you should discuss it with the team first.
At Swetrix, each feature or improvement is developed in a separate branch and then submitted as a pull request. The branch name should start with one of the following:
fix/
- for bug fixesimprovement/
- for improvements to existing featuresfeature/
- for new features
When you are done with your task you should submit a pull request. Pull request name should start with one of the following:
(fix)
- for bug fixes(improvement)
- for improvements to existing features(feature)
- for new features
If you run into a problem when deploying or developing something for Swetrix, feel free to open an issue on the Issues tab.