amplication Documentation

Amplication brings order to the chaos of large-scale software development by creating Golden Paths for developers - streamlined workflows that drive...

RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy amplication on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name amplication -p 1777:1777 --restart always amazon/aws-otel-collector:latest
Configured Services & Ports
βš™οΈ xray
image: amazon/aws-otel-collector:latest
πŸ”Œ Ports: 1777:1777, 55679:55679, 4317:4317, 13133
docker-compose.yml
yaml (docker-compose.yml)
version: "3"
services:
  # tracing:
  #   image: jaegertracing/all-in-one:latest
  #   ports:
  #     - 6831:6831/udp
  #     - 6832:6832/udp
  #     - 5778:5778
  #     - 16686:16686
  #     - 4317:4317
  #     - 4318:4318
  #     - 14250:14250
  #     - 14268:14268
  #     - 14269:14269
  #     - 9411:9411

  xray:
    image: amazon/aws-otel-collector:latest
    command: ["--config=/etc/otel-agent-config.yaml"]
    environment:
      - AWS_REGION=us-east-1
      - AWS_PROFILE=amplication-sandbox-admin
    volumes:
      - ./aws-opendistro.config.yml:/etc/otel-agent-config.yaml
      - ~/.aws:/home/aoc/.aws
    ports:
      - "1777:1777" # pprof extension
      - "55679:55679" # zpages extension
      - "4317:4317" # OTLP receiver
      - "13133" # health_check

volumes:
  postgres: ~

1. Project Overview & Quickstart (amplication/amplication)

File: README.md

text
</a>
<a href="https://amplication.com/#gh-dark-mode-only">

</a>

Introduction

Amplication enables you to quickly build, maintain, and scale backend services that embed your company’s best practices and standards.

With Amplication you can create your own live templates embedding your organization’s best practices and standards, to ensure consistency and compliance from the start.Β 

Leveraging AI-powered automation, Amplication will generate microservices in no time, with everything that is needed to support your business domain: APIs, data models, DTOs and more, allowing engineers to focus on business logic.

Now your live applications will be always up-to-date. Amplication automatically handles package updates, patches, and versioning, reducing technical debt and ensuring consistency across your services.Β 

Features

Usage

To get started with Amplication, the hosted version of the product can be used. You can get started immediately at app.amplication.com. After the login page, you will be guided through creating your first service. The website provides an overview of the application, additional information on the product and guides can be found in the docs.

Tutorials

Development

Alternatively, instead of using the hosted version of the product, Amplication can be run locally for code generation purposes or contributions - if so, please refer to our contributing section.

Pre-requisites

To be able to start development on Amplication, make sure that you have the following prerequisites installed:

  • Node.js
  • Docker
  • Git

Running Amplication

Note
It is also possible to start development with GitHub Codespaces, when navigating to < > Code, select Codespaces instead of Local. Click on either the +-sign or the Create codespace on master-button.

Amplication is using a monorepo architecture - powered by Nx Workspaces - where multiple applications and libraries exist in a single repository. To setup a local development environment the following steps can be followed:

BEFORE you run the following steps make sure:

  1. You have typescript installed locally on you machine npm install typescript

  2. You are using a supported node version (check engines node in the package.json)

  3. You are using a supported npm version (check engines npm in the package.json)

  4. You have docker installed and running on your machine

  5. Clone the repository and install dependencies:

shell
git clone https://github.com/amplication/amplication.git && cd amplication && npm install
  1. Run the setup script, which takes care of installing dependencies, building packages, and setting up the workspace:
shell
npm run setup:dev
  1. Option 1: Running the required infrastructure - view infrastructure component logs
shell
npm run docker:dev
  1. Option 2: Running the required infrastructure - run the infrastructure components in background
shell
npm run docker:dev -- -d
  1. Apply database migrations
shell
npm run db:migrate:deploy
  1. To start developing, run one or more of the applications available under serve:[application] scripts of the package.json.
shell
# running the server component
npm run serve:server

# running the client component
npm run serve:client

# running the data-service-generator component
npm run serve:dsg

# running the git-sync-manager component
npm run serve:git

# running the plugin-api component
npm run serve:plugins

