Directory Structure

Introduction

The Spark application structure is setup to give a consistant, organized project structure for your web application.

Because Spark provides a defined structure for you, there are no suprises when starting work on new or existing Spark project.

However, you are still free to create classes wherever you’d like if you choose to.

Application

The Application directory contains the core code of you application.

Controllers

The Controllers directory contains your Controller classes. This directory is only generated for API project types.

Database

The Database directory contains your DbContext and Migrations for EF Core.

Events

The Events directory contains your event and listener classes. Events are used to alert other parts of your app that a given action has occurred. This provides great flexibility and decoupling.

Mail

The Mail directory contains your mailable classes. Mailables are C# classes that represent a specific type of e-mail that you can send.

Models

The Models directory contains your efcore model classes. Each database table for your application has a corresponding Model class that efcore will use to interact with that table.

Services

The Services directory contains your services that can be Dependency Injected on startup. Services are typically used to abstract away business logic or database calls.

Startup

The Startup directory contains Registration classes. These classes are where Sparks core services, custom services, events, or jobs are registered to the DI container. Scheduled jobs can also be registered here.

Jobs

The Jobs directory contains queueable jobs for your application. Jobs can be scheduled or added to a background queue.

Pages

This is where your sites frontend markdown will be contained. The Pages directory contains your Blazor pages and Razor components.

Storage

The Storage directory contains your application logs if the Spark logger is setup to log to files. It also contains mail logs if your mailer is setup to log to files.

wwwroot

The wwwroot directory contains your compiled CSS, images, and other frontend public dependancies.

Stay up to date with Spark on Twitter or our Newsletter

Looking for .NET jobs? Check out Dotnet Jobs for weekly job postings.