Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4623852
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:02:49+00:00 2026-05-22T03:02:49+00:00

I have got a basic server-side Erlang app (not fully OTP’d yet) which I

  • 0

I have got a basic server-side Erlang app (not fully OTP’d yet) which I start on a command-line. I want to turn it into an interactive system using a browser as GUI with Nitrogen (version 2.0.4). The general plan is to

  • turn the current module into a gen_server as the MODEL part; it analyses data and generates events from it which reflect certain properties of the data I am interested in.
  • add a CONTROLLER module which is both gen_event (to pick up events generated by the model) and gen_server (to allow queries from the GUI frontend)
  • use Nitrogen as the VIEW, updating the relevant pages with the Ajax facilities through calls to the controller module (which in turn queries the model)

As far as I can see I would want a general application supervisor with three children: the model, view, and controller. Then they would talk to each other via the APIs mapped to the OTP communication modes.

And this is where I am stuck: should I put all of this into the Nitrogen directory tree? Should I set up a new app dir structure and have the three components (including Nitrogen) under there? What exactly do I need to do to start up the Nitrogen server as a child of my app supervisor (the Nitrogen start script looks rather more complex than I expected)? I have started going through Erlang and OTP in Action, but haven’t quite finished it yet. And I need to demo the system the day after tomorrow 😉

What I want is to type “start.sh” on the command-line, and then use the browser to connect to the app via Nitrogen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:02:50+00:00Added an answer on May 22, 2026 at 3:02 am

    Because of the way the Nitrogen App is built, you should not build your application tightly coupled to it. Rather, you build your application, provide APIs to Nitrogen (APIs you will call from your Nitrogen events e.t.c).

    Then you would package your app as an OTP filesystem, put it into the apps folder of nitrogen. When nitrogen makes or starts it will add the ebin paths of your apps as long as they are in its apps directory.

    For example: the model and controller will be implemented within your application. Then in your application you expose function calls in your module (which could be gen_server behaving) which you would call right from your nitrogen page. The beauty is all these would be in the same code path.

    What to do: you look at the Nitrogen quickstart.sh script, at the point where it starts erlang VM.

    echo "Starting Nitrogen on Inets (http://localhost:8000)..."
    erl \
        -name YOUR_NODE_NAME_HERE \
        -pa ./ebin ../apps/*/ebin ../apps/*/include \
        -env ERL_FULLSWEEP_AFTER 10 \
        -eval "application:start(nprocreg)" \
        -eval "application:start(quickstart)" \
        -eval "application:start(YOUR_APPLICATION)"
    

    if your application is not OTP like, then create a folder called “ebin” in which you will put the beam files you have.The create a folder called: “my_app-1.0” and paste this ebin folder in that folder

      Nitrogen--|--/apps --|--/my_app-1.0 --|--/ebin
                |--/doc
                |--/rel
                |--/support
                |--/Quickstart
    

    The full path to your beam files should be

    "$NITROGEN/apps/my_app-1.0/ebin"

    .
    Whenever Nitrogen starts it will add to the code path all your beam files. Then, if in your code you have the function that starts your stuff say: main_server:start().
    You will change the quickstart.sh found in $NITROGEN/Quickstart/quickstart.sh to appear this way.

    echo "Starting Nitrogen on Inets (http://localhost:8000)..."
    erl \
        -name YOUR_NODE_NAME_HERE \
        -pa ./ebin ../apps/*/ebin ../apps/*/include \
        -setcookie YOUR_FUNNY_COOKIE_HERE \
        -mnesia dir '"PATH/TO/MNESIA/DIRECTORY"' \
        -env ERL_FULLSWEEP_AFTER 10 \
        -eval "application:start(nprocreg)" \
        -eval "application:start(quickstart)" \
        -eval "main_server:start()"
    

    The advantage of this is that if you happen to change your view to say erlyweb, erlang web, you will not need to make changes to your model or controller but rather you exposed APIs that can be called from any view type library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been doing server-side development for several years, and have not had much (read
I've got a small client/server test application where I have a Flex app that
We have got loads of options for php + MySQL + Apache combo... Which
I have got a python script which is creating an ODBC connection. The ODBC
I have got the following problem since the server has safe mode turned on,
I have got some code to load an assembly and get all types, which
I don't have very much information to work with here, yet. Our app sends
I'm getting to grips with RPC in Windows and I've got a basic client/server
I got the code from here the Code is not working, I have the
We have got a custom MembershipProvider in ASP.NET . Now there are 2 possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.