Note
In order to run the Amplication client properly, both the client and server need to be started by the npm run serve:[application] command, as well as an additional component for development on a specific component.

The development environment should now be set up. Additional information on the different application components can be found under packages/[application]/README.md file. Happy hacking! πŸ‘Ύ

Resources

  • Website overview of the product.
  • Docs for comprehensive documentation.
  • Blog for guides and technical comparisons.
  • Discord for support and discussions with the community and the team.
  • GitHub for source code, project board, issues, and pull requests.
  • Twitter for the latest updates on the product and published blogs.
  • YouTube for guides and technical talks.

Contributing

The majority of Amplication code is open-source. We are committed to a transparent development process and highly appreciate any contributions. Whether you are helping us fix bugs, proposing new features, improving our documentation or spreading the word - we would love to have you as a part of the Amplication community. Please refer to our contribution guidelines and code of conduct.

  • Bug Report: If you see an error message or encounter an issue while using Amplication, please create a bug report.

  • Feature Request: If you have an idea or if there is a capability that is missing and would make development easier and more robust, please submit a feature request.

  • Documentation Request: If you're reading the Amplication docs and feel like you're missing something, please submit a documentation request.

Not sure where to start? Join our discord and we will help you get started!

Contributors
























































License

A large part of this project is licensed under the Apache 2.0 license. The only exception are the components under the ee (enterprise edition) directory, these are licensed under the Amplication Enterprise Edition license.


File: ee/packages/git-sync-manager/README.md

Amplication git sync manager service

Environment Variables

Environment Description Value
BASE_BUILDS_FOLDER path to a folder where your builds will be saved Absolute path to a folder where your builds will be saved for development purposes, leave this variable empty to use .amplication/storage relative to the execution folder.
GITHUB_APP_APP_ID ID of the installed github app [github-app-app-id]
GITHUB_APP_CLIENT_SECRET secret of your github app [use-secret-manager]
GITHUB_APP_PRIVATE_KEY private key of the installed github app [github-app-private-key]
KAFKA_BROKERS kafka client must be configured with at least one broker. The brokers on the list are considered seed brokers and are only used to bootstrap the client and load initial metadata ["localhost:9092"]
KAFKA_CLIENT_ID A logical identifier of an application. Can be used by brokers to apply quotas or trace requests to a specific application. Example: booking-events-processor git-sync-manager
KAFKA_GROUP_ID prevent collisions between Nest microservice client and server components "git-sync-manager-group"

File: libs/util/roles-types/README.md

roles-types

Library that contains types and reference for roles and permissions

Building

Run nx build roles-types to build the library.


File: libs/util/nestjs/tracing/README.md

util-nestjs-tracing

This library contains the common tracing configuration for amplication services.

Getting started

Consume the module

In your microservices, import the logger module and consume it in your root module.
By importing the TracingModule the controllers and any provider decorated with the @Traceable() decorator will be instrumented.

ts
// app.module.ts
import { TracingModule } from '@amplication/util/nestjs/logging';
@Module({
  imports: [
    //...
    TracingModule.forRoot({
      serviceName: Env.SERVICE_NAME,
    }),
    //...
  ],
})
export class AppModule implements // ....

Or async:

ts
// app.module.ts
import { TracingModule } from '@amplication/util/nestjs/logging';
@Module({
  imports: [
    //...
    TracingModule.forRootAsync({
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        serviceName: SERVICE_NAME,
      }),
    })
    //...
  ],
})
export class AppModule implements // ....

Trace a service / provider

To enable the tracing for a provider, it needs to be decorated with @Traceable() as mention in the library @amplication/opentelemetry-nestjs @Traceable on which this lib is based.

i.e.

ts
import {
  Traceable,
} from "@amplication/opentelemetry-nestjs";

@Traceable()  // <---------- MAGIC WORD!
@Injectable()
export class PullRequestService {
  gitProvidersConfiguration: GitProvidersConfiguration;

Alternatively, it is possible to trace just some methods of the injectable class by decorating them with @Span()

ts
import {
  Span,
} from "@amplication/opentelemetry-nestjs";

@Injectable()
export class PullRequestService {

