{"id":14483517,"url":"https://github.com/betagouv/aides-jeunes","last_synced_at":"2025-04-04T22:02:16.987Z","repository":{"id":15662099,"uuid":"18399519","full_name":"betagouv/aides-jeunes","owner":"betagouv","description":"Un simulateur global des prestations sociales françaises pour les jeunes.","archived":false,"fork":false,"pushed_at":"2024-10-29T12:21:08.000Z","size":67841,"stargazers_count":79,"open_issues_count":80,"forks_count":31,"subscribers_count":14,"default_branch":"main","last_synced_at":"2024-10-29T13:32:36.513Z","etag":null,"topics":["mes-aides","openfisca","openfisca-server"],"latest_commit_sha":null,"homepage":"https://mes-aides.1jeune1solution.beta.gouv.fr/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/betagouv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-04-03T10:42:21.000Z","updated_at":"2024-10-28T14:24:25.000Z","dependencies_parsed_at":"2023-09-27T16:26:00.135Z","dependency_job_id":"e53cbb83-2c2e-41e5-8493-61248d163c73","html_url":"https://github.com/betagouv/aides-jeunes","commit_stats":{"total_commits":6366,"total_committers":67,"mean_commits":95.01492537313433,"dds":0.7628023876845743,"last_synced_commit":"c975c85cac4603e7429a953fdf85d4e113b6c53e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betagouv%2Faides-jeunes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betagouv%2Faides-jeunes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betagouv%2Faides-jeunes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/betagouv%2Faides-jeunes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/betagouv","download_url":"https://codeload.github.com/betagouv/aides-jeunes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256093,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mes-aides","openfisca","openfisca-server"],"created_at":"2024-09-03T00:01:49.573Z","updated_at":"2025-04-04T22:02:16.968Z","avatar_url":"https://github.com/betagouv.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"## Cette documentation est technique. Pour plus d'informations sur le [simulateur d'aides pour les jeunes](https://mes-aides.1jeune1solution.beta.gouv.fr), regardez notre [wiki](https://github.com/betagouv/aides-jeunes/wiki).\n\n\u003e L'interface utilisateur (et le serveur principal) du [simulateur d'aides et de prestations sociales pour les jeunes](https://mes-aides.1jeune1solution.beta.gouv.fr). Il est basé sur simulateur socio-fiscal libre [Openfisca](https://www.openfisca.fr/).\n\n# Setup\n\n## Stack\n\n- VueJS\n- NodeJS\n- MongoDB\n- OpenFisca (Python, numpy)\n- NetlifyCMS ([config](https://github.com/betagouv/aides-jeunes/blob/main/contribuer/public/admin/config.yml))\n  - [website](https://contribuer-aides-jeunes.netlify.app)\n- Fabric ([fabfile](https://github.com/betagouv/aides-jeunes-ops/blob/main/fabric.yml))\n\n## 3rd parties\n\n- Github Actions ([config](https://github.com/betagouv/aides-jeunes/blob/main/.github/workflows/))\n  - Continuous integration and deployment\n- Netlify\n  - Deloy previews\n- SMTP server\n- Matomo ([stats.beta.gouv.fr](https://stats.beta.gouv.fr/index.php?module=CoreHome\u0026action=index\u0026idSite=63\u0026period=range\u0026date=previous30))\n  - [Dedicated site for usage data and impact](https://betagouv.github.io/mes-aides-analytics/) [source](https://github.com/betagouv/mes-aides-analytics)\n- Sentry\n  - [backend](https://sentry.io/organizations/betagouv-f7/projects/aides-jeunes-node/?project=5709109)\n  - [frontend](https://sentry.io/organizations/betagouv-f7/projects/aides-jeunes-front/?project=5709078)\n\n# Front only install\n\nIf you want to play with the UI, you can be set up very quickly:\n\n```bash\nnpm ci\nnpm run front\n```\n\nCf. `package.json` for more on the underlying commands.\n\nThe application should be accessible at `localhost:8080`.\n\n# Full install\n\n## System dependencies\n\nMake sure `node` 18.x is installed on your machine:\n\n### Ubuntu\n\nAnd also `build-essential`, `mongodb` are installed on your machine:\n\n```sh\nsudo apt-get install build-essential\nsudo apt-get install mongodb\n```\n\n### MacOs\n\nAnd also `brew` is installed on your machine:\n\n```sh\nbrew tap mongodb/brew # Download official homebrew formula for MongoDb\nbrew update # Update Homebrew and all existing formulae\nbrew install mongodb-community@7.0 # Install MongoDb\n```\n\n### For all platforms\n\nThe runtime is Node 18.x for the web application, and Python \u003e= 3.9 for Openfisca.\n\nYou can for example use [`nvm`](https://github.com/creationix/nvm) to install this specific version.\n\nYou will need [`pip`](https://pip.pypa.io/) to install Openfisca.\n\n## Application\n\nRun the following from the root of the project to install the dependencies\n\n```sh\nnpm ci\n```\n\n## Openfisca\n\nThere are 2 ways to run Openfisca:\n\n- either by installing its dependencies in a Python virual environment locally on your machine\n- or by using Docker to pull and build an image with the required dependencies\n\n### Install Openfisca in a virtual environment\n\nYou should [install Python 3 in a virtual environment](https://virtualenv.pypa.io/en/stable/) to prevent yourself from messing with your main python installation. The instructions below rely on the built-in `venv` module so that there are no additional external dependencies:\n\n```bash\npython3 -m venv .venv   # create the virtual environment in the .venv folder\nsource .venv/bin/activate  # activate the virtual environment\npip install pip --upgrade  # make sure we're using the latest pip version\nnpm run install-openfisca  # install dependencies\n```\n\nThen, to start the OpenFisca server, simply run `source .venv/bin/activate` followed by `npm run openfisca`.\n\nOpenFisca dependencies are specified in [openfisca/requirements.txt](https://github.com/betagouv/aides-jeunes/blob/main/openfisca/requirements.txt), a basic [Python requirements file](https://pip.pypa.io/en/stable/reference/pip_install/#example-requirements-file). It is possible to refer to non-production commit hashs but is prefered to use _main-merged_ commits.\n\n### Install and run Openfisca in a docker container\n\nIf you want to run Openfisca without having to install a specific version of Python or create a virtual environment you can use the docker file provided to run Openfisca in a container. From the root of the project run the following command to build the docker image:\n\n```bash\ndocker build -f openfisca/Dockerfile ./openfisca -t openfisca\n```\n\n### Development mode\n\nIf you are working on `openfisca-france` and want to use your local version:\n\n```\ncd (...)/openfisca-france\npip install --editable .\n```\n\n## Test in production mode\n\nIf you want to test locally the app in production mode:\n\n```sh\nnpm run build\nnpm run start\n```\n\n## Usage\n\nFirst, start a Mongo server:\n\n```sh\nnpm run db\n```\n\nThen, in another shell you will need to start openfisca. If you installed it locally activate the virtual environment (run `source .venv/bin/activate`) and start the Openfisca server:\n\n```sh\nOPENFISCA_WORKERS=1 npm run openfisca\n```\n\nIf instead you want to run Openfisca in a docker container run:\n\n```bash\ndocker run -d -p 2000:2000 openfisca\n```\n\n(note that in that case Openfisca will run in the background and you will have to run `docker ps` and `docker stop XXXXX` where XXXXX is the container ID to stop Openfisca)\n\nFinally, in a third shell, start the server:\n\n```sh\nnpm run serve\n```\n\n# Testing\n\nThere are several levels of tests:\n\n- Unit tests are executed by [Vitest](https://vitest.dev/) and run with `npm test`.\n- End-to-end test are executed with [Cypress](https://www.cypress.io/) with `npm run cypress`\n\nYou can safely use `npm test \u0026\u0026 npm run cypress` to drive your developments.\n\n## Development Environment and Cypress\n\nIn Cypress tests, we verify that email functionality works. To check this locally, you need to copy and paste the environmental variables from .env.e2e to your .env file (and create the .env file if you don't already have one).\n\n## Email\n\nWe use the framework [MJML](https://mjml.io/) to design and integrate the templates. [Tipimail](https://fr.tipimail.com) is our service to send emails.\n\nThe development server for emails can be easily start with: `npm run tools:serve-mail`\n\nIf you want to verify the email sending process, you can generate a set of the required `SMTP_*` environment variables by running `ts-node tools/create-temp-smtp-server.ts` to generate a test account on `https://ethereal.email`.\n\n## Linting and format\n\nWe use [ESLint](https://eslint.org/) as a linter and [Prettier](https://prettier.io/) to format the codebase.\nWe also utilize some ESLint plugins, such as [vue-eslint](https://eslint.vuejs.org/user-guide/) and [eslint-plugin-cypress](https://github.com/cypress-io/eslint-plugin-cypress), to provide a support for tests and framework.\n\n# Continuous deployment\n\nSSHs keys were generated to [run scripts](http://man.openbsd.org/sshd#command=%22command%22) on the production server.\n\nThe `main` and `dev` branches are automatically deployed on the production server when they are updated using a [continuous deployment script](https://github.com/betagouv/aides-jeunes/actions/workflows/cd.yml).\n\nNote that it is also possible to re-trigger a deployment manually by clicking on `Run workflow` button on the [continuous deployment's page](https://github.com/betagouv/aides-jeunes/actions/workflows/cd.yml) and selecting either the `main` or `dev` branch.\n\nTo access the applications server it is possible to connect to it with a registered public key using ssh:\n\n```sh\nssh debian@equinoxe.mes-aides.1jeune1solution.beta.gouv.fr\n```\n\n# Other tools scripts \u0026 tips\n\nIn order to use those tools you need to build the server at least once using the command `npm run build:server`.\n\n- `npm run husky` installs git hooks used to facilitate development and reduce the CI running time. We use Talisman to to ensure that potential secrets or sensitive information do not leave the developer's workstation. You need to install Talisman before : https://github.com/thoughtworks/talisman/releases or `brew install talisman`. To skip talisman, you can use -n when you commit.\n\n- `npm run tools:check-links-validity` validates links to 3rd parties in benefits files.\n\n- `npm run tools:cleaner` cleans simulations data older than 31 days.\n\n- `npm run tools:evaluate-benefits \u003csimulationId\u003e` evaluates benefits linked to a simulation id.\n\n- `npm run tools:generate-missing-institutions-aides-velo` generates missing institutions for the package `aides-velo`.\n\n- `npm run tools:download-incitations-covoiturage-generate-missing-institutions` download new carpooling incentives and generates missing epci for the Open Data `Registre de Preuve de Covoiturage`.\n\n- `npm run tools:geographical-benefits-details` gets the relevant benefits for each commune.\n\n- `npm run tools:get-all-steps` gets all the steps and substeps of a simulation.\n\n- `npm run tools:serve-mail` generates emails which contain the result of a simulation or a survey.\n\n- `npm run tools:test-benefits-geographical-constraint-consistency` validates geographical constraint consistency of benefits.\n\n- `npm run tools:test-definition-periods`validates the periods of openfisca requested variables.\n\n- [Locally](http://localhost:8080/simulation/resultats?debug) or on [production](https://mes-aides.1jeune1solution.beta.gouv.fr/simulation/resultats?debug), it is possible to visualize all the available benefits of the simulator. It is done by adding `debug` as a parameter. It is also possible to set `debug=ppa,rsa` to choose which benefits are listed.\n\n- Adding `debug=parcours` as a parameter, show a debug version of all the steps in the simulator, [locally](https://localhost:8080/simulation/individu/demandeur/date_naissance?debug=parcours) and [production](https://mes-aides.1jeune1solution.beta.gouv.fr/simulation/individu/demandeur/date_naissance?debug=parcours).\n\n- [OpenFisca tracer](https://openfisca.github.io/tracer/) allows you to debug OpenFisca computations. ([source](https://github.com/openfisca/tracer))\n\n# Export simulations data from database\n\nIt is possible to generate simulation statistics from the database running the commande `npm run tools:generate-mongo-stats`.\n\nThis will generate 3 csv files in the `dist/documents` folder:\n\n- `monthly_activite.csv` that lists the number of simulations per activity for each month\n- `monthly_age.csv` that lists the number of simulations per age for each month\n- `monthly_geo.csv` that lists the number of simulations per epci, departement and regions for each month\n\n## Decap CMS development\n\nIt is possible to locally debug changes in Decap CMS configuration.\n\n- `npm ci` and `npm run dev` should be ran from `contribuer`.\n- Decap CMS should now be accessible at `http://localhost:3000/admin/index.html`\n\nIf you want changes to be made locally instead of generating pull requests in production:\n\n- First, [contribuer/public/admin/config.yml#L19](https://github.com/betagouv/aides-jeunes/blob/main/contribuer/public/admin/config.yml#L19) ([`local_backend: true`](https://decapcms.org/docs/working-with-a-local-git-repository)) must be uncommented;\n- `npx netlify-cms-proxy-server` should be ran from `.` and\n\n## Check Link Validity\n\nSome parameters can be use to debug the command\n\n- `--dry-run` : this command is useful to not send update/new row to Grist\n- `--no-priority` : without getting priority from analytic data\n- `--only [slug benefit]` : work on specific benefit\n\nHere is an example of how using this parameters\n`npm run tools:check-links-validity -- --dry-run`\n\n## Download carpooling incentives and generate missing ecpi\n\nThe data source comes from this : https://www.data.gouv.fr/fr/datasets/conditions-des-campagnes-dincitation-financiere-au-covoiturage/\nWe use Grist to add custom informations like, if a benefit is link to an institution or epci, ...\nOne parameter can be use to debug the command\n\n- `--no-download` : avoid download new data from Grist\n\nHere is an example of how using this parameters\n`npm run tools:download-incitations-covoiturage-generate-missing-institutions -- --no-download`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetagouv%2Faides-jeunes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbetagouv%2Faides-jeunes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbetagouv%2Faides-jeunes/lists"}