Phoenix app as dependency

Hi guys,

I have a phoenix project that I would like to use as part of another project I have which is a console app style thing.

Ideally i would like to be able to start the console app with some command line params and it starts the webserver hosting the phoenix app

I’ve added the phoenix app as a dependency to the console app, but i can’t work out how to start it

any suggestions?


1 Like

How exactly have you added it? It is not enough to just add is in the deps-area, you also need to add it to applications. Then it should be started automatically when starting your outer app.

BUT I do not know if that really starts up the server or not. Perhaps you can find some further hints when taking a look at the phoenix.server mix-task

1 Like

yeah i’ve got it in deps and in applications, it doesn’t seem to be started. I will have a look at that, thanks for the link


1 Like

ah so it does start phoenix and my phoenix app but its not listening on any endpoints…

I’m looking through the code but if anyone has any tips i would greatly appreciate them :slight_smile:

Do you mind including your code as well?

1 Like

not sure which bits would be useful but here is the app im trying to start the phoenix site froms mix.exs

the phoenix app (node visualiser) is a fresh mix -no-ecto app, and runs fine on its own on port 4000 with the mix phoenix.server command

if i start the test_app with iex -S mix and issue Application.started_applications() the node_visualiser is started in that list

let me know if i can post anything else that would be useful

   defmodule TestApp.Mixfile do
   use Mix.Project
     def project do
       [app: :test_app,
        version: "0.0.1",
        elixir: "~> 1.2",
        build_embedded: Mix.env == :prod,
        start_permanent: Mix.env == :prod,
       deps: deps]
    def application do
      [applications: [:logger, :node_visualiser]]

    defp deps do
      [{:node_visualiser, git: ""}]
1 Like

if anyone is interested, i got the phoneix endpoints started by taking the config from the web site and adding it to the apps config files (adding server: true to it)

this got the server starting when i started my app, but still have some css/js stuff to work out.

thanks for your help!



When you have figured it all out and it is working as intended, it would be nice if you could blog about it, this really sounds like some very interesting topic!


good idea, i will do that. i’ll link to it when i’m done (that is IF i can figure out the last bits :slight_smile: )


as promised :slight_smile:

I did manage to get this working in the end. Any advice on a better approach gratefully received

thanks guys


Hi Dan. I know time has passed, but my use case is similar to yours. The link is broken, do you have the post somewhere else? It would be much appreciated.

Happy 2018.

Hi Lalo,

Really sorry but i dont have the post or the code any more!

I can’t remember what the solution was in the end either… i think its to do with having config for the webapp in the console app?

sorry and good luck!


No worries. I found another answer in the forum, but thanks anyway :grin:

For future references: How to add phoenix to existing project and start server

1 Like