    async method1(args:unknown){
        // ....
    } 

    @Span()
    async method2(args:unknown){
        // ....
    } 
}

Trace a class that is not part of Nestjs DI (not decorated with @Injectable())

To enable the tracing for an instance of a class that is not part of NestJS DI (module container), the instance needs to be wrapped with
the TraceWrapper.trace() methods as mentioned here @amplication/opentelemetry-nestjs Trace Not @Injectable() classes

ts
import { TraceWrapper } from '@amplication/opentelemetry-nestjs';

class MyClass {
  hello() {
    console.log('Hi');
  }

  async bye() {
    await new Promise(() => console.log('bye bye'));
  }
}

// ....
const instance = new MyClass();
const tracedInstance = TraceWrapper.trace(instance);

// ....

Run in production

In order to send the collected tracing data, the application will need to pass the OTEL collector exporter URL i.e. http://localhost:4318
As this library rely on the official OTEL SDK library, the exporter URL configuration can be defined as OTEL_EXPORTER_OTLP_ENDPOINT environment variable as described here
https://opentelemetry.io/docs/concepts/sdk-configuration/otlp-exporter-configuration/

Running unit tests

Run nx test util-nestjs-tracing to execute the unit tests via Jest.


File: libs/util/nestjs/logging/README.md

Amplication NestJS Logger Module

The @amplication/util/nestjs/logging is our official logger module. This library leverage, under the hood, the framework-agnostic amplication logging library @amplication/util/logging.

All nestjs services at Amplication must use this library to ensure consistent logging. This will enable us to trace and observe our systems reliably.

Getting started

Consume the module

In your microservices, import the logger module and consume it in your root module.

ts
// app.module.ts

import { AmplicationLoggerModule } from '@amplication/util/nestjs/logging';

@Module({
  imports: [
    //...
    AmplicationLoggerModule.forRoot({
      component: SERVICE_NAME,
    }),
    //...
  ],
})
export class AppModule implements // ....

The minimum log level can be configured also with the LOG_LEVEL environment variable, instead of the logLevel: LogLevel.Warn, to one of the following values:

  • debug
  • info
  • warn
  • error

Usage

You can import the logger via dependency injection.

ts
// example.service.ts

import {
  AmplicationLogger,
} from "@amplication/util/nestjs/logging";

@Injectable()
export class ExampleService {
  constructor(
    @Inject(AmplicationLogger)
    private readonly logger: AmplicationLogger
  ) {}

  someMethod() {
    this.logger.debug("This is a debug log", { some: "context" });
    this.logger.info("This is a info log", { some: "context" });
    this.logger.warn("This is a warn log", { some: "context" });
    this.logger.error("This is a error log", { some: "context" });
  }
}

Testing utils

A mocked provider can be used in unit tests.
The following example explain how to use it

ts
/// myservice.spec.ts

import { MockedAmplicationLoggerProvider } from "@amplication/util/nestjs/logging/test-utils";

//...
 const module: TestingModule = await Test.createTestingModule({
      providers: [
        // ... 
        MockedAmplicationLoggerProvider,
        // ...
      ]
      //...
 }).compile();
//...

File: libs/util/nestjs/kafka/README.md

util-nestjs-kafka

Library containing nestjs specific utils for Kafka integration.
This library leverage util-kafka functionality to satisfy nestjs specific use-cases.

Serialisation of Kafka Message

To produce messages with serialised key and value, import the KafkaProducerService and use that instead of calling the nestjs KafkaClient directly:

ts
// Nestjs Module.
// ...
import { Module } from "@nestjs/common";
import { BuildLoggerController } from "./build-logger.controller";
import { KafkaModule } from "@amplication/util/nestjs/kafka";

@Module({
  imports: [KafkaModule],
  controllers: [BuildLoggerController],
  providers: [],
})
export class BuildLoggerModule {}
ts
// class BuildLoggerController (readonly private kafkaProducerService: KafkaProducerService)
// ...
// myFunction(){
this.kafkaProducerService.emitMessage("topic-1", {
  key: "id-1",
  value: "my awesome value",
});

File: libs/util/logging/README.md

util-logging

This library was generated with Nx.

Building

Run nx build util-logging to build the library.

Running unit tests

Run nx test util-logging to execute the unit tests via Jest.

Getting started

Logging in libraries

Libraries should always log without relying on a logger framework.
In order to do so, libraries should rely on the ILogger interface and any service/application will pass the proper logger class.

ts
// library.class.ts
import { ILogger } from "@amplication/util/logging";

export class CakeFactory {
    constructor(private readonly logger: ILogger){}

