Configurations for Front-end, Back-end and Full stack Developer Questions
A valid project should have a valid hackerrank.yml configuration file in the root directory. Refer to the examples below or the configuration reference to learn how to write one for your project.
Configuration Reference
# Sample hackerrank.yml for Front-end, Back-end, and Full Stack Developer Questions.
# This is the v1 schema. Replace example commands and paths with project-specific values.
# Required numeric schema version. Do not quote this value.
version: 1.0
# Required parent object for all project settings.
configuration:
# Required. Set true when the project starts a web server; otherwise set false.
has_webserver: true
# Optional. Files supplied as data sources in compatible IDE/environment workflows.
# Remove this field when the question does not use supported data-source behavior.
data_source_files:
- data/reference.csv
# Optional. Paths/globs whose matching project files should be read-only.
# Paths are relative to the project root and should match existing project content.
readonly_paths:
- config/**
# Optional. Shell command(s) run after project setup.
post_setup_commands: bash scripts/post_setup.sh
# Optional scoring configuration. If present, command is required.
scoring:
# Required when scoring is present. Command that generates scoring results/testcases.
command: bash score.sh
# Optional paths for generated scoring output files; do not check generated outputs in.
files:
- tmp/results.xml
# Optional paths/globs for hidden scoring files, relative to the project root.
# These are separate from readonly_paths; do not include hackerrank.yml here.
hidden_files_paths:
- tests/hidden/**
# Optional numeric weights. Values must sum to exactly 1.
# For scorers that emit named testcase metadata, keys must match testcase names.
testcase_weights:
visible_case: 0.4
hidden_case: 0.6
# Required v1 IDE configuration object.
ide_config:
# Required by schema. The IDE workflow expects at least one existing project file.
# Do not list hackerrank.yml as a default-open file.
default_open_files:
- src/server.js
# Required by schema. The IDE project-settings workflow expects non-empty commands.
project_menu:
# Command shown for installing project dependencies.
install: npm install
# Command shown for running the project.
run: npm run start
# Command shown for running project tests.
test: npm test
# Optional port-to-preview settings. Must be nested under ide_config.
# Supported ports: 3000, 3030, 5000, 6000, 6001, 8000, and 8080.
ports_settings:
"3000":
# Required by the v1 schema. Label displayed for this port.
name: Web application
# Required by the v1 schema. true suppresses automatic preview opening.
hidePreview: false
# Optional. Marks this as the preferred preview; set true on at most one port.
primary: true
"8000":
name: API
hidePreview: true
# Optional. CodeRepo-only task definitions; leave commented out for Front-end,
# Back-end, and Full Stack Developer Questions. Names must be unique when used.
# Each task requires a non-empty name and task_type: bugfix or feature.
# coderepo_tasks:
# - name: Add user registration endpoint
# task_type: feature
# test_command: npm test
# scoring_command: npm install && npm test
# test_report_path: reports/unit.xml
# test_suite_path: test/registration.test.jsExample 1: Sample config for a node project without scoring
version: 1.0configuration:has_webserver: falseide_config:
default_open_files:
- app.js
project_menu:
run: npm start
install: npm install
test: npm testExample 2: Sample config for a node project with a web server and scoring
version: 1.0configuration:has_webserver: truescoring:
# npm test is expected to produce test output in results/unit.xml file.
command: "npm test"
files:
- results/unit.xmlide_config:
default_open_files:
- app.js
project_menu:
run: npm start
install: npm install
test: npm testExample 3: Sample config for a Java Spring Boot API project with weighted test cases
version: 1.0configuration:has_webserver: falsescoring:
command: "mvn clean test"
files:
- target/customReports/result.xml
testcase_weights:
# The weights should sum up to a total of 1
Create a model: 0.2
Delete a model: 0.2
Edit a model: 0.2
Filter model by attribute: 0.4ide_config:
default_open_files:
- src/main/java/com/hackerrank/sample/controller/ModelController.java
- src/main/java/com/hackerrank/sample/model/Model.java
project_menu:
run: mvn clean spring-boot:run
install: mvn clean install
test: mvn clean test; cat target/customReports/result.txtExample 4: Sample config for a node project with a web server and multiple output files
version: 1.0configuration:has_webserver: truescoring:
# npm test is expected to produce test output in results/unit.xml file.
command: "npm test"
files:
- results/user.xml
- results/project.xml
- results/api.xmlide_config:
default_open_files:
- app.js
project_menu:
run: npm start
install: npm install
test: npm testExample 5: Sample config for a node project with read-only files
You can use read-only files to mark certain files like test cases read-only. The candidate will not be able to modify these files.
version: 1.0configuration:has_webserver: true
readonly_paths:
- app/test.js
- app/tests/*scoring:
command: "npm test"
files:
- results/unit.xmlide_config:
default_open_files:
- app.js
project_menu:
run: npm start
install: npm install
test: npm test