> For the complete documentation index, see [llms.txt](https://docs.starcounter.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.starcounter.io/2.3.1/cookbook/project-structure.md).

# Proposed Project Structure

The Starcounter app project structure is inspired by [the structure of ASP.NET 5 projects](http://gunnarpeipman.com/2014/10/asp-net-5-new-structure-of-solutions-and-projects/). The difference is that ASP.NET has `Controllers`, `Models`, `Scripts`, and `Views` while Starcounter has `Api` handlers, JSON + HTML `viewmodels` and `database` classes.

This tree displays the structure of a Starcounter project:

![](/files/-KtCfo6Bmkx8UJQzxkGr)

## Namespaces

`Api`, `Database`, `Helpers`, and `ViewModels` folders may or may not have their own namespace.

A json view model class would look like this:

```csharp
using Starcounter;

namespace StarcounterSample 
{
    public class MainPage : Json 
    {
    }
}
```

A helper file inside `Helpers` folder would look like this:

```csharp
namespace StarcounterSample 
{
    public class StringsHelper 
    {
    }
}
```

A handler file inside `Api` folder would look like this:

```csharp
using Starcounter;

namespace StarcounterSample 
{
    public class MainHandlers 
    {
        public void Register() 
        {
            Handle.GET("/StarcounterSample", () => new MainPage());
        }
    }
}
```

Custom sub-folders and sub-namespaces could be used if needed.

A view page inside sub-folder: `StarcounterSample/ViewModels/Launcher/AppMenuPage.json`.

```csharp
using Starcounter;

namespace StarcounterSample.Launcher 
{
    public class AppMenuPage: Json 
    {
    }
}
```

## C# files & Classes

Name of `.cs` and `.json` files should be exactly the same as classes inside. Name of `.json` and `.json.cs` files should also match.

The correct structure for sign in page would be like this:

* `ViewModels/SignInPage.json`
* `ViewModels/SignInPage.json.cs`
* `class SignInPage : Json`

## Html Page Files

Html files which represent a json view model like `SignInPage.Html` should be named exactly the same as name of json file.

This is correct:

```javascript
{
    "Html": "/GoogleSignIn/views/SignInPage.html"
}
```

And these are incorrect:

```javascript
{
    "Html": "/GoogleSignIn/views/signinpage.html"
}
```

```javascript
{
    "Html": "/GoogleSignIn/views/sign-in-page.html"
}
```

## Custom Elements

The html files which do not represent any of json page should be stored inside `elements` folder. The name of a file should be exactly the same as name of the element inside.

## JavaScript Libraries

Most of the Starcounter applications do not use custom JavaScript libraries outside of WebComponents.\
If you need a custom JavaScript library then it should be scoped to your application and saved inside a `js` folder.

## Startup `Program.cs` Class

* In small applicaions, the startup class may register handlers and make some preparations.
* In big applications, the startup class should be minified and only call `Register` method of `/Api/` classes.

## Visual Studio Files

Visual Studio solution (`sln`) and project (`csproj`, `kproj`) files should be checked in to the version control system.

User preference files (`suo`), which carry information about unloaded projects in a solution or breakpoints in a project, should not be checked in to the version control system.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.starcounter.io/2.3.1/cookbook/project-structure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