    printInLog(message: string){
        this.logger.info(message)
        this.logger.error(message, new Error())
    }
}

Logging in services / applications

In your microservices, import the logger module and consume it in your root module.

ts
// module.ts

import { Logger } from '@amplication/util/logging';

const logger = new Logger ({
  isProduction: true,
  component: "component-name",
  logLevel: LogLevel.Warn
})

const logMe = () => {
    logger.info("An info log message", { other: { value: 1 }})
    // ....
}

The minimum log level can be configured also with the LOG_LEVEL environment variable, instead of the logLevel: LogLevel.Warn, to one of the following values:

  • debug
  • info
  • warn
  • error

Testing utilsutils

A mocked provider can be used in unit tests.
The following example explain how to use it

ts
/// myservice.spec.ts

import { MockedLogger } from "@amplication/util/logging/test-utils";

//...
it('', () => {
    const target = new Service(MockedLogger);
})
//...

File: libs/util/kafka/README.md

util-kafka

Library containing framework-agnostic utils for Kafka integration.

Running unit tests

Run nx test util-kafka to execute the unit tests via Jest.


File: libs/util/json/README.md

util-json

Library that contains any basic operation for JSON.
This contains methods that can work on both, browsers and node.

Running unit tests

Run nx test util-json to execute the unit tests via Jest.


File: libs/util/graphql-error-codes/README.md

graphql-error-codes

This library was generated with Nx.

Building

Run nx build graphql-error-codes to build the library.

2. Official Technical Reference & Guides (amplication/docs)

File: README.md

πŸ“ Note
Amplication Documentation moved to https://github.com/amplication/amplication-docs

Amplication Documentation

Welcome to the Amplication documentation repository! This repository contains the documentation for the Amplication open-source development platform. Amplication is a low-code development platform that allows developers to quickly build scalable and maintainable applications.

The documentation provides detailed information on how to use the platform, including tutorials, guides, and reference material.
This website is built using Docusaurus 2, a modern static website generator.

Installation

console
npm ci

Local Development

console
npm run start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Build

console
npm run build

This command generates static content into the build directory and can be served using any static contents hosting service.

Deployment

console
GIT_USER=<Your GitHub username> USE_SSH=true npm run deploy

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.

Contributing

We welcome contributions to the Amplication documentation! If you find an issue or want to suggest an improvement, please open a GitHub issue and then submit a pull request.


File: docs/concepts/event-driven-architecture.md


id: event-driven-architecture title: Event-Driven Architecture with Amplication sidebar_label: Event-Driven Architecture slug: /concepts/event-driven-architecture

Event-Driven Architecture with Amplication

Event-driven architecture is a design pattern that enables loose coupling between microservices. In an event-driven system, services communicate with each other by producing and consuming events. This allows for real-time processing and reaction to events.

Amplication provides built-in support for event-driven architectures through the use of message brokers and topics. By leveraging these features, you can easily build scalable and responsive microservices.

:::tip
Amplication's Break The Monolith feature lets you easily update monolithic architectures into a modern, scalable, and maintainable microservice architecture.
:::

Key Concepts

Before getting started, let's define some important concepts and terms related to event-driven architecture:

  • Microservice: A microservice is a small, independent service that focuses on a single business capability. Microservices are designed to be loosely coupled, allowing them to be developed, deployed, and scaled independently. In an event-driven architecture, microservices communicate with each other through events and message brokers.

  • Message Broker: A message broker is a software component that facilitates communication between services in an event-driven architecture. It receives messages from producers, stores them, and routes them to the appropriate consumers based on predefined rules or subscriptions.

