Create application

Create application

We recommend starting a new Arke app using create-app through the arkectl, which sets up everything automatically for you. if you haven't installed it yet follow the arkectl guide.

To create a project, run:

> arkectl create-app -i

Interactive mode starts and asks about your initialization:

Project name

How do you want to call your project?

App Locally

Do you want to create the app locally? (y/N)

Locally is the suggested configuration cause permits a complete customization of backend, frontend and console for your scenario.

Projects will be initialized in the current terminal directory, according to the next init configuration. Local installation clone the latest arke starters from Github repos, an example of complete initialization will be:

  • Choose application that you need

    Which repo do you want to initialize?  [Use arrows to move, space to select, ...]
    > [x]  Frontend
      [x]  Backend
      [x]  Console

    Choose template for Frontend

    Which template do you want to use for the frontend?

    After this choose the interactive process is finished and your are ready to open and looks projects.

    Start your development

    On local development you have to open all projects on your IDE to define the environment variables, then you can start it, follow each tabs to init projects:

    Create backend project


    Temporary we have to re-create the project from mix cause Arkectl has problems.

    mix archive.install hex arke_new
    mix backend
    cd backend
    mix deps.get

    Database server connection

    You can choose to create a local Database to store data or connect to remote one

    To create a new local database Here you can find a quick guide to install it.

    Define env variables

    Add a .env file in the root of the project to set the Database env variables:

    export DB_NAME="arke_db"
    export DB_HOSTNAME=""
    export DB_USER="postgres"
    export DB_PASSWORD="postgres"

    Run the following command to apply your environment variables:

    source .env

    Init arke system schema

    Create Database and define arke_system schema using ArkePostgres defaults:

    mix ecto.create -r ArkePostgres.Repo
    mix arke_postgres.create_project --id arke_system --label Arke System Project
    mix ecto.migrate -r ArkePostgres.Repo --prefix arke_system
    mix arke.seed_project --project arke_system

    Create your project

    Create your Database project and define and populate with defaults:

    mix arke_postgres.create_project --id {PROJECT_ID}
    mix arke.seed_project --project {PROJECT_ID}

    Create first super admin user

    To create your first user use the following command, define the username/password/email parameters :

    mix arke_postgres.create_member --project {PROJECT_ID} --username {YOUR_USERNAME} --password {YOUR_PASSWORD} --email {YOUR_EMAIL}

    If you did not set a username and a password, the default are username=admin password=admin Run mix help arke_postgres.create_member to get other options

    Start server

    iex -S mix phx.server
    Erlang/OTP 25 [erts-] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
    [info] Running PhoenixStarterWeb.Endpoint with cowboy 2.10.0 at (http)
    [info] Access PhoenixStarterWeb.Endpoint at http://localhost:4000
    Interactive Elixir (1.14.5) - press Ctrl+C to exit (type h() ENTER for help)

    The Arke Backend is ready and running on http://localhost:4000 (opens in a new tab)