Getting Started
System Requirements
Analog requires the following Node and Angular versions:
- Node v16 or higher
- Angular v15 or higher
Creating a New Application
There are two methods for creating an Analog application. You have the option to utilize the create-analog
command
to scaffold a standalone project, or you can make use of the Nx plugin, which is included in the @analogjs/platform
package.
- create-analog
- Nx
create-analog
Scaffold an Analog project with the following create-analog
command:
- npm
- Yarn
- pnpm
npm create analog@latest
yarn create analog
pnpm create analog
Serving the application
To start the development server for the application, run the start
command.
- npm
- Yarn
- pnpm
npm run start
yarn start
pnpm run start
Visit http://localhost:5173 in your browser to view the running application.
Next, you can define additional routes using components for navigation.
Building the Application
To build the application for deployment
- npm
- Yarn
- pnpm
npm run build
yarn build
pnpm run build
Build Artifacts
By default, Analog comes with Server-Side Rendering enabled.
Client artifacts are located in the dist/analog/public
directory.
The server for the API/SSR build artifacts is located in the dist/analog/server
directory.
Nx
Create a new Nx workspace with a preconfigured Analog application:
npx create-nx-workspace --preset=@analogjs/platform
The Analog preset prompts you to provide the name of your application. In this example, we simply use analog-app
.
Additionally, asks whether you would like to include TailwindCSS and tRPC in your new project.
If you choose to include either of them, all the required dependencies are installed automatically,
and any necessary configurations is added.
Serving the application
To start the development server for your application, run the nx serve
command.
nx serve analog-app
Building the Application
To build the application for deployment run:
nx build analog-app
Build Artifacts
The client build artifacts are located in the dist folder of your Nx workspace.
By default, Analog comes with Server-Side Rendering enabled.
In the common apps/libs workspace layout, the analog-app
's client artifacts are located in the dist/apps/analog-app/analog/public
directory.
The server for the API/SSR build artifacts is located in the dist/apps/analog-app/analog/server
directory.