{"id":15672647,"url":"https://github.com/scrogson/acme","last_synced_at":"2025-05-06T21:44:27.360Z","repository":{"id":142411870,"uuid":"100820185","full_name":"scrogson/acme","owner":"scrogson","description":"Introducing Phoenix","archived":false,"fork":false,"pushed_at":"2018-02-19T16:28:01.000Z","size":92,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-09T03:08:47.635Z","etag":null,"topics":["ecto","elixir","phoenix"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scrogson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-08-19T20:40:17.000Z","updated_at":"2023-09-01T10:54:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"bbc074d9-9e00-4efa-83dc-4f477eeae37c","html_url":"https://github.com/scrogson/acme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrogson%2Facme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrogson%2Facme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrogson%2Facme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scrogson%2Facme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scrogson","download_url":"https://codeload.github.com/scrogson/acme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242833304,"owners_count":20192726,"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":["ecto","elixir","phoenix"],"created_at":"2024-10-03T15:29:29.820Z","updated_at":"2025-03-10T10:31:12.485Z","avatar_url":"https://github.com/scrogson.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introducing Phoenix - Training Application\n\n## Course Description\n\nPhoenix is an Elixir web framework for building scalable web services for the\nmodern web. In this training, we’ll take a guided tour of the framework, going\nfrom the very basics, to building our own realtime application.\n\nYou’ll see the framework’s foundations, core components, and learn how to use\nPhoenix to write powerful web services.\n\nWe’ll start by exploring the foundations of the framework in Elixir’s Plug\nlibrary, followed by the core components of Phoenix’s Router and Controller\nlayers.\n\nNext, we’ll review the View layer and build an application together as we learn\neach concept.\n\nWe’ll finish by using the PubSub layer to add realtime functionality to our\napplication.\n\nAlong the way, attendees will see how to apply advanced features like router\npipelines and plug middelware and receive tips on how to structure a Phoenix\napplication for real-world services.\n\n## Prerequisites\n\nThis course is designed for people who have prior experience with other web\nframeworks and want to learn how to get started with Phoenix.\n\nI will not assume that you have any prior experience with Elixir in this course.\nSo if you are a beginner, have no fear. The course format encourages open-dialog\nand learning by asking questions along the way.\n\nIn order to ensure that we get started in a timely manner. Please make sure to\nget all the dependencies (outlined below) installed prior to the training.\n\nPlease take a look at this list and make sure to install anything necessary for\nyour system. Having dependencies installed in advance will allow us to hit the\nground running and cover the most material possible.\n\n## Installing dependencies\n\n### Elixir\n\nPhoenix is written in Elixir, and our application code will also be written in\nElixir. We won't get far in a Phoenix app without it! The Elixir site maintains\na great [Installation Page](http://elixir-lang.org/install.html) to help.\n\nWe need Elixir 1.4 or higher for this course.\n\nIf we have just installed Elixir for the first time, we will need to install the\nHex package manager and Rebar as well. Hex is necessary to get a Phoenix app\nrunning (by installing dependencies) and to install any extra dependencies we might need\nalong the way. Rebar is a similar tool used by many existing Erlang projects\nthat we may depend on.\n\nHere's the command to install Hex and Rebar:\n\n```console\n$ mix local.hex\n$ mix local.rebar\n```\n\nIf you are not yet familiar with Elixir, I recommend taking a look at the excellent\n[Getting Started](http://elixir-lang.org/getting-started/introduction.html) guide.\n\n### Erlang\n\nElixir code compiles to Erlang byte code to run on the Erlang virtual machine.\nWithout Erlang, Elixir code has no virtual machine to run on, so we need to\ninstall Erlang as well.\n\nWhen we install Elixir using instructions from the Elixir [Installation Page](http://elixir-lang.org/install.html),\nwe will usually get Erlang too. If Erlang was not installed along with Elixir,\nplease see the [Erlang Instructions](http://elixir-lang.org/install.html#installing-erlang)\nsection of the Elixir Installation Page for instructions.\n\n### Node.js (\u003e= 5.0)\n\nPhoenix will use [brunch.io](http://brunch.io/) to compile static assets\n(javascript, css, etc), by default. Brunch.io uses the node package manager\n(npm) to install its dependencies, and npm requires node.js.\n\nWe can get node.js from the [download page](https://nodejs.org/download/). When\nselecting a package to download, it's important to note that Phoenix requires\nversion 5.0 or greater.\n\nMac OS X users can also install node.js via [homebrew](http://brew.sh/).\n\nDebian/Ubuntu users might see an error that looks like this:\n\n```console\nsh: 1: node: not found\nnpm WARN This failure might be due to the use of legacy binary \"node\"\n```\n\nThis is due to Debian having conflicting binaries for node: [discussion on\nstackoverflow](http://stackoverflow.com/questions/21168141/can-not-install-packages-using-node-package-manager-in-ubuntu)\n\nThere are two options to fix this problem, either:\n\n- install nodejs-legacy:\n```console\n$ apt-get install nodejs-legacy\n```\nor\n- create a symlink\n```console\n$ ln -s /usr/bin/nodejs /usr/bin/node\n```\n\n### PostgreSQL\n\nWe will be interacting with a database while building our application. Phoenix\nuses the database abstraction library [Ecto](https://github.com/elixir-ecto/ecto)\nwhich supports a number of databases.\n\nFor this course, we'll be using PostgreSQL for consistency across attendees.\n\nThe PostgreSQL wiki has [installation guides](https://wiki.postgresql.org/wiki/Detailed_installation_guides) for\na number of different systems.\n\n#### Optional configuration\n\nBy default, Phoenix expects to connect to the database with user of `postgres`\nhaving a password of `postgres`. If this is not the case for your PostgreSQL\ninstallation, you can change this in `config/dev.exs` like so:\n\n```ex\n# Configure your database\nconfig :workshop, Workshop.Repo,\n  adapter: Ecto.Adapters.Postgres,\n  username: \"\u003cchange-me\u003e\",\n  password: \"\u003cchange-me\u003e\",\n  database: \"workshop_dev\",\n  hostname: \"localhost\",\n  pool_size: 10\n```\n\nSome installations (installing via homebrew or using Postgres.app)\nwill use your username with no password.\n\n### inotify-tools (for linux users)\n\nThis is a Linux-only filesystem watcher that Phoenix uses for live code\nreloading. (Mac OS X or Windows users can safely ignore it.)\n\nLinux users need to install this dependency. Please consult the\n[inotify-tools wiki](https://github.com/rvoicilas/inotify-tools/wiki) for\ndistribution-specific installation instructions.\n\n### Building this application\n\nNow that we have all the dependencies installed, let's clone, build, compile,\nand start it up!\n\nIf you haven't already, clone this repo and change into the directory of your\nchoosing:\n\n```shell\n$ git clone https://github.com/scrogson/acme\n$ cd acme\n```\n\nNext, we'll need to fetch our Elixir dependencies:\n\n```shell\n$ mix deps.get\n```\n\nCreate the database for our application:\n\n```shell\n$ mix ecto.create\n```\n\nIf you see this error:\n\n```shell\nFATAL (invalid_authorization_specification): role \"postgres\" does\nnot exist\n```\n\nYou will need to update your `username` and `password` in `config/dev.exs` as\nexplained above in [Optional configuration](#optional-configuration).\n\nIf you installed Postgres with `homebrew`, you can alternatively add\nthe `postgres` user like so:\n\n```shell\n$(brew --prefix postgresql)/bin/createuser -s postgres\n```\n\nInstall the nodejs dependencies:\n\n```shell\n$ cd assets\n$ npm install\n```\n\nWe are all set! Now it's time to start the application:\n\n```shell\n$ mix phx.server\n```\n\nYou can also run your app inside IEx (Interactive Elixir) with:\n\n```shell\n$ iex -S mix phx.server\n```\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from\nyour browser and see your new Phoenix app running. Yay!\n\n## Other dependencies\n\nWe will be using an elixir package which requires a C compiler such\nas `gcc` and `make` to be installed on you system.\n\nUbuntu and Debian-based systems can get `gcc` and `make` by installing\n`build-essential` package. Also `erlang-dev` may be needed if not included in your\nErlang/OTP version.\n\n## Having trouble?\n\nIt is vital that we get all the setup dealt with prior to the workshop so that\nwe can focus on learning as much as possible with the limited time. Please feel\nfree to [contact me](mailto:scrogson@gmail.com) directly if you have any trouble\nwith getting anything setup.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrogson%2Facme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrogson%2Facme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrogson%2Facme/lists"}