To run micronation, you will need :
- NodeJS >= 14.17.3
- Yarn 1.21 as your package manager
- A MongoDB database for data storage running on port 27018 for test and 27017 for usual app run (this will be in a .env file soon)
First, clone the repository with :
git clone https://github.com/Sorikairox/micronation
Install all dependencies by using yarn install
in back
and front
folders.
Copy .env.example
content to a .env
, .env.test.integration
and .env.test.e2e
file with your own configuration for each case.
The entire project is meant to be considered as an experiment, thus is made to be visited from the Fouloscopie plateform.
As a result, expose the front server on port 3500
and the back one on port 3000
and then visit https://preprod.fouloscopie.com/experiment/1
Microservices are built with NestJS framework and use their scripts.
Before running, library
must be built at least once with tsc --build library/tsconfig.json
(or cd library && yarn tsc
).
yarn start:dev
to run and watch for changesyarn start
to run the appyarn test
to run base testsyarn test:integration
to run integration testsyarn test:e2e
to run end-to-end tests
The Nuxt environnement is being used for the front integration, in addition with yarn
scripts.
Go to the front
folder and enter yarn
to install all the dependencies.
Then, start the dev mode with yarn dev
or build the entire project with yarn build
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
We use DDD (Domain Driven Design) principles.
- The entrypoint is named
main.ts
. - Every class must be defined in its own file.
- Files are named after the class they define (PascalCase). Example:
FlagRepository.ts
is expected to contain the definition of theFlagRepository
class. - Files are sorted in folders that make a domain structure. Example:
flag/pixel/Pixel.ts
is located in the domainpixel
which is a subdomain of the domainflag
.
- Test files are named after the class (PascalCase) or domain (kebab-case) they test and end with
.spec.ts
,.spec-integration.ts
or.spec-e2e.ts
. Example:FlagService.spec-integration.ts
is expected to contain all integration tests of theFlagService
class. - Test files are located in a
spec
folder inside the domain folder they relate to. Example: all tests of stuff in the domainflag
are located inflag/spec/
. - End to end tests are located in the
test
folder at the root of the module.