How to run your app on development environment

Run your application in development environment#

To build and run your generated application in a local development environment follow this tutorial. VS code is used for demonstration in this article, but the process can be done on any IDE or directly in the command line with npm CLI.

Summary#

Im this article you will go through the following steps:

  1. Get the application source code
  2. Install packages from npm for the server
  3. Start docker container for your database
  4. Initialize your database
  5. Run your server
  6. Install packages from npm for the Admin UI
  7. Run the Admin UI
important

Before you start make sure you have Node.js 14, npm, and Docker installed.

Get the application source code#

First, you will need to get your application source code from Amplication.

The best way to do it, is to sync your application with a GitHub repository by following this guide.

Instead, if you prefer to download the source code as a ZIP file, follow these steps:

  1. Commit all your changes so Amplication generate the updated source code.
  2. click on the Download button on the latest commit. You'll get a ZIP file.
  3. Extract the ZIP file to a local folder.
  4. Open your application with your favorite IDE

Install packages from npm for the server#

Your application is using npm for package management. To install all the necessary package follow these steps:

  1. Open a command line tool
  2. Move to the Server folder
cd server
  1. Execute npm install or npm i to download and install all the packages
npm install

Start docker container for your database#

Your application is shipped with a built-in connection to postgreSQL DB. To start the database you need to run a docker container using the following command:

npm run docker:db

Initialize your database#

Now you need to create your application schema on the database. To do so Amplication uses Prisma and the prisma migrate command.

First execute the following command in the command line tool to generate the Prisma client

npm run prisma:generate

Now, execute the following command in the command line tool to generate the schema on the database

npm run db:init
tip

To view the full prisma commands or any other script you can open the package.json file and look for the relevant command in the scripts section

Run your server#

That's it, your server is ready! Execute the following command to start your server

npm run start

By default, your server is now available at http://localhost:3000

Try to open one of these URLs and have fun

  • http://localhost:3000/api
  • http://localhost:3000/graphql

To read more about the technologies and structure of your server read this article

Install packages from npm for the Admin UI#

Now that your server is ready, you can build and run the Admin UI - a React client with ready-made forms for creating and editing all the data models of your application.

To install all the packages needed for the client, follow these steps:

  1. in the command line tool, move the the Admin folder. In case you are still in the Server folder, execute this command
cd ../admin
  1. Execute npm install or npm i to download and install all the packages
npm install

Run the Admin UI#

To run the React application with the Admin UI execute the following command

npm run start

By default, your client is now available at http://localhost:3001