  • Topic: A topic is a named stream or category of events. Producers publish messages to topics, and consumers subscribe to topics to receive messages. Topics provide a logical grouping and enable multiple consumers to independently process events from the same topic.

  • Producer: A producer is a service or component that generates and publishes events to one or more topics. Producers are responsible for creating messages and sending them to the message broker.

  • Consumer: A consumer is a service or component that subscribes to one or more topics and processes the received events. Consumers read messages from the subscribed topics and perform actions based on the content of the messages.

Enabling Event-Driven Microservices

To implement event-driven architecture in your Amplication project, you'll need to:

  1. Create a message broker resource
  2. Define topics
  3. Connect services to the message broker and relevant topics
  4. Install a message broker plugin
  5. Implement event production and consumption logic

:::info
For a step-by-step guide on building an event-driven application with Amplication and Kafka, refer to the blog post: Building Real-time Applications with Amplication and Kafka.
:::

Step 1: Create a Message Broker

In your Amplication project, navigate to "Add Resource" and select "Message Broker". This will lead you to the Message Broker Creation Wizard.

After creating the message broker, you'll be able to configure the settings by installing and configuring the appropriate message broker plugin.

Step 2: Define Topics

Create topics that represent the different event categories in your system. Topics act as communication channels between services. They can be created under the "Topics" section of your message broker configuration in Amplication.

Step 3: Connect Services

For each service that needs to interact with the message broker, enable the message broker integration in your service's Connections tab. Specify whether the service should act as a producer or consumer for each relevant topic.

Step 4: Install Message Broker Plugin

Now it's about installing your preferred message broker of choice. Amplication supports using Kafka, MQTT, Redis Message Broker, and various others as your message broker. To find the one most suitable to your project visit the Plugins tab and then click on the Message broker category.

To use it, install the message broker plugin in each service that will be producing or consuming messages.

Step 5: Implement Event Production and Consumption

In your producer services, add logic to publish events to the appropriate topics when certain actions or conditions occur. Use your chosen message broker client to send messages to the desired topics.

In your consumer services, define event handlers that process the messages received from the subscribed topics. You can use decorators like @EventPattern() to map event handlers to specific topics and handle incoming messages accordingly.

Conclusion

By leveraging event-driven architecture, you can build microservices that are scalable, responsive, and adaptable to changing requirements. Amplication's built-in support for message brokers and easy integration with various message broker plugins makes it straightforward to implement event-driven communication between your microservices.

Further Reading

For a more detailed walkthrough and practical implementation of event-driven architecture using Amplication and Kafka, be sure to check out the blog post: Building Real-time Applications with Amplication and Kafka. It provides a comprehensive guide on setting up and using event-driven communication in your Amplication projects.


File: docs/community/handling-a-new-issue.md


id: handling-a-new-issue title: Handling Issues sidebar_label: Handling Issues slug: /community/handling-a-new-issue

Handling Issues

This article describes how the Amplication team responds to a new issue in GitHub.

Members of the Amplication community can contribute to the development of Amplication by opening an issue in the Amplication repository on GitHub. The issue can be a feature request, a bug report, a documentation update, or a dependency issue.

The process described in this document begins after a new issue has been created . The issue will have been added to the Backlog project automatically and Maintainers will have received a notification from Discord that a new issue has been opened.

It is expected that the Contributor will have entered a detailed description of the issue, explaining what problems need to be solved, including any suggestions regarding which steps are required to resolve them.

Processing a New Issue

A new issue processed in GitHub as follows:

