---
bodyclass: docs
headline: Project Structure
layout: docs
sidenav: doc-side-guides-nav.html
title: Project Structure
type: markdown
---

<p class="lead">This document describes standard structure of a Spine-based project. 
It assumes that you are familiar with Gradle.</p>

<p>Spine uses Gradle for project model definition and as the build tool. 
It follows the standard structure of the Gradle project with extensions related to 
the code generation done by Protobuf Compiler and Spine Model Compiler.</p>

## Handcrafted code

Following standard Gradle conventions a manually written code is created under the 
`src/main/` directory with subdirectories `proto`, `java`, etc. for corresponding languages.

After a project is defined in Gradle, a work on a module usually starts in the  
the `proto` directory.

## Generated code

The generated code is placed under the `generated` directory under the module root.
The sub-directories are:

* `java` — the code generated by Protobuf Compiler
* `resources` — mappings generated by Spine Model Compiler
* `spine` — the code generated by Spine Model Compiler  

## Example 

Here's how a typical project structure would look like:

```
myproject
  module-1
    generated
       main
         java
         resources
         spine
         ...
       test
         java
         resources
         spine
         ...   
    src
       main
         java
         proto
       test
         java
         proto
    ...     
    build.gradle
  module-2
    generated
      ...
    src
      ...
    build.gradle
  ...
  build.gradle           
``` 


---
bodyclass: docs
headline: Project Structure
layout: docs
sidenav: doc-side-guides-nav.html
title: Project Structure
type: markdown
---

<p class="lead">This document describes standard structure of a Spine-based project. 
It assumes that you are familiar with Gradle.</p>

<p>Spine uses Gradle for project model definition and as the build tool. 
It follows the standard structure of the Gradle project with extensions related to 
the code generation done by Protobuf Compiler and Spine Model Compiler.</p>

## Handcrafted code

Following standard Gradle conventions a manually written code is created under the 
`src/main/` directory with subdirectories `proto`, `java`, etc. for corresponding languages.

After a project is defined in Gradle, a work on a module usually starts in the  
the `proto` directory.

## Generated code

The generated code is placed under the `generated` directory under the module root.
The sub-directories are:

* `java` — the code generated by Protobuf Compiler
* `resources` — mappings generated by Spine Model Compiler
* `spine` — the code generated by Spine Model Compiler  

## Example 

Here's how a typical project structure would look like:

```
myproject/
  gradle/
  module-one/
    generated/
       main/
         java/
         resources/
         spine
         ...
       test/
         java/
         resources/
         spine/
         ...   
    src/
       main/
         java/
         proto/
       test/
         java/
         proto/
    ...     
    build.gradle
  module-two/
    generated/
      ...
    src/
      ...
    build.gradle
  ...
  build.gradle
  gradlew
  gradlew.bat
  settings.gradle
``` 


Use path separators in the project structure example
Use path separators in the project structure example

Also: mention Gradle directory and wrapper files in the structure to
highlight the fact that the project uses Gradle.
