# Generating a New Project

## Generate a component

To generate a new React component in island-ui-core.

```bash
yarn generate @nx/react:component MyComponent --project=island-ui-core
```

## Generate an application

To generate a simple React application:

```bash
yarn generate @nx/react:app my-app
```

To get a React application with server-side-rendering, we recommend using Next.JS:

```bash
yarn generate @nx/next:app my-app
```

To create a service, you can get started with NestJS like this:

```bash
yarn generate @nx/nest:app services/my-service
```

{% hint style="info" %}
You might want to check out our reference [NextJS](https://github.com/island-is/island.is/tree/main/apps/reference-next-app) and [NestJS](https://github.com/island-is/island.is/tree/main/apps/reference-backend) projects.
{% endhint %}

{% hint style="info" %}
For NextJS projects, be sure to configure our [custom NextJS server](/development/devops/next-server.md).
{% endhint %}

## Generate a library

To generate a React library.

```bash
yarn generate @nx/react:lib my-lib --linter eslint
```

To create a NestJS module:

```bash
yarn generate @nx/nest:lib my-lib
```

To create a JS library that can be used both on the frontend and the backend:

```bash
yarn generate @nx/node:lib my-lib
```

Libraries are sharable across libraries and applications. They can be imported from `@island.is/my-lib`.

Applications and libraries can be structured in a hierarchy using subfolders:

```bash
yarn generate @nx/node:lib common/my-lib

# Imported from '@island.is/common/my-lib'
```

## Migrations

Using the `sequelize-cli` we support version controlled migrations that keep track of changes to the database.

### Generate a migrations

```bash
yarn nx run <project>:migrate/generate
```

### Migrating

```bash
yarn nx run <project>:migrate
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.devland.is/development/generate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