  1. Maintainers change Backlog status from New to Baking and add the appropriate labels. The Issue is validated and researched to gain a deep understanding of the issue. Contributors and Maintainers can add comments and participate in discussions in the GitHub Issue.
    :::tip
    For Internal use only: If a subject is not relevant for public discussion, the Maintainers can open the issue for an internal discussion in a Discord thread. If a thread is opened on Discord, it should be named according to the following format:
    issue-#[]-discussion (for example, issue-#2176-discussion)
    :::
  2. When the Maintainers have an adequate level of understanding and the issue is ready to be developed, they change Backlog status from Baking to Candidate and apply the appropriate Labels.
  3. The Maintainers update the Status and Label as the project progresses, as described in the Set Status and Apply Labels sections below.

The Status Label must be the same as the project Status. Both are set manually.

Set Status

The status indicates to what stage the issue has progressed in the workflow.

Status Description Owner
New The issue has been created in GitHub Maintainers and Contributors
Baking Are still researching the issue. Understanding the problem and developing an idea of how the problem can be solved. Maintainers and Contributors. Typically, a discussion will take place between Contributors and Maintainers in the GitHub Issue where the details will be examined.
Candidate Once enough information has been gathered to fully understand the issue, the steps that must be taken to resolve it, and its priority. Maintainers. Typically, a discussion will take place in the GitHub Issue
Accepted A decision has been made that the Candidate is going to be resolved. Product team
Scheduled The issue is added to the roadmap. Product team
Closed The issue has been resolved. Product team

**Apply Labels**

Applying labels to the issue enables us to categorize and monitor the issue. Labels are metadata that enable us to understand with greater accuracy the nature of the issue. The labels are used, for example, when filtering the list of issues and can be useful in categorizing the contents of the Release Notes.

Label Mandatory? Options
Type Mandatory Dependency, Bug, Feature request, Documentation
Status Mandatory Baking, Candidate, Accepted, Scheduled, Assigned, Wontfix, Duplicate
Scope Mandatory The Scope label follows the following format: @amplication/[package name] and indicates which part of Amplication is involved. Examples: @amplication/server,@amplication/client, @amplication/cli, @amplication/design-system
Call to the community Optional help wanted, good first issue

**Help Wanted**

When the issue has the status Candidate or Accepted, it is possible to add a label Help wanted. This indicates that Amplication is not planning to work on the issue at this stage, but members of the community are invited to resolve it.

Good First Issue

This indicates that the issue is suitable for an inexperienced contributor to resolve.

**Won’t Fix**

If it is decided by the Amplication team that the issue will not be fixed, either by Amplication developers or the community, then it is given the status Wontfix. In this case, an explanation must be entered to explain the decision.

**Duplicated Issues**

Before closing a duplicated issue, first set the status duplicate and write an explanation including the number of the duplicated item.

What’s Next?

When the steps described in this article have been completed the issue is ready for the development phase.


File: docs/api/generated-api-filtering.md


id: generated-api-filtering title: API Filtering sidebar_label: Generated API - Filtering slug: /api/generated-api-filtering

Generated API - Filtering

The generated API includes built-in support for filtering, which enables users to specify search criteria for their queries.

Filtering is done using the where parameter, which defines filters based on record properties or related record properties, such as a user's email address or their top 10 most recent post titles.

:::note

The where parameter can only be used on endpoints and queries that return a list of items, such as /api/posts or /api/posts/{id}/tags.
:::

Filter conditions and operators

The where parameter supports the following operators:

  • lt
  • lte
  • gt
  • contains
  • startsWith
  • endsWith
  • mode
  • not

:::note
The Searchable flag in the entity field settings determines whether a record can be included in a search. This flag is activated by default.
:::

To find out more about filters and operators, we recommend reading the Prisma Client API reference

Filtering Examples

The following example gets all posts where the title includes the text β€œNode.js”

REST API

jsx
curl -X 'GET' \
  'https://[server-url]/api/posts?where%5Btitle%5D[contains]=Node.js' \
  -H 'accept: application/json'

GraphQL

jsx
query{
  posts(
    where:{
      title:{
        contains:"Node.js"
      }
    }
  ){
    id
    title
  }
}

File: docs/api/generated-api-pagination.md


id: generated-api-pagination title: API Pagination sidebar_label: Generated API Pagination slug: /api/generated-api-pagination

Generated API Pagination

The generated API comes with built-in support for Offset pagination.

Offset pagination uses the skip parameter to exclude the first N items and the take parameter to define the number of items to be included on each page.

:::note

The skip and take parameters are available only on endpoints and queries that return a list of items.
For example: /api/posts or /api/posts/{id}/tags
:::

Pagination requires an implied ordering. This is determined by the orderBy parameter. For more information see Generated API Sorting

Pagination Examples

The following examples take items 21-40 from a list of blog posts (equals to 2nd page, in a list with 20 items per page).

Skip=20

Take=20

REST API

text
curl -X 'GET' \
  'https://[server-url]/api/posts?skip=20&take=20' \
  -H 'accept: application/json'

GraphQL

text
query{
  posts(
    skip:20
    take:20
  )
  {
    id
    title
  }
}

File: docs/api/generated-api-sorting.md


id: generated-api-sorting title: API sorting sidebar_label: Generated API - Sorting slug: /api/generated-api-sorting

Generated API - Sorting

The generated API comes with built-in support for sorting.

Sorting uses the orderBy parameter, which accepts an object with the name of the fields.

:::note

