{"id":18256960,"url":"https://github.com/mediacomem/minesweeper","last_synced_at":"2025-04-06T23:18:01.662Z","repository":{"id":73832490,"uuid":"439468382","full_name":"MediaComem/minesweeper","owner":"MediaComem","description":"A minesweeper web application to deploy for the architecture \u0026 deployment course","archived":false,"fork":false,"pushed_at":"2024-12-15T01:56:21.000Z","size":332,"stargazers_count":4,"open_issues_count":0,"forks_count":105,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-30T21:13:51.883Z","etag":null,"topics":["alpinejs","elixir-lang","minesweeper-game","phoenix-framework","postgresql-database"],"latest_commit_sha":null,"homepage":"https://minesweeper.archidep.ch","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MediaComem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-12-17T21:48:39.000Z","updated_at":"2024-12-15T01:56:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"59696565-6642-4b9d-a4da-cccd5041fcc1","html_url":"https://github.com/MediaComem/minesweeper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fminesweeper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fminesweeper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fminesweeper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MediaComem%2Fminesweeper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MediaComem","download_url":"https://codeload.github.com/MediaComem/minesweeper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247563943,"owners_count":20958971,"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":["alpinejs","elixir-lang","minesweeper-game","phoenix-framework","postgresql-database"],"created_at":"2024-11-05T10:24:18.844Z","updated_at":"2025-04-06T23:18:01.641Z","avatar_url":"https://github.com/MediaComem.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minesweeper\n\nA [minesweeper][minesweeper] web application. The backend has been developed\nwith the [Phoenix web framework][phoenix] written in [Elixir][elixir]. The\nfrontend has been developed with the [Alpine.js JavaScript framework][alpinejs].\n\n[![build](https://github.com/MediaComem/minesweeper/actions/workflows/build.yml/badge.svg)](https://github.com/MediaComem/minesweeper/actions/workflows/build.yml)\n[![license](https://img.shields.io/github/license/MediaComem/minesweeper)](https://opensource.org/licenses/MIT)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Requirements](#requirements)\n- [Initial setup](#initial-setup)\n- [Run the automated tests](#run-the-automated-tests)\n- [Run the application in development mode](#run-the-application-in-development-mode)\n- [Run the application in production mode](#run-the-application-in-production-mode)\n- [Updating](#updating)\n- [Configuration](#configuration)\n  - [Environment variables](#environment-variables)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n\n## Requirements\n\nTo run the application, you will need:\n\n* [PostgreSQL][postgresql] 13-17 and a database with the [uuid-ossp\n  extension][postgresql-uuid-ossp]\n\nAdditionally, to compile the backend and frontend, you will need:\n\n* One of the following Elixir and Erlang/OTP combinations:\n  * [Elixir][elixir] 1.17.x with [Erlang/OTP][erlang] 25-27\n  * [Elixir][elixir] 1.16.3 with [Erlang/OTP][erlang] 25-26\n  * [Elixir][elixir] 1.15.8 with [Erlang/OTP][erlang] 25-26\n  * [Elixir][elixir] 1.14.5 with [Erlang/OTP][erlang] 25-26\n* [Node.js][node] 18, 20 or 22\n\n\n\n## Initial setup\n\n* Create a PostgreSQL user named `minesweeper` for the application (**be sure to\n  remember the password you type**, you will need it later):\n\n  ```bash\n  $\u003e sudo -u postgres createuser --interactive --pwprompt minesweeper\n  Enter password for new role:\n  Enter it again:\n  Shall the new role be a superuser? (y/n) n\n  Shall the new role be allowed to create databases? (y/n) n\n  Shall the new role be allowed to create more new roles? (y/n) n\n  ```\n\n  \u003e You should answer no to all questions. The `minesweeper` user does not need\n  \u003e any special privileges.\n* Create a PostgreSQL database named `minesweeper` and owned by the\n  `minesweeper` user:\n\n  ```bash\n  $\u003e sudo -u postgres createdb --owner minesweeper minesweeper\n  ```\n* Create the [uuid-ossp extension][postgresql-uuid-ossp] in the `minesweeper`\n  database:\n\n  ```bash\n  $\u003e sudo -u postgres psql -c 'CREATE EXTENSION \"uuid-ossp\";' minesweeper\n  ```\n* Clone the repository:\n\n  ```bash\n  $\u003e git clone https://github.com/MediaComem/minesweeper.git\n  ```\n* Download dependencies:\n\n  ```bash\n  $\u003e cd minesweeper\n  $\u003e mix deps.get\n  ```\n* Compile the application (*this might take a while the first time*):\n\n  ```bash\n  $\u003e mix compile\n  ```\n* Install frontend dependencies:\n\n  ```bash\n  $\u003e mix frontend.install\n  ```\n* Configure the application. **You can do this in one of two ways:**\n\n  * Set any of the [documented environment variables](#environment-variables),\n    for example:\n\n    ```bash\n    export MINESWEEPER_DATABASE_URL=\"ecto://minesweeper:mysecretpassword@localhost:5432/minesweeper\"\n    export MINESWEEPER_HTTP_PORT=3000\n    export MINESWEEPER_SECRET_KEY_BASE=\"mysecretkey\"\n    ```\n  * Create a local configuration file based on the provided sample:\n\n    ```bash\n    cp config/local.sample.exs config/local.exs\n    ```\n\n    Edit `config/local.exs` with your favorite editor:\n\n    ```bash\n    nano config/local.exs\n    vim config/local.exs\n    ```\n\n    Read the instructions contained in the file and fill in the database\n    connection URL and web endpoint settings.\n\n    \u003e The `config/local.exs` file will be ignored by Git.\n    \u003e\n    \u003e Configuration parameters provided this way will be bundled in the\n    \u003e compiled production release.\n\n  \u003e You can use both the local configuration file and environment variables, in\n  \u003e which case the environment variables specified at runtime will always\n  \u003e override the corresponding settings in the configuration file.\n* Migrate the production database:\n\n  ```bash\n  $\u003e mix ecto.migrate\n  ```\n\n\n\n## Run the automated tests\n\nFollow these instructions to execute the project's [automated test\nsuite][automated-tests]:\n\n* Create a separate PostgreSQL test database named `minesweeper-test` also owned\n  by the `minesweeper` user:\n\n  ```bash\n  $\u003e sudo -u postgres createdb --owner minesweeper minesweeper-test\n  ```\n* Create the [uuid-ossp extension][postgresql-uuid-ossp] in the\n  `minesweeper-test` database:\n\n  ```bash\n  $\u003e sudo -u postgres psql -c 'CREATE EXTENSION \"uuid-ossp\";' minesweeper-test\n  ```\n* Compile the application in test mode (*this might take a while the first\n  time*):\n\n  ```bash\n  $\u003e MIX_ENV=test mix compile\n  ```\n* Migrate the test database:\n\n  ```bash\n  $\u003e MIX_ENV=test mix ecto.migrate\n  ```\n* Run the automated tests:\n\n  ```bash\n  $\u003e MIX_ENV=test mix test\n  ```\n\nYou should see no errors. Every green dot represents a passed test.\n\n\u003e For more information, read the [tests' source code in the `test`\n\u003e directory](./test).\n\n\n\n## Run the application in development mode\n\nYou can run the application in development mode (with live reload) using the\nfollowing command:\n\n```bash\n$\u003e mix phx.server\n```\n\nThe application runs on port 3000 by default. If that port is already in use,\nyou can use the `http.port` parameter in the local configuration file or the\n`$MINESWEEPER_HTTP_PORT` environment variable to switch to another port, for\nexample:\n\n```bash\n$\u003e MINESWEEPER_HTTP_PORT=3001 mix phx.server\n```\n\nVisit `http://\u003cyour-server-address\u003e:\u003cport\u003e` in your browser and you should see\nthe application running.\n\n\u003e Once you are done, you can stop the `mix phx.server` command running in your\n\u003e terminal by typing Ctrl-C twice.\n\n\n\n## Run the application in production mode\n\n* Compile the application in production mode (*this might take a while the first time*):\n\n  ```bash\n  $\u003e MIX_ENV=prod mix compile\n  ```\n* Build the frontend in production mode:\n\n  ```bash\n  $\u003e MIX_ENV=prod mix do frontend.build, phx.digest\n  ```\n\n  Your reverse proxy can serve the compiled assets out of the `priv/static`\n  directory.\n* Assemble a [mix release][mix-release] to run the application in production\n  mode:\n\n  ```bash\n  $\u003e MIX_ENV=prod mix release\n  ```\n\nYou can run the production manually by executing the following command from the\nrepository:\n\n```bash\n_build/prod/rel/minesweeper/bin/minesweeper start\n```\n\nAgain, if port 3000 is already in use, you can use the `http.port` parameter in\nthe local configuration file or the `$MINESWEEPER_HTTP_PORT` environment\nvariable to switch to another port, for example:\n\n```bash\n$\u003e MINESWEEPER_HTTP_PORT=3001 _build/prod/rel/minesweeper/bin/minesweeper start\n```\n\n\u003e To run the application with a process manager like [systemd][systemd], you can\n\u003e run the same command except that it should be an absolute path. For example:\n\u003e\n\u003e ```bash\n\u003e $\u003e /path/to/minesweeper/_build/prod/rel/minesweeper/bin/minesweeper start\n\u003e ```\n\n\n\n## Updating\n\nTo update the application after getting the latest changes, execute the\nfollowing commands in the application's directory:\n\n```bash\n# Update backend \u0026 frontend dependencies\n$\u003e mix do deps.get, frontend.update\n\n# Apply any pending database migrations\n$\u003e MIX_ENV=prod mix ecto.migrate\n\n# Rebuild the frontend in production mode and reassemble the Mix release\n$\u003e MIX_ENV=prod mix do frontend.build, phx.digest, release --overwrite\n```\n\nYou may then restart the application.\n\n\n\n## Configuration\n\nYou can configure the application in two ways:\n\n* Either create a `config/local.exs` file in the application's directory (see\n  the `config/local.sample.exs` sample file).\n* Or use the environment variables documented below.\n\nYou may also use both. The parameters in the local configuration file are\nbundled in the compiled production release. Note that the environment variables,\nif present at runtime, will always take precedence and override the\ncorresponding parameters from the configuration file.\n\n### Environment variables\n\n| Environment variable                         | Default value                              | Description                                                                                              |\n| :------------------------------------------- | :----------------------------------------- | :------------------------------------------------------------------------------------------------------- |\n| `MINESWEEPER_DATABASE_URL` or `DATABASE_URL` | `ecto://minesweeper@localhost/minesweeper` | Database connection URL (format is `ecto://\u003cusername\u003e[:\u003cpassword\u003e]@\u003chost\u003e[:\u003cport\u003e]/\u003cdatabase-name\u003e`)     |\n| `MINESWEEPER_HTTP_PORT` or `PORT`            | `3000`                                     | The port the HTTP server listens on.                                                                     |\n| `MINESWEEPER_SECRET_KEY_BASE`                | -                                          | A secret key used as a base to generate secrets for encrypting and signing data (e.g. cookies \u0026 tokens). |\n| `MINESWEEPER_URL`                            | `http://localhost:3000`                    | The base URL at which the application is publicly available.                                             |\n\n\u003e You can generate a strong secret key base by running the `mix phx.gen.secret`\n\u003e command in the project's directory.\n\n\n\n[alpinejs]: https://alpinejs.dev\n[automated-tests]: https://en.wikipedia.org/wiki/Test_automation\n[elixir]: https://elixir-lang.org\n[erlang]: https://www.erlang.org\n[minesweeper]: https://en.wikipedia.org/wiki/Minesweeper_(video_game)\n[mix-release]: https://hexdocs.pm/mix/1.12/Mix.Tasks.Release.html\n[node]: https://nodejs.org\n[npm]: https://www.npmjs.com\n[phoenix]: https://www.phoenixframework.org\n[postgresql]: https://www.postgresql.org\n[postgresql-uuid-ossp]: https://www.postgresql.org/docs/current/uuid-ossp.html\n[systemd]: https://en.wikipedia.org/wiki/Systemd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fminesweeper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediacomem%2Fminesweeper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediacomem%2Fminesweeper/lists"}