Installation

Requirements

Before creating your first Spark project, you should ensure that your local machine has:

  • .NET 8+ - You can find the download here.
  • Node and Npm - You can find the download here

Once you have the .NET 8 SDK installed, you will also need Entity Framework Core tools. This can be installed with a simple dotnet command in your terminal:

dotnet tool install --global dotnet-ef

Your First Spark Project

After you have installed the required dependencies, you will need to install the Spark CLI.

# Install the Spark CLI
dotnet tool install --global Spark.CLI

Then using the Spark CLI, install the Spark project templates.

# Install Spark's project templates
spark install

You are now ready to create your first Spark project!

# Create your first Spark project
spark new MyApp

If you prefer Razor Pages over Blazor, you can use the -t option when creating a project to scaffold a Razor Pages application instead.

# Create a Spark razor pages project
spark new MyApp -t razor

You can open your Spark solution in the console by using Spark’s open command. This will open it with your default IDE.

cd MyApp
spark open

Now that your project has been created and you have it open, run npm install.

npm install

You can now create and run your first database migration. This will create the User tables for authentication that comes with a fresh Spark project.

spark make migration User
spark migrate

Finally, start your application in Visual Studio or by using the dotnet watch command:

dotnet watch

Updating Spark CLI

The easiest way to update the Spark CLI is to uninstall and reinstall it.

dotnet tool uninstall -g Spark.CLI
dotnet tool install -g Spark.CLI

Updating Spark’s Project Templates

To update Spark’s project templates, simply run the spark update command in your console.

spark update