  • Amplication does not support sorting by fields of nested entities.

  • The orderBy parameter is available only on endpoints and queries that return a list of items. For example: /api/posts or /api/posts/{id}/tags

:::

Sorting Examples

The following examples get all posts sorted by the createdAt field.

REST API

jsx
curl -X 'GET' \
  'https://[server-url]/api/posts?orderBy%5BcreatedAt%5D=asc' \
  -H 'accept: application/json'

GraphQL

jsx
query{
  posts(
    orderBy:{
      createdAt:desc
    }
  ){
    id
    title
  }
}

File: docs/api/index.md


title: Generated APIs

Generated APIs

Amplication generates production-ready REST and GraphQL APIs with Swagger UI documentation for all your data models. Easily connect to your data with any HTTP client.

REST APIs

Amplication generates REST APIs that provide you with a way to interact with your data models. Generated APIs include authentication and authorization and follow strict RESTful conventions. Each generated REST API also comes with sorting, filtering, and pagination features.

Sorting

Retrieve data in a specific order by applying sorting to your API requests. Sort data based on different fields in your data model.

text
GET /api/posts?orderBy[createdAt]=Asc

Learn about sorting REST API requests.

Filtering

Filter data based on specific criteria by using query parameters in your API requests. Combine multiple filters for more specific results.

text
GET /api/posts?where[title][contains]=Development

Learn about filtering REST API requests.

Pagination

Paginate API results to manage large datasets and provide a better user experience. Use the skip and take query parameters to control the number of results per page and the starting point.

text
GET /api/posts?skip=20&take=20

Learn about paginating REST API requests.

GraphQL APIs

Besides REST APIs, Amplication also generates GraphQL APIs as an alternative way to help you interact with your data models. GraphQL APIs also support sorting, filtering, pagination, and meta queries.

Sorting

Sort the retrieved data in a specific order by adding sorting arguments to your GraphQL queries. Control the sorting order based on fields defined in your data model.

text
query{
  posts(
    orderBy:{
      createdAt:Desc
    }
  ){
    id
    title
  }
}

Learn about sorting GraphQL API requests.

Filtering

Filter data based on specific criteria by adding filter arguments to your GraphQL queries. Combine multiple filters for more precise results.

text
query{
  posts(
    where:{
      title:{
        contains:"Development"
      }
    }
  ){
    id
    title
  }
}

Learn about filtering GraphQL API requests.

Pagination

Implement pagination in your GraphQL queries to handle large datasets and improve the user experience. Use the skip and take arguments to control the number of results and the starting point.

text
query{
  posts(
    skip:20
    take:20
  )
  {
    id
    title
  }
}

Learn about paginating GraphQL API requests.

Meta Queries

Use meta queries to gather additional information about your data, such as the total number of records or the aggregation of certain fields.

text
query{
 _customersMeta(where:{
   firstName:{
     contains:"jack"
   }
 }){
   count
 }
}

Learn more about meta queries with your GraphQL API requests.

Authentication

Amplication generates authentication mechanisms based on the NestJS/Passport library. It supports various authentication mechanisms like JWT-based authentication and custom authentication with Passport.

Learn more about authorizing your API requests.


File: docs/api/metaquery-graphql.md


id: meta-query-graphql title: GraphQL Meta Queries sidebar_label: GraphQL Meta Queries slug: /api/meta-query-graphql

Meta Query in GraphQL

Obtaining the record count of a query

You can use the _EntitiesMeta API to obtain the total record count of a query. The meta query supports all the parameters that are supported in the FindMany query.

bash
query{
 _customersMeta(where:{
   firstName:{
     contains:"jack"
   }
 }){
   count
 }
}

This will return a JSON object with a single property: count, which represents the total number of records that match the query.

Obtaining the result count of a query

You can also use the meta query together with the findMany query to obtain the result count for a specific query.

bash
query customers($where: CustomerWhereInput, $orderBy: CustomerOrderByInput, $skip: Float, $take: Float) {
  items: customers(where: $where, orderBy: $orderBy, skip: $skip, take: $take) {
    id
    createdAt
    updatedAt
    firstName
    lastName
    __typename
  }
  total: _customersMeta(where: $where, orderBy: $orderBy, skip: $skip, take: $take) {
    count
    __typename
  }
}

This query will return two objects: items and total. The items object contains an array of records that match the specified criteria, while the total object contains the total number of records that match the query, as determined by the _customersMeta meta query.


File: docs/about/index.md


title: About Amplication

About Amplication

Amplication is a backend development platform that simplifies and accelerates the process of creating and evolving scalable backend services by auto-generating production-ready code. With support for both Node.js and .NET, Amplication provides developers with the flexibility to select the best technology stack for their needs.

Open Source and Commercial Offerings

Amplication offers both open-source and commercial solutions for backend service generation. The free version of our Node.js application generation tools is available as open-source software, allowing developers to freely access, modify, and distribute the source code. In addition, Amplication provides a premium Enterprise plan for its Node.js tools with additional features and support.

The .NET solution offered by Amplication is part of the Enterprise plan. For more information regarding the licensing details, please visit our licensing model page.

How Amplication can help you

Our main goal is to help developers build and evolve Node.js and .NET apps faster and more efficiently. To help you do that, here are some of the features that Amplication offers:

