# Anatomy of a project

> Gradle modules, how the MainWindow is resolved by classname, and where assets live.

Source: https://crossfly.dev/docs/get-started/project-structure — CrossFly documentation. Full docs as one file: https://crossfly.dev/llms-full.txt

# Anatomy of a project

Understand what generated the "skeleton" before you touch it.

## The Gradle modules
```
:core     → código compartilhado: suas Windows, componentes, lógica, dados
:lwjgl3   → launcher desktop
:android  → launcher Android
:ios      → launcher iOS (RoboVM)
:web      → launcher Web (TeaVM)
```
You program **almost always in `core`**. Each launcher only does the OS *bootstrap* — it instantiates the `Main`
and configures the window (see [platforms](/docs/platforms)).

## How the `MainWindow` is resolved
The `Main` instantiates the main window **by reflection**:
1. it uses the class indicated in **`cmdline["classname"]`** (passed by the launcher); or
2. in its absence, the overridden **`getMainWindow()`**.

Requirement: the class needs a **public no-argument constructor** (it's instantiated by reflection).

## Complete example (copy, paste and run)
A minimal, runnable `MainWindow` class, with the no-args constructor required by reflection:
```java
package com.exemplo;

import dev.crossfly.ui.*;
import dev.crossfly.ui.layout.*;

public class MainWindow extends Window
{
   public MainWindow() { }          // no-args constructor (required for reflection)

   @Override
   public void onShow() throws Exception
   {
      super.onShow();
      setLayout(new VerticalLayout());
      add(LAY_AUTO, new Label("MainWindow resolvida por classname"));
   }
}
```

## Suggested app organization
Inside `core`, a structure that scales (see [app architecture](/docs/best-practices/arquitetura-de-app)):
```
app/
 ├─ ui/screens/      → suas Windows (uma tela = uma Window)
 ├─ ui/components/   → componentes reutilizáveis
 ├─ data/            → repositórios (SQLite, rede)
 └─ model/           → objetos de domínio
```

## Assets and fonts
The base fonts (Roboto, FontAwesome, Material) are loaded at bootstrap; your assets (images,
data) live in the project's assets directory and are read by path (see
[Images](/docs/ui/images-and-graphics/images)).

## Next steps
→ [Panoramic tour of CrossFly](/docs/get-started/tour)

## See also
- Concept: [The lifecycle](/docs/concepts/lifecycle) · [The layered architecture](/docs/concepts/architecture)
