Copyright (c) 2025 Maxime DAUPHIN, Maël HOUPLINE, Julien TAP. All rights reserved. Licensed under the MIT License. See LICENSE file for details.
Back-end repository of project "PolyHUB" for ET4 web project.
Next steps define how to download the project and run it under a port, you will have to configure a webserver on your machine to access it from internet (using nginx, apache2, etc.).
-
- need to clone the repository
- need to have npm
- open a terminal at the root of the cloned repository
- run
npm ci - for development: run
npm run dev -- --lint-skip --dev-port=<port>and replace<port>with the port you want - for production: run
npm run start -- --lint-skip --start-port=<port>and replace<port>with the port you want
-
- NO need to clone the repository
- back image:
- db image:
- docker-compose:
- open a terminal and navigate to the folder where you want to download the
docker-compose.ymlfile - you can find an example of
docker-compose.ymlin thedocker configfolder- you can copy it with
curl -o docker-compose.yml https://raw.githubusercontent.com/MES4game/POLYHUB-WEB-BACK/main/.docker/docker-compose.yml
- you can copy it with
- you also need to copy
example.envto.env- you can get it with
curl -o .env https://raw.githubusercontent.com/MES4game/POLYHUB-WEB-BACK/main/.docker/example.env
- you can get it with
- edit
.envto your needs - run
docker-compose up -d --force-recreate --pull alwaysto start the container
- open a terminal and navigate to the folder where you want to download the
.docker: Docker-related files (Dockerfile, etc.).github: GitHub-related files (workflows, issue templates, etc.)build: built files for production (after runningnpm run build) (ignored by git)db: database-related filesscripts: scripts used bynpm run <script>commandsrc: source code (React components, styles, etc.).gitignore: files to ignore by giteslint.config.mjs: ESLint configurationLICENSE: license file (MIT)package-lock.json: npm package lock file (exact versions of dependencies)package.json: npm package configuration (dependencies, scripts, etc.)README.md: this filetsconfig.json: TypeScript configurationtsoa.json: TSOA configuration (for API documentation)
npm install: install dependenciesnpm install -E -D <package>...: install development dependencies (with exact version)npm install -E -P <package>...: install production dependencies (with exact version)npm run lint: lint the code with ESLint (automatically run beforedevandbuild)- options (
npm run lint -- <option>...):--lint-skip: skip linting--lint-fix: automatically fix problems--lint-nibble: format output to more readable format
- options (
npm run tsoa: generate TSOA files (controllers and swagger)- options (
npm run tsoa -- <option>...):--tsoa-skip: skip TSOA generation--tsoa-skip-spec: skip swagger generation--tsoa-skip-routes: skip routes generation
- options (
npm run dev: run the application in development mode (with hot-reloading)npm run lintis run before startingnpm run tsoais run before starting- options (
npm run dev -- <option>...):- every those of
lintcommand - every those of
tsoacommand --dev-port=<number>: specify the port (default: 3000)
- every those of
npm run build: build the application for productionnpm run lintis run before buildingnpm run tsoais run before building- options (
npm run build -- <option>...):- every those of
lintcommand - every those of
tsoacommand --build-outDir=<path>: specify the output path (default:./build)
- every those of
npm run start: start the application in production modenpm run buildis run before starting- options (
npm run start -- <option>...):- every those of
buildcommand --start-port=<number>: specify the port (default: 3000)
- every those of
-
main: production branchdev: development branch (all features must be merged here first)dev-<id>: structure branches (must be created fromdevand merged back todev)SCRUM-<id>: task branches (must be created fromdevand merged back todev)
-
<type>(<scope>): <comment><type>: type of the commit (must be one of the following, can be combined with|):feat: new featurefix: bug fixdocs: documentation only changesstyle: changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor: code change that neither fixes a bug nor adds a featureperf: code change that improves performancetest: adding missing tests or correcting existing testschore: changes to the build process or auxiliary tools and libraries such as documentation generationmerge: merges branches
<scope>: name of the branch<comment>: short description of the commit
- example:
feat(SCRUM-42): add login feature - example:
feat|perf|style(SCRUM-21): add last event feature, improve performance for render and fix styles of first section - every commit must be signed with a GPG/SSH key
- make reasonable sized commits (do not commit everything in one commit, but do not make too many small commits either)
- write meaningful commit messages (do not use
fixorupdateas comment, be more specific)
-
- title:
merge(<source> -> <target>): <comment><source>: source branch<target>: target branch<comment>: short description of the PR
- description
- optional: follow the template provided by GitHub
- if you did not use the template, at least provide a description of the changes
- for the merge commit, let GitHub generate it automatically (do not edit it)
- reviewers: at least one reviewer must be assigned (preferably the repository admin or the service manager)
- In case of a release PR (from
devtomain):- title:
r/<version> - <name><version>: version of the release (must follow semantic versioning, e.g.1.2.3)<name>: name of the release
- description:
- follow the template provided by GitHub
- if you did not use the template, at least provide a description of the changes
- you can omit the "Changelog" section
- do not use "---" in the PR description, it breaks the formatting, only let the one by default
- a link to compare the changes since last release will be automatically generated by GitHub in the release description
- title:
- title:
git status: check the status of the repositorygit fetch origin: fetch changes from remotegit checkout <branch>: switch to an existing branchgit pull origin: pull changes from remote branchgit rebase origin/<branch>: rebase current branch onto remote branch, if you want to get latest changes of another branch (must be done aftergit fetch origin)git add .: stage all changesgit add <file>...: stage specific file (can use glob patterns)git commit -m "<commit message>": commit staged changes with a messagegit push origin: push changes to remote branchgit stash -u: stash changes (to be reapplied later, for example when switching branch)git stash pop: reapply stashed changes
-
- must have a different tag for every version (used by CD action to tag Docker image)
- must be created from
mainbranch - tag must be prefixed with
v(e.g.v1.2.3) - tag must follow semantic versioning (https://semver.org/)
- When a new version is pushed to
main, the Docker image will be tagged with:- the full version (e.g.
v1.2.3) - the major and minor version (e.g.
v1.2) - the major version (e.g.
v1) - the
latesttag (always points to the latest version)
- the full version (e.g.
-
CI: runs on every push and PR, lints and builds the project to make sure everything is fineCD: runs on every release frommain, builds the Docker image and pushes it to Docker Hubrelease: runs on every release PR fromdevtomain, generates the release notes and creates a GitHub release
-
- Global secrets:
- Environment secrets:
production-dbandproduction-back:DOCKERHUB_TOKEN: Docker Hub token for pushing images
release:ADMIN_TOKEN: Admin GitHub user token with contents write permission on that repository
-
- Global variables:
- Environment variables:
production-dbandproduction-back:DOCKERHUB_USERNAME: Docker Hub usernameDOCKERHUB_IMAGE: Docker Hub image nameDOCKER_BUILD_CONTEXT: Docker build context (default:.)DOCKER_CONFIG_FOLDER: Docker config folder (default:./.docker)
release:
-
-
Default branch:mainReleases:Enable release immutability: true
Features:Wiki: falseIssues: falseSponsorships: falsePreserve this repository: trueDiscussions: falseProjects: false
Pull Requests:Allow merge commits Loading: trueDefault commit message: Pull request title and description
Allow squash merging: falseAllow rebase merging: falseAlways suggest updating pull request branches: trueAllow auto-merge: falseAutomatically delete head branches: false
Pushes:Limit how many branches and tags can be updated in a single push: 2
-
no branches:{ "name": "no branches", "target": "branch", "source_type": "Repository", "enforcement": "active", "conditions": { "ref_name": { "exclude": [ "refs/heads/main", "refs/heads/dev", "refs/heads/dev-*", "refs/heads/scrum*", "refs/heads/SCRUM*" ], "include": [ "~ALL" ] } }, "rules": [ { "type": "deletion" }, { "type": "non_fast_forward" }, { "type": "update" }, { "type": "creation" } ], "bypass_actors": [] }protected branches:{ "name": "protected branches", "target": "branch", "source_type": "Repository", "enforcement": "active", "conditions": { "ref_name": { "exclude": [], "include": [ "refs/heads/main", "refs/heads/dev" ] } }, "rules": [ { "type": "deletion" }, { "type": "non_fast_forward" }, { "type": "creation" }, { "type": "pull_request", "parameters": { "required_approving_review_count": 1, "dismiss_stale_reviews_on_push": true, "require_code_owner_review": true, "require_last_push_approval": false, "required_review_thread_resolution": true, "automatic_copilot_code_review_enabled": false, "allowed_merge_methods": [ "merge" ] } }, { "type": "required_status_checks", "parameters": { "strict_required_status_checks_policy": true, "do_not_enforce_on_create": true, "required_status_checks": [ { "context": "Run CodeQL analysis (actions, none)" }, { "context": "Run CodeQL analysis (javascript-typescript, none)" }, { "context": "Run build for testing" }, { "context": "Run lint scanning" }, { "context": "Run unit tests" } ] } }, { "type": "code_scanning", "parameters": { "code_scanning_tools": [ { "tool": "CodeQL", "security_alerts_threshold": "high_or_higher", "alerts_threshold": "errors" } ] } } ], "bypass_actors": [] }dev branches:{ "name": "dev branches", "target": "branch", "source_type": "Repository", "enforcement": "active", "conditions": { "ref_name": { "exclude": [], "include": [ "refs/heads/dev-*", "refs/heads/scrum*", "refs/heads/SCRUM*" ] } }, "rules": [ { "type": "deletion" }, { "type": "non_fast_forward" }, { "type": "required_signatures" } ], "bypass_actors": [] }no tags:{ "name": "no tags", "target": "tag", "source_type": "Repository", "enforcement": "active", "conditions": { "ref_name": { "exclude": [ "refs/tags/v*.*.*" ], "include": [ "~ALL" ] } }, "rules": [ { "type": "deletion" }, { "type": "non_fast_forward" }, { "type": "creation" }, { "type": "update" } ], "bypass_actors": [] }version tags:{ "name": "version tags", "target": "tag", "source_type": "Repository", "enforcement": "active", "conditions": { "ref_name": { "exclude": [], "include": [ "refs/tags/v*.*.*" ] } }, "rules": [ { "type": "deletion" }, { "type": "non_fast_forward" }, { "type": "update" } ], "bypass_actors": [] }
-
Actions permissions: Allow all actions and reusable workflowsRequire actions to be pinned to a full-length commit SHA: falseApproval for running fork pull request workflows from contributors: Require approval for all external contributorsWorkflow permissions: Read repository contents and packages permissionsAllow GitHub Actions to create and approve pull requests: false
-
production-dbandproduction-back: for CD actionDeployment protection rules:Required reviewers:reviewers: only super-adminsPrevent self-review: false
Wait timer: false
Allow administrators to bypass configured protection rules: falseDeployment branches and tags:Branch rules:Tag rules:v*.*.*
Environment secrets:DOCKERHUB_TOKEN: Docker Hub token for pushing images
Environment variables:DOCKERHUB_USERNAME: Docker Hub usernameDOCKERHUB_IMAGE: Docker Hub image nameDOCKER_BUILD_CONTEXT: Docker build context (default:.)DOCKER_CONFIG_FOLDER: Docker config folder (default:./.docker)
release: for release workflowDeployment protection rules:Required reviewers:reviewers: only super-adminsPrevent self-review: false
Wait timer: false
Allow administrators to bypass configured protection rules: falseDeployment branches and tags:Branch rules:dev
Tag rules:
Environment secrets:ADMIN_TOKEN: Admin GitHub user token with contents write permission on that repo
-
Dependency graph: EnableAutomatic dependency submission: Enabled
Dependabot:Dependabot alerts: Enable
Protection rules:Check runs failure threshold:Security alert severity level: High or higherStandard alert severity level: Only errors
Secret Protection: EnablePush protection: Enable
-