  • Generate Human-Readable Code: Amplication automatically generates fully functional, human-readable, and editable services. This includes applications based on TypeScript and Node.js, as well as robust and scalable applications based on .NET.
  • Sync With Git Provider: As you make changes to your application using Amplication's visual builders and CLI, the platform automatically syncs those modifications to your git repository.
  • Automatic API Generation: Automatically generate fully functional REST and GraphQL APIs based on your data models.
  • And more...

:::note
Get started or visit our GitHub to see what's possible and all the other features we offer.
:::

Meet The Amplication Team

Amplication is a small, dedicated team, revolutionizing the speed and ease of cloud development. Our mission is to simplify application development, unlock frictionless developer experience and bring best practices to any developer in any organization. We believe this approach will shape the next-generation programming.

Meet our team.

We're Here To Help

We've answered your primary questions in our FAQs. If you still have questions, we're here to help. Contact us to speak with our customer success manager or get technical support. We look forward to talking with you soon.


File: docs/about/licensing.md


id: licensing title: Amplication's licensing model sidebar_label: Amplication's licensing model slug: /about/licensing

Amplication's Licensing Model

Amplication offers both open-source and commercial licensing options to accommodate the needs of various users β€” from individual developers to large enterprises.

Open Source and Enterprise Offerings

Free Edition

  • The Free Edition of Amplication includes our core functionality, based on Node.js. This edition is available under the Apache 2.0 license and remains free for use on our managed service at amplication.com.
  • Developers can freely access, modify, and distribute the source code available in this edition, fostering a collaborative and open development environment.

Enterprise Edition

  • The Enterprise Edition extends the Node.js Free Edition by incorporating advanced operational and security features. This edition also introduces support for .NET applications, offering robust, scalable backend solutions.
  • This premium tier is designed for businesses seeking enhanced features like advanced data handling and API capabilities, architecture management, increased automation, and comprehensive support for both Node.js and .NET applications.
  • The Enterprise Edition is partly open-source, partly source available, and partly Amplication proprietary and not source-available. The idea is to keep the Amplication business while doing the maximum for the community and our loved developers.

Amplication's Commitment to Open Source

Amplication remains deeply committed to the open-source community. As we expand our offerings with the Enterprise Edition, we make sure to align our development practices and commercial solutions with the values of our open-source projects.