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.
In this article you will go through the following steps:
- Get the application source code
- Install packages from npm for the server
- Start docker container for your database
- Initialize your database
- Run your server
- Install packages from npm for the Admin UI
- Run the Admin UI
Before you start make sure you have Node.js 14, npm, and Docker installed.
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:
- Commit all your changes so Amplication generates the updated source code.
- Click on the Download Code button on the latest commit. You'll get a ZIP file.
- Extract the ZIP file to a local folder.
- Open your application with your favorite IDE
Your application is using npm for package management. To install all the necessary package follow these steps:
- Open a command-line tool
- Move to the Server folder
- Execute npm install or npm i to download and install all the packages
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:
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
Now, execute the following command in the command-line tool to generate the schema on the database
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
That's it, your server is ready! Execute the following command to start your server
By default, your server is now available at http://localhost:3000
Try to open one of these URLs and have fun
To read more about the technologies and structure of your server read this article
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:
- in the command-line tool, move to the Admin folder. In case you are still in the Server folder, execute this command
npm ito download and install all the packages
To run the React application with the Admin UI execute the following command
By default, your client is now available at http://localhost:3001